Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build failure on Mac OSX 10.9 and 10.10 #6295

Closed
DorpsGek opened this issue May 4, 2015 · 8 comments
Closed

build failure on Mac OSX 10.9 and 10.10 #6295

DorpsGek opened this issue May 4, 2015 · 8 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented May 4, 2015

dunn opened the ticket and wrote:

Initially reported on SO (http://stackoverflow.com/questions/21154984/linker-returning-undefined-symbols-for-symbols-that-are-in-a-library-being-lin), there's a section in config.lib that's preventing OpenTTD from building on recent versions of OSX. It's adding flags that cause linker errors; here's what the build logs look like: https://gist.github.com/dunn/aa8207603cd1eebd1479

Attached is a patch that's been used by MacPorts as well as Homebrew for a while without problems.

Attachments

Reported version: 1.5.0
Operating system: Mac OS X


This issue was imported from FlySpray: https://bugs.openttd.org/task/6295
@DorpsGek
Copy link
Member Author

DorpsGek commented May 4, 2015

Alberth wrote:

Assuming that code was added for a reason, your patch will break building at whatever system uses those settings.
That is not acceptable.

Rather than causing havoc at other systems by deleting crucial settings, your patch should add checks that prevents adding bad settings for systems like yours.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6295#comment13896

@DorpsGek
Copy link
Member Author

DorpsGek commented May 4, 2015

frosch wrote:

The part of config.lib looks like it is meant for GCC. The link to github shows a log with clang.
Likely config.lib should check for GCC here.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6295#comment13897

@DorpsGek
Copy link
Member Author

DorpsGek commented May 6, 2015

dunn wrote:

The build fails with GCC as well as with Clang.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6295#comment13900

@DorpsGek
Copy link
Member Author

andythenorth wrote:

This may not help, but posting for the record. I have been able to build trunk OpenTTD on multiple versions of Mavericks and Yosemite, using default clang as provided by Apple, as per https://wiki.openttd.org/Compiling_on_Mac_OS_X# Configuring_on_Mavericks_.28and_Yosemite.29

For Yosemite, I didn't need to update any ports or other packages (although my system does have a macports trees that was installed under Mavericks, which may still be supplying some packages).


This comment was imported from FlySpray: https://bugs.openttd.org/task/6295#comment14058

@DorpsGek
Copy link
Member Author

DorpsGek commented Nov 8, 2016

neverpanic wrote:

Just for the record, the issue here is that clang++ will use libc++ as standard library by default if you do not compile with a deployment target (the -mmacosx-version-min flag in config.lib) older than when Apple switched the default to libc++. You get the linker error about missing std::string symbols when you try to link a piece of code compiled against libc++ with libstdc++ or vice versa. The linker error occurs, because symbol mangling for std::string differs (on purpose) between these standard library implementations. If you didn't get the linker error, you'd instead see crashes at runtime.

The patch posted here was originally written by me (macports/macports-ports@196a1cf) and later tagged with "Upstream-Status: Inappropriate [configuration]". MacPorts has a policy of always building against the host system, not against one of the OS X SDKs like the binaries built by OpenTTD are. It is probably not appropriate to be merged here.

I did not investigate what the issue with the 10.5 minimum version is, since the code was inappropriate for MacPorts' guidelines anyway. My best guess would be that the compiler uses libstdc++ (due to -mmacosx-version-min 10.5) but the linker uses libc++ (because LDFLAGS doesn't contain a deployment target). Note that forcing a deployment target that makes the compiler use libstdc++ also requires you to build any C++ dependencies with the same setting (which is also why I removed it for MacPorts).

Feel free to reach out to cal@macports.org if you need help figuring out this C++ standard library mess on OS X.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6295#comment14292

@DorpsGek
Copy link
Member Author

andythenorth wrote:

Clemens thanks this isn't being ignored :) I don't have an El Capitan or Sierra system to hand right now to test compiles (I'm also not the right person to figure out compile issues - way out of my depth).


This comment was imported from FlySpray: https://bugs.openttd.org/task/6295#comment14345

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 8, 2017

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 8, 2017

michi_cc closed the ticket.

Reason for closing: Implemented

In r27727.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6295

@DorpsGek DorpsGek closed this as completed Jan 8, 2017
@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Build system labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant