-
Notifications
You must be signed in to change notification settings - Fork 264
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
Vcpkg build for Android failes due to the missing header: Monetary.h #1182
Comments
old versions of the NDK did include musl's <monetary.h> and corresponding implementation. as we cleaned up the NDK, we dropped this rather than replace it with code from bionic (which was our usual solution). we did briefly look at implementing our own <monetary.h>, but writing some tests based on the POSIX spec and testing against a few existing implementations found that there was a surprising amount of disagreement even for the C locale. so we've just ignored <monetary.h>. any implementation we'd provide wouldn't actually be very useful because it wouldn't actually do any i18n. anyone who needs to do it right should use Java for now, and icu4c (when it's available: #548). anyone who's happy with a not-actually-useful <monetary.h> can always bundle a perfunctory implementation, but then at least they know what they're getting into, rather than us providing something that seems useful but isn't really. is "having even a bogus <monetary.h> would let me build boost's locale library" sufficient reason to add it anyway? even if we ignore the argument that "it's probably better to not have obscure API at all rather than have a bad implementation of obscure API", which is a philosophy one might reasonably disagree with, i'm still not sure... boost only uses <monetary.h> for the "posix" backend, and i'm unconvinced that's actually a useful backend. looking at their comparison chart (https://www.boost.org/doc/libs/1_72_0/libs/locale/doc/html/using_localization_backends.html) i think the "std" backend is strictly better than the posix one (though still not very good), and that if you actually care you're still in the "use Java or use icu" boat. but you're actually here because you want to build vckpg and don't actually care about boost or whether its posix i18n backend is any good. in which case i'd suggest switching your build to the "std" backend (i'd start by searching for the source of the (one thing i don't remember doing, and probably should before we call the absence of <monetary.h> as "working as intended" is to investigate how well -- if at all -- the POSIX and icu4c APIs match. if we can implement the POSIX one in terms of icu4c, that's probably worth doing in bionic. i'm not optimistic though, given my experience with <iconv.h>.) |
Not supporting unhelpful APIs that give a false sense of security SGTM. I'm guessing most people looking to use that don't know that it's really not what they want. One thing we could do is add the header that contains only |
yeah, and iirc boost's existing configure equivalent does default to using the "std" implementation on Android rather than the "posix" one. i suspect vcpkg has explicitly asked for the posix implementation. |
Thanks for the analysis. Indeed, in the ports/boost-locale/cmake-fragment.cmake I changed the config like this:
And it worked like a magic :) |
excellent idea. https://android-review.googlesource.com/c/platform/bionic/+/1227903. |
We've had discussions about <monetary.h> (which wasn't previously mentioned here at all, an oversight) and robust mutexes on github that are worth linking to. Bug: android/ndk#1181 Bug: android/ndk#1182 Test: N/A Change-Id: If0d2c28757a3cbfffc358e8847dc4de1a67d9001
@enh-google anything else you want to do here? I'm still leaning toward not adding this header to bionic just for the |
no, i think adding a fake monetary.h would cause more trouble than it solves, and i don't think we can realistically implement it in terms of icu4c. |
I tried to build "boost-locale" for Android x86 ABI and failed due to the missing header file:
[1/2] cd /opt/vcpkg/buildtrees/boost-locale/src/ost-1.70.0-64535d0e00/build && /opt/vcpkg/installed/x64-linux/tools/boost-build/b2 --user-config=/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/user-config.jam --stagedir=/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/stage --build-dir=/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg boost.locale.iconv=on boost.locale.posix=on /boost/locale//boost_locale boost.locale.icu=off -sICONV_PATH=LIBICONV_LIBRARY-NOTFOUND runtime-link=static link=static address-model=32 target-os=linux toolset=gcc -sZLIB_BINARY=z -sZLIB_LIBPATH="/opt/vcpkg/installed/x86-android/debug/lib/libz.a" -sBZIP2_BINARY=bz2d -sBZIP2_LIBPATH="BZIP2_LIBPATH-NOTFOUND" variant=debug --layout=system --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -sZLIB_INCLUDE="/opt/vcpkg/installed/x86-android/include" -sBZIP2_INCLUDE="BZIP2_INCLUDE-NOTFOUND" -sICU_PATH="ICU_PATH-NOTFOUND" -j1 -sBOOST_ROOT=/opt/vcpkg/installed/x64-linux/tools/boost-build -sBOOST_BUILD_PATH=/opt/vcpkg/installed/x64-linux/tools/boost-build --debug-configuration --ignore-site-config --hash -q architecture=x86 threading=multi threadapi=pthread debug-symbols=on stage
FAILED: CMakeFiles/boost
cd /opt/vcpkg/buildtrees/boost-locale/src/ost-1.70.0-64535d0e00/build && /opt/vcpkg/installed/x64-linux/tools/boost-build/b2 --user-config=/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/user-config.jam --stagedir=/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/stage --build-dir=/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg boost.locale.iconv=on boost.locale.posix=on /boost/locale//boost_locale boost.locale.icu=off -sICONV_PATH=LIBICONV_LIBRARY-NOTFOUND runtime-link=static link=static address-model=32 target-os=linux toolset=gcc -sZLIB_BINARY=z -sZLIB_LIBPATH="/opt/vcpkg/installed/x86-android/debug/lib/libz.a" -sBZIP2_BINARY=bz2d -sBZIP2_LIBPATH="BZIP2_LIBPATH-NOTFOUND" variant=debug --layout=system --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -sZLIB_INCLUDE="/opt/vcpkg/installed/x86-android/include" -sBZIP2_INCLUDE="BZIP2_INCLUDE-NOTFOUND" -sICU_PATH="ICU_PATH-NOTFOUND" -j1 -sBOOST_ROOT=/opt/vcpkg/installed/x64-linux/tools/boost-build -sBOOST_BUILD_PATH=/opt/vcpkg/installed/x64-linux/tools/boost-build --debug-configuration --ignore-site-config --hash -q architecture=x86 threading=multi threadapi=pthread debug-symbols=on stage
notice: found boost-build.jam at /opt/vcpkg/installed/x64-linux/tools/boost-build/boost-build.jam
notice: loading Boost.Build from /opt/vcpkg/installed/x64-linux/tools/boost-build/src/kernel
notice: Site configuration files will be ignored due to the
notice: --ignore-site-config command-line option.
notice: Loading explicitly specified user configuration file:
/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/user-config.jam
notice: Searching '/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from '/opt/vcpkg/buildtrees/boost-locale/x86-android-dbg'.
notice: will use '/home/mmeram/experimental/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++' for gcc, condition gcc-5.4.1
notice: using gcc libraries :: gcc-5.4.1 :: /home/mmeram/experimental/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin /home/mmeram/experimental/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/lib /home/mmeram/experimental/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/lib32 /home/mmeram/experimental/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/lib64
notice: using gcc archiver :: gcc-5.4.1 :: /home/mmeram/experimental/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ar
notice: using gcc ranlib :: gcc-5.4.1 :: /home/mmeram/experimental/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ranlib
warning: toolset gcc initialization: can not find tool windres
warning: initialized from /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/user-config.jam:22
notice: using rc compiler :: gcc-5.4.1 :: as
Performing configuration checks
...patience...
...found 1176 targets...
...updating 35 targets...
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/encoding/codepage.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/shared/date_time.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/shared/format.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/shared/formatting.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/shared/generator.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/shared/ids.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/shared/localization_backend.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/shared/message.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/shared/mo_lambda.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/util/codecvt_converter.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/util/default_locale.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/util/info.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/util/locale_data.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/posix/codecvt.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/posix/collate.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/posix/converter.o
gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/posix/numeric.o
../src/posix/numeric.cpp:26:10: fatal error: 'monetary.h' file not found
#include <monetary.h>
^~~~~~~~~~~~
1 error generated.
...failed gcc.compile.c++ /opt/vcpkg/buildtrees/boost-locale/x86-android-dbg/boost/build/54eb8f1e1dc024f48fac6296d7a14461/posix/numeric.o...
...failed updating 1 target...
...updated 21 targets...
ninja: build stopped: subcommand failed.
I manually copied the monetary.h from the AOSP (sources/ to the folder:
<ndk_root>/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/local/include/
and it worked. Why is this header missing in the NDK? I heard there were porting issues for Android 9.0 but it seems to be fixed...
The text was updated successfully, but these errors were encountered: