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 building boost.locale for iOS and tvOS #64

Open kambala-decapitator opened 3 years ago

kambala-decapitator commented 3 years ago

I took the main idea from https://metashapes.com/blog/building-boost-locale-ios/

The build system causes the compiler statement to include “-arch arm” which will make the compiler try to build for armv4t which the iOS libraries do not support. I found no elegant way to solve this and had to edit the darwin.jam file and replace “-arch arm” with “-arch armv7” to get rid of it.

Also tried applying https://github.com/boostorg/build/pull/560, but it fixes only case when you build exclusively for arm64.

The idea to pass all flags to cxx and linker was taken from https://stackoverflow.com/questions/64553398/compile-boost-as-universal-library-intel-and-apple-silicon-architectures

Successfully tested using Xcode 11.7, 12.4 and 12.5.1 with the following command:

./boost.sh -tvos -ios --min-ios-version 10.0 --boost-libs 'locale' --boost-version 1.76.0 --no-framework

End of output:

Splitting all existing fat binaries...
Decomposing each architecture's .a files
Decomposing libboost_locale.a
Unpacking /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphoneos/armv7/obj/locale
Unpacking /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphoneos/arm64/obj/locale
Unpacking /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphonesimulator/i386/obj/locale
Unpacking /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphonesimulator/x86_64/obj/locale
Unpacking /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphonesimulator/arm64/obj/locale
Unpacking /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/tvos/release/build/appletvos/arm64/obj/locale
Unpacking /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/tvos/release/build/appletvsimulator/x86_64/obj/locale
Unpacking /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/tvos/release/build/appletvsimulator/arm64/obj/locale
Linking each architecture into an uberlib ( libboost_locale.a => libboost.a )
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphoneos/armv7/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphoneos/arm64/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphoneos/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphonesimulator/i386/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphonesimulator/x86_64/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphonesimulator/arm64/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/ios/release/build/iphonesimulator/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/tvos/release/build/appletvos/arm64/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/tvos/release/build/appletvos/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/tvos/release/build/appletvsimulator/x86_64/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/tvos/release/build/appletvsimulator/arm64/libboost.a: No such file or directory
rm: /Users/kambala/dev/other/Apple-Boost-BuildScript/build/boost/1.76.0/tvos/release/build/appletvsimulator/libboost.a: No such file or directory
Archiving locale
...ios-armv7
...ios-arm64
...ios-sim-i386
...ios-sim-x86_64
...ios-sim-arm64
...tvOS-arm64
...tvOS-sim-x86_64
...tvOS-sim-arm64
Completed successfully

P.S. I feel that utilizing <root> option might be the right way to go... (https://metashapes.com/blog/building-boost-locale-ios/ also uses it)

kambala-decapitator commented 2 years ago

resolved conflicts