Cross-compiling OpenTTD?

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
User avatar
Observer
Logo Creator
Posts: 2189
Joined: 19 Nov 2002 12:21
Location: Zoetermeer, The Netherlands
Contact:

Some help?

Post by Observer »

I perhaps need a little help here...

I have downloaded the sourcefiles from the openttd website. I have extracted them on my linux machine and made my desired modification.
I have successfully compiled it and it runs fine.

Now the tricky part:

I use this linux machine only for development, so I would like to play my new compiled game on windowsXP.
I have downloaded the cross-platform compiler from libsdl.org and tried to compile the source. First it gave me some errors on the network, zlib and png options. But after disabling this it gave me the following error:

windres -o winres.o ttd.rc
make: windres: Command not found

I looked for a file named windres.o .c or winres.o .c ... it seems this file is not in the package..

Am I making a mistake somewhere here, or is this file accidently forgotten in the package?

Please some responds here, Im dying to play the game 8)
Never fear, I is here...
Mek
TTDPatch Developer
TTDPatch Developer
Posts: 417
Joined: 13 Apr 2004 13:35
Location: Eindhoven, Netherlands
Contact:

Re: Some help?

Post by Mek »

If you have a complete cross-compiler, this should include windres as well... for examble i have a /usr/local/bin/i386-mingw32msvc-windres... but the prefix depends on what cross-compiler you have...
Observer wrote:I perhaps need a little help here...

I have downloaded the sourcefiles from the openttd website. I have extracted them on my linux machine and made my desired modification.
I have successfully compiled it and it runs fine.

Now the tricky part:

I use this linux machine only for development, so I would like to play my new compiled game on windowsXP.
I have downloaded the cross-platform compiler from libsdl.org and tried to compile the source. First it gave me some errors on the network, zlib and png options. But after disabling this it gave me the following error:

windres -o winres.o ttd.rc
make: windres: Command not found

I looked for a file named windres.o .c or winres.o .c ... it seems this file is not in the package..

Am I making a mistake somewhere here, or is this file accidently forgotten in the package?

Please some responds here, Im dying to play the game 8)
User avatar
Observer
Logo Creator
Posts: 2189
Joined: 19 Nov 2002 12:21
Location: Zoetermeer, The Netherlands
Contact:

Re: Some help?

Post by Observer »

Mek wrote:If you have a complete cross-compiler, this should include windres as well... for examble i have a /usr/local/bin/i386-mingw32msvc-windres... but the prefix depends on what cross-compiler you have...
Hey I got that too... but can you perhaps explain to me how to fix this error?
Never fear, I is here...
Mek
TTDPatch Developer
TTDPatch Developer
Posts: 417
Joined: 13 Apr 2004 13:35
Location: Eindhoven, Netherlands
Contact:

Re: Some help?

Post by Mek »

Observer wrote:
Mek wrote:If you have a complete cross-compiler, this should include windres as well... for examble i have a /usr/local/bin/i386-mingw32msvc-windres... but the prefix depends on what cross-compiler you have...
Hey I got that too... but can you perhaps explain to me how to fix this error?
to cross-compile anything, you've got to prefix all gcc/g++/windres/other platform specific programs with for example i386-mingw32msvc-... i'm not sure how well suited the openttd makefile is for cross-compiling though... i never tried it...
User avatar
Observer
Logo Creator
Posts: 2189
Joined: 19 Nov 2002 12:21
Location: Zoetermeer, The Netherlands
Contact:

Re: Some help?

Post by Observer »

Mek wrote:to cross-compile anything, you've got to prefix all gcc/g++/windres/other platform specific programs with for example i386-mingw32msvc-... i'm not sure how well suited the openttd makefile is for cross-compiling though... i never tried it...
Thanks mate... I have it compiled and running on windows...

I only shouldnt have disabled that zlib feature, because I cannot load my savegames :( .. but Ill figur a way to get this working. Maybe Ill start with installing the zlib libraries :p.

Thanks again for the quick response. :)
Never fear, I is here...
User avatar
Thade
Engineer
Engineer
Posts: 92
Joined: 19 Apr 2004 11:23
Location: Denmark/Italy

Post by Thade »

worldofklaus wrote: And as for the other bug, it doesn't only apply to ICE3, as you can see:
That's because you picked another loco with a maximum number of coaches... :roll:
User avatar
Observer
Logo Creator
Posts: 2189
Joined: 19 Nov 2002 12:21
Location: Zoetermeer, The Netherlands
Contact:

Post by Observer »

Ok Im back with another problem (sorry to keep bugging everyone here and sorry if this is not the correct topic to post it. I just cant find a better one).

As you have read above, Im trying to get the ottd sources compiled.
Downloading the code, ajusting it, compiling it for linux, compiling it for windows, so far so good.
Only I had to disable the zlib support because he could not locate it. But now it seems unable to open my savegames (well duhh, they are zlib)..

I have checked my version of zlib and its 1.2.1 .. I have the zlib.h and zconf.h files copied into my openttd directory, because the STATIC_ZLIB dir option does not seem to work. Now it DOES compile fine... but while linking I get the following errors:

