Compiling OTTD on Mac OS Sierra?

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
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Compiling OTTD on Mac OS Sierra?

Post by Snail »

Hi guys,

I just installed Mac OS 10.12 (Sierra), and tried to compile OTTD. Not surprisingly, it doesn't work :(

I followed the instructions in this page, at the very bottom when it says "Compiling the source", but it looks like there's only information about Mavericks (my previous OS, where I compiled OTTD with no problems) and Yosemite.

It looks like there's something wrong with Clang. Indeed, if I configure (even applying the suggested syntax in the "Configuring on Mavericks (and Yosemite)" section), I get this scary message:

Code: Select all

clang: error: unsupported option '-dumpspecs'
clang: error: no input files
clang: error: unsupported option '-dumpspecs'
clang: error: no input files
Needless to say, when I run the "make", I get yelled at multiple times. There are lots of warnings, and then a fatal error. Since there's really a lot of them, I dumped them in a text file (attached).

My OS is 10.12 and I have XCode installed.

Any ideas? Should I just revert back to Mavericks? :p
Attachments
ottd on sierra errors.txt
Collection of warnings and errors
(135.77 KiB) Downloaded 192 times
The French Narrow Gauge Train Set is now released! Get it here
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Compiling OTTD on Mac OS Sierra?

Post by adf88 »

Could you upload 'config.log' file? It would be helpful. Run 'make distclean' to clean everything up. Configure again, 'config.log' should file be generated after you done.

Anyway, it seems like something is broken indeed. I cannot say much yet but you may try forcing clang with

Code: Select all

CC=/usr/bin/clang  ./configure
As of your compilation errors, there is only one - "no matching function for call to 'AUGraphNodeInfo'" in Coca midi driver. To confirm this you may try compiling without music ("./configure --without-midi").
:] don't worry, be happy and checkout my patches
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Re: Compiling OTTD on Mac OS Sierra?

Post by Snail »

adf88 wrote:Could you upload 'config.log' file? It would be helpful. Run 'make distclean' to clean everything up. Configure again, 'config.log' should file be generated after you done.
Thanks for the help! This is the file. It won't allow me to post it if it's got a "*.log" extension (doh) so I renamed it "config.log.txt".
I'll try your suggestions later today, since I'm a bit in a hurry now.
Attachments
config.log.txt
config.log
(7.31 KiB) Downloaded 175 times
The French Narrow Gauge Train Set is now released! Get it here
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Re: Compiling OTTD on Mac OS Sierra?

Post by Snail »

Sorry to reply to myself, but I just tried your suggestions.

The "CC=/usr/bin/clang ./configure" command gives me an error message:

Code: Select all

CC=/usr/bin/clang: Command not found.
Was this "clang" to be installed through MacPorts? If I do a "port installed" to see everything I have in my MacPorts, I can't see "clang" there.
As for the "./configure --without-midi" command, it doesn't seem it's a supported option:

Code: Select all

Unknown option --without-midi
And indeed, running "./configure -h" doesn't list "--without-midi" as an available option.

Any ideas?
The French Narrow Gauge Train Set is now released! Get it here
Eldarion
Engineer
Engineer
Posts: 30
Joined: 18 Jan 2012 20:56

Re: Compiling OTTD on Mac OS Sierra?

Post by Eldarion »

Hi, Just ran into the same issue with OSX 10.11.6 (El Capitan). This is what worked for me:

- upgraded using MacPorts
  • zlib, libpng, xz (contains liblzma), lzo2, freetype, icu
- configured with
  • .configure LDFLAGS="-stdlib=libstdc++"
- ran make

Besides the usual unused local typedef warnings, it gave another warning at the end:
  • clang: warning: libstdc++ is deprecated; move to libc++
Tried starting it and runs fine. Didn't try with music yet. When run, it outputs a warning on console:
  • WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
Configuring with "-stdlib=libc++" causes an error during linking. Maybe some of the libraries installed via MacPorts won't work with libc++. Don't really know.

Regarding all the "unused local typedef" warnings: It was mentioned on stackexchange that -Wunused-local-typedef is part of -Wall. When configuring with "-Wno-unused-local-typedef" the option is placed before -Wall so the latter turns it back on.

Regarding your clang problem: If, what I wrote before, works for you, don't worry about the clang errors during configure. It complains about an option that gcc has and clang doesn't. If you really want to mess about with configure options, put the CC= after .configure. On OSX 10.11.6 clang is installed in /usr/bin. MacPorts stuff gets installed in /opt/local by default.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Compiling OTTD on Mac OS Sierra?

Post by andythenorth »

I will need to upgrade to Sierra, I am hoping this gets figured out. Currently compiling fine on Mavericks :o

FWIW...

