openttd doesn't compile on OSX

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

flyx
Engineer
Engineer
Posts: 8
Joined: 01 Apr 2010 12:11

openttd doesn't compile on OSX

Post by flyx »

Hi,

I'm trying to compile the recent trunk version on MacOSX Snow Leopard. This is what I get when running configure:

Code: Select all

...
checking ccache... no (only used when forced)
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in ccPxLxY6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
/Users/Felix/Downloads/openttd-trunk-r19527/trunk/config.lib: line 929: ./G5_detector: No such file or directory
detecting G5... no
...
It finishes, but when I try to build, I get the same error again:

Code: Select all

[LANG] Compiling and Linking endian_check
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in cc5Ndv4r.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [endian_check] Error 1
[SRC] Compiling and Linking endian_check
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in cc2xq0Wq.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [all] Error 2
Can anyone tell me what goes wrong here?
loclahost
Engineer
Engineer
Posts: 46
Joined: 18 Dec 2008 07:39
Location: Sweden

Re: openttd doesn't compile on OSX

Post by loclahost »

I think that OSX support has been deprecated for OpenTTD, which should be the reason as to why it won't compile. See http://www.tt-forums.net/viewtopic.php? ... 47&start=0 for the whole reasoning behind the decision. Maybe you can find someone who have workarounds there too?
jamikea
Engineer
Engineer
Posts: 18
Joined: 09 Apr 2008 15:15

Re: openttd doesn't compile on OSX

Post by jamikea »

It did compile for me withough any issues only 2 weeks ago though (also on OSX 10.6). I may check in the evening if it still does.

