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

Building locale can fail on macOS #41

Open Deadpikle opened 5 years ago

Deadpikle commented 5 years ago

When I run the following command:

./boost.sh -macos --boost-version 1.70.0 --macos-sdk 10.14 --min-macos-version 10.10 --macos-archs "i386 x86_64" --universal --framework-header-root --boost-libs "chrono date_time filesystem locale system timer"

The build fails with the following error:

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: i386/libboost_locale.a (No such file or directory)

Looking earlier in the build log and poking around on disk, I can see that there are no build files for locale. macos-build.log has a helpful error:

Boost.Locale needs either iconv or ICU library to be built

The docs for locale (here) state the following:

Building Boost.Locale
Dependencies

    ICU library 3.6 or above is strongly recommended
    If no ICU library is given, iconv support is required under POSIX platforms.

Platform Notes

    If you use Boost.Locale on Windows with MinGW/GCC < 4.5 you'll be able to use static version only. Mingw/GCC prior to 4.5 have no support of dynamic runtime linking.
    Using Boost.Locale DLL's with MinGW gcc also requires dynamic linking with the runtime libraries libstdc++ and libgcc. Some gcc builds use static linking by default so make sure you use correct link options with your compiler when you build your own programs.
    The AIX's iconv misses important character sets that Boost.Locale requires, so you need to either use GNU iconv or link with ICU library.
    If iconv library is not found on Darwin/Mac OS X builds make sure there is no multiple iconv installations and provide -sICONV_PATH build option to point to correct location of iconv library.

I'm looking into what this would take to fix now, as which iconv on my system returns a valid, usable binary.

http://metashapes.com/blog/building-boost-locale-ios/ has some interesting details, but adding -I$XCODE_ROOT/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${MACOS_SDK_VERSION}.sdk/usr/include/ -L$XCODE_ROOT/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${MACOS_SDK_VERSION}.sdk/usr/lib/ to EXTRA_MACOS_SDK_FLAGS doesn't seem to work.

faithfracture commented 5 years ago

Hmm. I remember running across something like this previously, but it's been a while now so I don't recall exactly what the issue was. I'll take a look at it when I get a chance.

Which versions of Xcode and macOS are you running?

Deadpikle commented 5 years ago

Xcode 10; macOS 10.14.6.

SixFiveSoftware commented 5 years ago

Also came across this today with Xcode 11.2 on Catalina (10.15.1 beta), while testing out if we can upgrade our build servers to the latest macOS. The clue above about ICU is an interesting find, and I wonder if locale depends on it. We use boost as a dependency of Libbitcoin, and their documentation says that it is only used when ICU is conditionally incorporated only for one of their modules, which we do not use so I can bypass, but thought I'd pass that along here in case it helps. By the way, thank you for providing this script! It helped us out of a weird build issue in Catalina that we'd struggled to find a fix to for days.

alexandrkirilov commented 3 years ago

Here what I found about this issue ...

For me Boost.Locale with ICU/ICONV building only for 1.66.0 version. In the versions above 1.67.0 it's got failed. There were updating of Locale module in 1.67.0. I've tried to build it with ICONV and ICU - all the time the same result. BTW - the same troubles for Android too.

For now I've done my own script for 1.66.0. That is building Boost for iOS and MacOS within Locale. I am not Boost-person and I can't to do it by my own.

faithfracture commented 3 years ago

I'm currently in the midst of upgrading several dependency build scripts for my projects (Android included), so I should be able to get to this sometime in the next week. I don't use Locale, but I did have it building at some point. Boost has some dependencies on itself and I'll have to dig through the documentation & figure out what Locale needs again. Things change from time to time. I'm sure there's documentation somewhere - finding it is the hard part.

alexandrkirilov commented 3 years ago

I'm currently in the midst of upgrading several dependency build scripts for my projects (Android included), so I should be able to get to this sometime in the next week. I don't use Locale, but I did have it building at some point. Boost has some dependencies on itself and I'll have to dig through the documentation & figure out what Locale needs again. Things change from time to time. I'm sure there's documentation somewhere - finding it is the hard part.

It would be great ... I am not Boost-person but it critically required for me.

kambala-decapitator commented 3 years ago

please check if change similar to #64 fixes build for macOS.

Btw building locale manually for macOS (without this script) succeeds for me without any special settings, but I tested only x86_64.