An offer from one of the Macports guys to help: https://bugs.openttd.org/task/6295
And a patch from him for El Capitan compile here: https://bugs.openttd.org/task/6380

I would be out of my depth with this, and I don't have a Sierra or El Capitan system to hand right now to test :o
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Re: Compiling OTTD on Mac OS Sierra?

Post by Snail »

Hi there,

Tried again with Sierra, but to no avail.
Eldarion wrote:Hi, Just ran into the same issue with OSX 10.11.6 (El Capitan). This is what worked for me:

- upgraded using MacPorts
  • zlib, libpng, xz (contains liblzma), lzo2, freetype, icu
I tried to, and was able to upgrade most of them (not all). The activated versions of these ports I'm using are the following:

Code: Select all

zlib @1.2.8_0+universal
libpng @1.4.8_0+universal
xz @5.0.5_0+universal
lzo2 @2.06_0
freetype @2.5.3_1+universal
icu @51.2_1
When I tried to upgrade "icu", I got an error upgrading "python27": and when I explicitly tried to upgrade python27, I got an error upgrading "librsvg" (all those dependencies are so annoying!)
Also, the "libpng" I'm using is not the latest version: I had to revert back to 1.4, because version 1.6 caused my GrfCodec to crash (I need grfcodec to code my set: can't do without it).
Eldarion wrote: - configured with
  • .configure LDFLAGS="-stdlib=libstdc++"
When I do this, I still get the same "clang" errors as in my first post.
Eldarion wrote: - ran make
Did that, and I got a lot of warnings: plus, a linking error at the end. Attached is the text of the linking error.
Eldarion wrote: Regarding all the "unused local typedef" warnings: It was mentioned on stackexchange that -Wunused-local-typedef is part of -Wall. When configuring with "-Wno-unused-local-typedef" the option is placed before -Wall so the latter turns it back on.

Regarding your clang problem: If, what I wrote before, works for you, don't worry about the clang errors during configure. It complains about an option that gcc has and clang doesn't. If you really want to mess about with configure options, put the CC= after .configure. On OSX 10.11.6 clang is installed in /usr/bin. MacPorts stuff gets installed in /opt/local by default.
Could you please elaborate this a bit? I'm not sure if I get what you're saying...

On another note, I also tried to include the patches in this page: https://bugs.openttd.org/task/6380
To apply those patches, I typed "patch -p0 < patchname.diff" in the Terminal window (as instructed here).
The message I get when trying to apply either of these patches was the following:

Code: Select all

patching file src/video/cocoa/wnd_quartz.mm
Hunk #1 FAILED at 110.
1 out of 1 hunk FAILED -- saving rejects to file src/video/cocoa/wnd_quartz.mm.rej
and

Code: Select all

patching file src/music/cocoa_m.cpp
Hunk #1 FAILED at 67.
1 out of 1 hunk FAILED -- saving rejects to file src/music/cocoa_m.cpp.rej
Any ideas?
Attachments
openttd_linking_error_20170211.txt
Linking error as I run "make"
(12.1 KiB) Downloaded 144 times
The French Narrow Gauge Train Set is now released! Get it here
Eldarion
Engineer
Engineer
Posts: 30
Joined: 18 Jan 2012 20:56

Re: Compiling OTTD on Mac OS Sierra?

Post by Eldarion »

Just tried compiling the latest revision on Capitan and got the same linking error you attached. Using the configure option LDFLAGS="-stdlib=libc++" worked for me this time. I guess something has changed somewhere so that libstdc++ doesn't work any more.
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Re: Compiling OTTD on Mac OS Sierra?

Post by Snail »

Looks like the problem was solved using a patch available here: viewtopic.php?f=33&t=75922
The French Narrow Gauge Train Set is now released! Get it here
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Compiling OTTD on Mac OS Sierra?

Post by andythenorth »

Have now switched to Sierra. I compiled both trunk (svn r27772) and the NRT fork on Sierra with no command line flags at all, just ./configure and make run.

I don't have exact repro steps for this as I was building multiple apps at once (not just OpenTTD). This means I installed multiple packages and XCode tools simultaneously. I'm considered blanking this system and starting again to get a clean repro...but nah :)

I'm using Brew not Macports (for reasons). The brew packages I installed specific to OpenTTD were lzo and xz (which provides lzma). I have other packages installed for other apps, including jpeg (libjpeg), but those might not be relevant.

I also installed Xcode (from the app store) and two sets of command line tools (as double-click installers downloaded from the Apple Developer Tools site): Command_Line_Tools_macOS_10.12_for_Xcode_8.2 and Command_Line_Tools_macOS_10.11_for_Xcode_8.2. Those may be a red herring, compiling OpenTTD may not require them, but they're what I have installed.

No patches were applied to OpenTTD.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Semrush [Bot] and 24 guests