ps3dev / PSL1GHT

A lightweight PS3 SDK
www.psl1ght.com
MIT License
207 stars 63 forks source link

Issues building on mac os x catalina #121

Closed ErikAndren closed 3 years ago

ErikAndren commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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