Your error is a linker thing actually... looks like the c++ library is not linked to (see http://www.cocoabuilder.com/archive/coc ... fined.html) or something like that.
flyx
Engineer
Engineer
Posts: 8
Joined: 01 Apr 2010 12:11

Re: openttd doesn't compile on OSX

Post by flyx »

I found the problem. I had to set CXX manually before running configure.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: openttd doesn't compile on OSX

Post by andythenorth »

That was a scary post title :shock:

I dread the sad day when I actually can't compile OpenTTD on OS X. With no maintainer, that's eventually going to happen.

I then have to play the game with Crossover/DarWINE (I thought this was a good solution, but in tests it's a bit sucky)...or I have to stop with the game :o

EDIT: or Mac players put an effort into fnding a Mac maintainer in places like macnn.com and macintouch.com....
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: openttd doesn't compile on OSX

Post by HackaLittleBit »

I spoke with Steve yesterday, and he told me that he is about to finalise the merger talks with Bill wich means that they themselves are going to drop support in the near future.
The date that they officially will switch to win7 will be announced soon.

Hope this helps

Regards HackaLittleBit
User avatar
Wintersoldier
Traffic Manager
Traffic Manager
Posts: 197
Joined: 20 Feb 2010 03:08
Location: The world

Re: openttd doesn't compile on OSX

Post by Wintersoldier »

Well, I do maintain my own compile for Mac, but it's not in conjunction with the developers because I don't have the time to actively work on the game
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: openttd doesn't compile on OSX

Post by HackaLittleBit »

Wintersoldier wrote:I don't have the time to actively work on the game
Bringing it up to date may take some time, but I doubt that maintaining the code for OSX requires a lot of time.
But I may be wrong :roll:

Anyhow this one is for you Wintersoldier :wink:
User avatar
Wintersoldier
Traffic Manager
Traffic Manager
Posts: 197
Joined: 20 Feb 2010 03:08
Location: The world

Re: openttd doesn't compile on OSX

Post by Wintersoldier »

hackalittlebit wrote:I doubt that maintaining the code for OSX requires a lot of time.

Anyhow this one is for you Wintersoldier :wink:
First, as far as I know, all that needs to be done is to download the source, compile it, and then upload it, so I don't think I need to know any code. Second, http://www.youtube.com/watch?v=99X8WDQWAKg. Brother Maynard, bring out the holy hand grenade.
User avatar
Dada
Engineer
Engineer
Posts: 43
Joined: 02 Apr 2010 13:01
Location: Rotterdam, The Netherlands

Re: openttd doesn't compile on OSX

Post by Dada »

I've compiled 1.0.0 for Mac OS X. No idea if this version will work for anybody else, but whoever wants to give it a shot can download it here: http://wedemandhtml.com/tmp/openttd-osx-1.0.0.zip

It was compiled on an Intel computer running Mac OS X 10.6.2.
compuguy1088
Engineer
Engineer
Posts: 4
Joined: 03 Apr 2010 16:58

Re: openttd doesn't compile on OSX

Post by compuguy1088 »

andythenorth wrote:That was a scary post title :shock:

I dread the sad day when I actually can't compile OpenTTD on OS X. With no maintainer, that's eventually going to happen.

I then have to play the game with Crossover/DarWINE (I thought this was a good solution, but in tests it's a bit sucky)...or I have to stop with the game :o

EDIT: or Mac players put an effort into fnding a Mac maintainer in places like macnn.com and macintouch.com....
I hate that this may happen too.........
flyx
Engineer
Engineer
Posts: 8
Joined: 01 Apr 2010 12:11

Re: openttd doesn't compile on OSX

Post by flyx »

After trying a lot of things, I succeeded in cross-compiling OpenTTD for PPC, Intel and Intel-64bit. Here's some information for other people having problems:
  • I don't know if this is a problem with my individual system configuration, but the zlib compiled as 64bit library by default, libpng compiled as 32bit. If you're getting linker errors stating one of your libs has the wrong architecture when compiling OpenTTD, you can add "-arch i386" or "-arch x86_64" to the CFLAGS, CXXFLAGS and LDFLAGS to make sure your binaries have the right architecture, like this:

    Code: Select all

    $ export CXXFLAGS="-arch x86_64"
    $ export CFLAGS="-arch x86_64"
    $ export LDFLAGS="-arch x86_64"
  • If you're getting a strange error when running ./configure, try to set CXX and CC to your C++ compiler (seems strange, but works):

    Code: Select all

    $ export CXX=/usr/bin/g++-4.2
    $ export CC=/usr/bin/g++-4.2
  • If you're compiling 64bit, you'll probably run into an error when compiling md5.cpp. To fix this, you can add another flag to CXXFLAGS:

    Code: Select all

    $ export CXXFLAGS="-arch x86_64 -D_SQ64"
  • If you want to compile a universal binary: You can compile OpenTTD for i386 and ppc at the same time, this will result in a universal binary running on Intel and PPC Macs. However, it does not support 64bit. You can do this by adding "-arch i386 -arch ppc" to CFLAGS, CXXFLAGS and LDFLAGS as described above. Of course, you need to have universal binary files of libpng, zlib and liblzo2 to link against. The easiest way to do this is to compile them two times, one for each architecture, and merge them with lipo afterwards. You can NOT compile OpenTTD with 64bit AND i386/ppc at the same time, because you need the -D_SQ64 flag for compiling 64bit. However, you can compile OpenTTD two times and merge your binaries with lipo afterwards.
  • You have to run ./configure AFTER you set all those environment variables.
I provide a binary package for PPC, Intel and Intel64 patched with the cargodist-minipack here:
http://flyx.org/files/openttd-cargodist ... versal.zip

Read the install.txt if OpenTTD crashes on launching.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: openttd doesn't compile on OSX

Post by Rubidium »

You mean "./configure --enable-universal=64 --enable-static" doesn't work? It works fine for me in the cross-compile environment, although it needs cross-compiled libraries to match.
flyx
Engineer
Engineer
Posts: 8
Joined: 01 Apr 2010 12:11

Re: openttd doesn't compile on OSX

Post by flyx »

I'm not that deep into this configure stuff (in fact, I really dislike all this autotools stuff because it NEVER works for me without fixing something), so I used compiler flags instead of configure flags. You probably don't get the _SQ64 error, do you?
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: openttd doesn't compile on OSX

Post by Rubidium »

I hate autotools too and for your information: OpenTTD's configure isn't autotools.

You get the _SQ64 error because -arch does funky things and because the compiler testing doesn't care about C(XX)FLAGS. If you use CXX="g++ -arch ppc64" CC="gcc -arch ppc64" you would not be getting the error (for PPC64) and similarly it holds for x86_64.
flyx
Engineer
Engineer
Posts: 8
Joined: 01 Apr 2010 12:11

Re: openttd doesn't compile on OSX

Post by flyx »

Good to know, thanks for the information.
aantono
Traffic Manager
Traffic Manager
Posts: 211
Joined: 15 Apr 2010 21:01
Location: Midwest, US

Re: openttd doesn't compile on OSX

Post by aantono »

Looks like the http://flyx.org/files/openttd-cargodist ... versal.zip link is no longer valid. Did the file got removed? :(
flyx
Engineer
Engineer
Posts: 8
Joined: 01 Apr 2010 12:11

Re: openttd doesn't compile on OSX

Post by flyx »

Yes, I patched OpenTTD further for my own needs, and thus this file was outdated and I removed it. It wasn't meant to be a permanent resource, sorry.

Here is the new binary, which has the cargodist minipack included - it also includes incomereduce, a patch I made with some friends to have a more challenging game on our server, on which you earn less money:

http://flyx.org/files/openttd-cargodist ... -1.0.0.zip

Note that this binary is NOT COMPATIBLE with any other servers. Combined patch from OpenTTD 1.0.0 to our version is here:

http://isobeef.org/downloads/openttd-ca ... 9601.patch

PS: No documentation. We're lazy.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: openttd doesn't compile on OSX

Post by Yexo »

flyx wrote:Note that this binary is NOT COMPATIBLE with any other servers. Combined patch from OpenTTD 1.0.0 to our version is here:
Then please don't name it 1.0.0. Give it version 1.0.0M, 1.0.0-my_osx_build or whatever you want but not 1.0.0
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: openttd doesn't compile on OSX

Post by planetmaker »

actually with these kind of mods its rather worth its own patch pack or whatever thread as it's not really related to compile problems anywhere - nor offer a binary which one would want to use, if just looking for an at least trunk-compatible binary.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests