Cross compiling for Windows(eventually DOS) under Ubuntu

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
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Cross compiling for Windows(eventually DOS) under Ubuntu

Post by WWTBAM »

I am trying to build the Windows version of OpenTTD under the Windows Subsystem for Linux which runs an Ubuntu userland on top of a reverse Wine like set of drivers for the Windows NT Kernel. I am able to build the windows version of OpenTTD so long as I exclude all the optional libraries. Building OpenTTD with the following set of commands in Bash on Windows gives me a "working" executable - by working I mean most savegames can't be loaded amongst other optional things.

Code: Select all

./configure --host=i686-w64-mingw32 --without-png --without-icu --without-liblzma --without-lzo2 --without-zlib --without-sdl --without-iconv
make
I would like to get the libraries working. I have tried following the wiki page on cross compiling for Windows without luck. I suspect I need to go over the contents of that page to make sure all the commands I execute from that page work properly under WSL. I would like to try and get zlib working first, so that I can at least get the titlegame to load(currently I just get water).

edit:
or I may need to hack some scripts in the build process as Rubidium told me on IRC a coule of days ago. I would not have any clue as to which scripts to hack at though.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by adf88 »

It think I don't understand something ... if you are building on windows for windows, why cross compile? Just use MSYS or MSVC...

Anyway, I recently compiled windows binaries on Linux with all the libraries. However, I couldn't make ICU working, OpenTTD hangs on startup. If someone has a solution then that would be great.

Get the source, apply the patch (optional) and execute commands from the script (I suggest doing this one by one). The patch removes some warnings.
Attachments
ottd-cross-mingw32.sh.txt
(2.94 KiB) Downloaded 66 times
fix-mingw-w64-compilation-warnings.diff
(1.86 KiB) Downloaded 55 times
:] don't worry, be happy and checkout my patches
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by Eddi »

adf88 wrote:if you are building on windows for windows, why cross compile?
sometimes travelling is about the journey, not about the destination.
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by adf88 »

OFC, I'm traveling a lot last time :)

I'm just wondering why, just "because I can" or because of other reasons?
:] don't worry, be happy and checkout my patches
User avatar
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by WWTBAM »

I wanted to cross compile for windows as I have a working Windows environment now while I don't have a working DOS environment at the moment. I also figured cross compiling for Windows should be more straight forward than for DOS as cross compiling for Windows is done more regularly. I am on a 64 bit host.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by Transportman »

Why do you need to exclude the optional libraries? Do you get errors when not excluding them? Or does nothing happen at all when not excluding them?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by WWTBAM »

The build process assumes you want all the optional libraries that I have to exclude as some of them are almost not optional e.g. the compression libraries. Without zlib for example the nightly titlegame won't load.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by Transportman »

I think we have a small misunderstanding. I want to know why you are excluding them as it seems to me you want to include them (which would happen when not excluding them according to your post).
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by WWTBAM »

I get errors when including them. The build process can't find them regardless if I have built them or not.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by Transportman »

If I read the commands here, you might try by pointing to the location of the libraries, instead of letting the system finding them.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Cross compiling for Windows(eventually DOS) under Ubuntu

Post by adf88 »

Transportman wrote:If I read the commands here, you might try by pointing to the location of the libraries, instead of letting the system finding them.
This guide is outdated. I planned to update it, but I didn't found a solution for ICU crashing so I withdrew. See a new one that I attached few posts ago. It has no comments but instructions are similar to those on Wiki.
:] don't worry, be happy and checkout my patches
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 41 guests