Compiling OpenTTD on Windows 10 with MinGW (trying properly this time)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
GuilhermeJK
Engineer
Engineer
Posts: 55
Joined: 01 Nov 2014 05:24
Location: São José dos Campos, Brazil

Compiling OpenTTD on Windows 10 with MinGW (trying properly this time)

Post by GuilhermeJK »

Salutations fellas. In my old Windows 7 computer I had managed to compile OpenTTD using MS Visual C++ 2008. Now I have acquired a new PC with Windows 10 and don't have MS Visual C++ anymore.

I decided it is time to compile OpenTTD with MinGW + MSYS, so I wouldn't depend on MS C++. The only experience I have compiling C/C++ code is from small apps when I learned programming at the university. Nowadays I mostly use Python. So I am pretty much lost in here.

I followed the tutorial at the wiki and after installing the libraries, zlib and lzma weren't found during ./configure of OpenTTD

MSYS messages:
[+] Spoiler

Code: Select all

$ ./configure
checking awk... awk
detecting OS... MINGW
checking build system type... mingw32
checking host system type... mingw32
checking universal build... no
checking build cc... gcc
checking host cc... gcc
checking build c++... g++
checking host c++... g++
checking host windres... windres
checking strip... disabled
checking builtin depend... yes
checking makedepend... disabled
detecting cpu-type... 32 bits
detecting SSE... found
checking static... yes
checking unicode... yes
using debug level... no
using desync debug level... no
using link time optimization... no
checking OSX sysroot... not OSX, skipping
checking allegro... not found
checking sdl... not found
checking COCOA... not OSX, skipping
checking GDI video driver... found
checking dedicated... not selected
checking console application... disabled (only used when forced)
checking network... found
checking squirrel... found
checking translator... no
checking assert... enabled
checking zlib... not found
checking liblzma... not found
WARNING: lzma was not detected or disabled
WARNING: OpenTTD doesn't require lzma, but it does mean that many features
WARNING: (like loading most savegames/scenarios and joining most servers)
WARNING: will be disabled.
 If you want to compile without lzma use --without-lzma as parameter
While trying to search for a solution (haven't got anywhere) I've also stumbled upon MinGW-w64 fork.

Basically I have three questions:
1. What is the most up-to-date software to compile OpenTTD for Windows 10 (x64)? Is it MinGW-w64?

2. Assuming MinGW being used (and considering the attached code), how can I solve the 'not found' libraries issue? I checked in C:\MinGW\bin folder and they are there.

3. Should I still be using MSYS?
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Compiling OpenTTD on Windows 10 with MinGW (trying properly this time)

Post by HackaLittleBit »

Check out MSYS2

I managed to compile with that.

Or make dual-boot with Linux Mint.
And develop on Linux.
User avatar
GuilhermeJK
Engineer
Engineer
Posts: 55
Joined: 01 Nov 2014 05:24
Location: São José dos Campos, Brazil

Re: Compiling OpenTTD on Windows 10 with MinGW (trying properly this time)

Post by GuilhermeJK »

Awwwyeah, got something HackaLittleBit. It took me a while (as wasn't just as straightforward as installing MSYS2 and running the compiling tutorial), but using the MSYS2 MinGW 64-bit Shell (mingw64.exe) I have managed to compile with almost all except liblzo2, which I think does not have the 64-bit version (
pacman -S mingw-w64-x86_64-lzo2
didn't work, but
pacman -S mingw-w64-{i686,x86_64}-lzo2
did).

I will try to compile the 32-bit version tomorrow, but I must ask:

Is my conclusion over liblzo2 not being able to be compiled under 64-bit version correct?
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Compiling OpenTTD on Windows 10 with MinGW (trying properly this time)

Post by Alberth »

fwiw, my linux system says

Code: Select all

$ file /usr/lib64/liblzo2.so.2.0.0
/usr/lib64/liblzo2.so.2.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=25978afab54c3ac11d456243a56076f995e27e7e, stripped
So it seems I have a compiled 64 bit lzo2 library.
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Compiling OpenTTD on Windows 10 with MinGW (trying properly this time)

Post by HackaLittleBit »

GuilhermeJK wrote: Is my conclusion over liblzo2 not being able to be compiled under 64-bit version correct?
If I remember correct, I also was not able to compile that one.
So I switched to 32bit
The program was written by Oberhumer (possible member ottd)
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Compiling OpenTTD on Windows 10 with MinGW (trying properly this time)

Post by jfs »

For compiling on Windows, you should probably get MS Visual Studio 2017 Community Edition. It's a full version, free of charge for hobby and open source work.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests