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

Issues building on mac os x catalina #121

Closed
ErikAndren opened this issue Feb 1, 2021 · 4 comments
Closed

Issues building on mac os x catalina #121

ErikAndren opened this issue Feb 1, 2021 · 4 comments

Comments

@ErikAndren
Copy link

Hi I have issues building on mac os x catalina.
The xcrun --show-sdk-platform-path command does not work.

I have created two separate patches that fixes the problem:

The first patch fixes the issue and sets the OSX_MIN variable to the default 10.4.
This creates linker warnings:
ld: warning: dylib (/usr/local/lib/libgmp.dylib) was built for newer macOS version (10.15) than being linked (10.4) which I don't know how severe they are.
Additionally tools/cgcomp won't build due to the lack of the libstdc++ to link against with such an old OSX_MIN (10.4).
I fixed this by setting the default OSX_MIN to 10.15 (Catalina).
This has been verified to build against both xcode and command line tools SDK.

patch_1_Fixup_OSX_MIN_variable.patch.txt

The second patch replaces the broken xcrun --show-sdk-platform-path with xcrun --show-sdk-version.
Thus OSX_MIN will be set to the version of mac os x that it is building on. (10.15.7 in this case)
Cavesat is that the xcrun --show-sdk-version does not work when building against the xcode version of the sdk.

patch_2_Replace_show-sdk-platform-path_with_show-sdk-version.patch.txt

I don't know which version that is preferred.

@zeldin
Copy link
Member

zeldin commented Feb 1, 2021

I don't think hardcoding "10.15" is going to work very well on, say, a 10.5 system. So I'd prefer the second variant. What happens when you have "the xcode version of the sdk"? Can the methods be chained (i.e. try one, then the other, and finally fall back to "10.4")?

@ErikAndren
Copy link
Author

Sure. The attached patch chains a test for the xcrun --show-sdk-versions before falling back on 10.4
The consequence is that building against xcode sdk will result in a OSX_MIN 10.4.
This in turn will fail result in a cgcomp build failure, due to the lack of libstdc++ with such a low OSX_MIN number.

I am doubtful the 10.4 path has ever been tested as the previous makefile assignment:
OSX_MIN := $(shell defaults read $(shell xcrun --show-sdk-platform-path)/Info MinimumSDKVersion 2> /dev/null || 10.4)
lacked the echo command before the 10.4.

patch_3_test_for_sdk_version_as_well.patch.txt

@zeldin
Copy link
Member

zeldin commented Feb 2, 2021

Thanks. I tested this on 10.5 (where xcrun doesn't support either --show-sdk-platform-path or --show-sdk-version) and got 10.4, as well as on big sur where I got 11.1. So this looks good to me.

@zeldin
Copy link
Member

zeldin commented Feb 20, 2021

Sorry, looks like I forgot about this for a while. Pushed to master now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants