faithfracture / Apple-Boost-BuildScript

Script for building Boost for Apple platforms (iOS, iOS Simulator, tvOS, tvOS Simulator, OS X)
279 stars 111 forks source link

Fix for macosx-version-min issue. #11

Closed mbendiksen closed 6 years ago

mbendiksen commented 7 years ago

Proposed fix for issue: https://github.com/faithfracture/Apple-Boost-BuildScript/issues/5

I believe the main problem is that the b2 command was not passed an architecture parm (x86). This caused the user-config.jam settings to not be used at all. I debugged into it and none of the settings were being used: compiler path, compiler flags, etc. It was just using the defaults, which happened to work okay.

I made a few other tweaks of passing macosx-version-min into the b2 command, which I don't believe is required since it is also in the user-config.jam file, but it doesn't hurt to explicitly pass it in.

I also changed the toolset to darwin instead of clang. Before it needed to be clang because the darwin settings in user-config.jam weren't being used and using darwin would cause a compile error since the compiler path wasn't set (forcing the toolset to clang would result in a good compiler path). Now that the user-config.jam settings are being used (because architecture is specified for b2), we can be consistent and specify a toolset of darwin for macOS (just like iOs, tvOS, etc.).

I tested that the minimum OS SDK was properly being set via:

otool -l libboost_thread.a | grep -A 3 LC_VERSION_MIN_MACOSX

faithfracture commented 7 years ago

Are you passing any parameters to the script when you run it? When I try it spits out errors about all the .a files being fat libraries, then building the framework fails complaining that libboost.a is empty and the architecture can't be determined.

mbendiksen commented 7 years ago

I was passing in parameters, but that wasn't the problem. My local version has an edit of changing MACOS_ARCHS to be "i386 x86_64" because I need 32 and 64 bit versions built. The problem you ran into was that the arguments passed to b2 were causing it to build the 32 bit version as well as the 64 bit version, yet the script was unaware of the 32 bit version so the code was barfing since it wasn't expecting the built .a files to be fat (around line 700 the conditional MACOS_ARCH_COUNT was 1, so it was just copying over the file and not using lipo -thin on it). The fix is to specify to b2 that we want the 64 bit version (arg: address-model=64), then it doesn't built the fat and everything works as it did previously (the cp is okay and no lipo -thin is needed).

faithfracture commented 7 years ago

Sorry, haven't had the time to get around to this yet. Hoping to get to it this week while I'm waiting on a bunch of binaries to rebuild.

faithfracture commented 7 years ago

I haven't forgotten about this, I've just been too busy to take the time to test & pul this in. It's on my list :)

faithfracture commented 6 years ago

Fixed by PR #22