Generating table/strings.h
Compiling and Linking openttd.exe
saveload.o(.text+0x117d):saveload.c: undefined reference to `_inflateInit_'
saveload.o(.text+0x11ee):saveload.c: undefined reference to `_inflate'
saveload.o(.text+0x1257):saveload.c: undefined reference to `_inflate'
saveload.o(.text+0x129b):saveload.c: undefined reference to `_inflateEnd'
saveload.o(.text+0x12e6):saveload.c: undefined reference to `_deflateInit_'
saveload.o(.text+0x1362):saveload.c: undefined reference to `_deflate'
saveload.o(.text+0x1414):saveload.c: undefined reference to `_deflateEnd'
saveload.o(.text+0x1454):saveload.c: undefined reference to `_deflateEnd'
collect2: ld returned 1 exit status
make: *** [openttd.exe] Error 1

Is there anyone who might have a clue of what Im doing wrong here?
Never fear, I is here...
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

I know one way to send him savegames, which seems easier
edit openttd.cfg (this is one of the few options not accessable from within the game)
find the line
savegame_format =
and alter it to
savegame_format = lzo

Now people without zlib can read yout savegames. They are a bit bigger through

As for the compile problem, it can't locate zlib.a (given that you use STATIC)
If you find zlib.a, please tell where it is and the makefile can be made to look for it in that place

[edit]. To use zlib for saving again, use
savegame_format = zlib
User avatar
Observer
Logo Creator
Posts: 2189
Joined: 19 Nov 2002 12:21
Location: Zoetermeer, The Netherlands
Contact:

Post by Observer »

Bjarni wrote:I know one way to send him savegames, which seems easier
edit openttd.cfg (this is one of the few options not accessable from within the game)
find the line
savegame_format =
and alter it to
savegame_format = lzo
Wouldn't have this the same result as compiling without zlib? Because that is what I do right now, and I can still save (but in what format...).
Now people without zlib can read yout savegames. They are a bit bigger through
I suppose lzo is not compatible with the original ttdlx saves now is it?
As for the compile problem, it can't locate zlib.a (given that you use STATIC)
If you find zlib.a, please tell where it is and the makefile can be made to look for it in that place
During the actual compile it doesn't seem to need zlib.a, he uses it only to find zlib.h right? Anyways Ive looked.. I dont have any zlib.a file.
Its not a misinstallation, because my linux distro has a portage system and I just installed the zlib portage.

[EDIT] My mistake, it also looks for libz.a and that file is in /usr/lib ... but it seems that it still cannot locate zlib.h even if I place it in /usr/lib..
[edit]. To use zlib for saving again, use
savegame_format = zlib
Ofcourse I have to compile with the zlib function to make this work.. and that still doesn't work.

I just woke up, so Ill probably spend the rest of my day figuring this out. I just want it to work (/me is like perfectionist).

Thanx for your comment.
Never fear, I is here...
MT3269
Traffic Manager
Traffic Manager
Posts: 129
Joined: 04 May 2004 05:44
Location: Australia

Post by MT3269 »

So is electrified track supported yet or is that for 4.0?
User avatar
Observer
Logo Creator
Posts: 2189
Joined: 19 Nov 2002 12:21
Location: Zoetermeer, The Netherlands
Contact:

Post by Observer »

Just a small update on my workings..

1. My cross-platform compiler seems to be the problem, so Ill have to fix this without asking help here, cause the OTTD source is fine.

2. I have modified (very small and easy modification) the game so that an extra loc gives 50% of its max speed to be add to the total maximum speed. So two locs that can do 64kmh combined could go 96kmh.
If anyone wants the code, let me know.
Never fear, I is here...
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7596
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

how would an extra loco make the maximum RPM of a loco's engine increase?
Image
User avatar
Observer
Logo Creator
Posts: 2189
Joined: 19 Nov 2002 12:21
Location: Zoetermeer, The Netherlands
Contact:

Post by Observer »

Born Acorn wrote:how would an extra loco make the maximum RPM of a loco's engine increase?
We already had the realistic discussion... this option is far from it yes.. but it was in the patch and I like it :P
Never fear, I is here...
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

Observer wrote:1. My cross-platform compiler seems to be the problem, so Ill have to fix this without asking help here, cause the OTTD source is fine.
could you tell us how you managed to get it working?
Observer wrote:2. I have modified (very small and easy modification) the game so that an extra loc gives 50% of its max speed to be add to the total maximum speed. So two locs that can do 64kmh combined could go 96kmh.
If anyone wants the code, let me know.
I'm not really interested. I know where it should be edited if I want to, I coded the combined power and max speed in the first place and I still don't like the idea of going more than max speed with anything
User avatar
Observer
Logo Creator
Posts: 2189
Joined: 19 Nov 2002 12:21
Location: Zoetermeer, The Netherlands
Contact:

Post by Observer »

Bjarni wrote:
Observer wrote:1. My cross-platform compiler seems to be the problem, so Ill have to fix this without asking help here, cause the OTTD source is fine.
could you tell us how you managed to get it working?
Well actually .. no... :P because its still not working... I think I might try another cross compiler...

Ill let you know when it works.


And yes its a very easy change and I doubt if anyone would be interested, but ah well its opensource :p ...
Never fear, I is here...
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 17 guests