2

我在从最新版本 1.53.0构建 boost 库时遇到问题。

在按照大多数教程中描述的在 Linux 系统上为 Android NDK 构建 boost 库的所有步骤进行操作时,发生了一个奇怪的错误:

./boost/functional/hash/extensions.hpp:269: 错误:没有匹配函数调用'hash_value(const wchar_t&)'

仅在为regexthreadwavegraph构建代码文件时遇到此错误,除此之外,所有这些都已成功编译。

这是在user-config.jam文件中进行的用户设置

import os ; 

if [ os.name ] = CYGWIN || [ os.name ] = NT 
{ 
        androidPlatform = windows ; 
} 
else if [ os.name ] = LINUX 
{ 
        androidPlatform = linux-x86_64 ; 
} 
else if [ os.name ] = MACOSX 
{ 
        androidPlatform = darwin-x86 ; 
} 

androidNDKRoot = ../android-ndk-r8e ; 
using gcc : android4.4.3 : $(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-g++ : 
    <compileflags>--sysroot=$(androidNDKRoot)/platforms/android-9/arch-arm 
    <compileflags>-mthumb 
    <compileflags>-Os 
    <compileflags>-fno-strict-aliasing 
    <compileflags>-O2 
    <compileflags>-DNDEBUG 
    <compileflags>-g 
    <compileflags>-lstdc++ 
    <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.4.3/include
    <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include 
    <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include 
    <compileflags>-D__GLIBC__ 
    <compileflags>-DBOOST_NO_INTRINSIC_WCHAR_T 
    <archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ar 
    <ranlib>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ranlib ;

modules.poke : NO_BZIP2 : 1 ;

使用 android-ndk-r8e 版本和命令行生成归档代码文件:

./b2 --with-正则表达式工具集=gcc-android4.4.3 链接=静态运行时-链接=静态目标-os=linux --stagedir=android

./b2 --with-线程工具集=gcc-android4.4.3 link=static runtime-link=static target-os=linux --stagedir=android

./b2 --with - graph工具集=gcc-android4.4.3 link=static runtime-link=static target-os=linux --stagedir=android

无法得到缺少的东西?

编辑:Igor R 请找到线程代码文件生成的错误堆栈:

In file included from ./boost/functional/hash/hash.hpp:529,
                 from ./boost/functional/hash.hpp:6,
                 from ./boost/thread/detail/thread.hpp:37,
                 from ./boost/thread/thread.hpp:22,
                 from libs/thread/src/pthread/thread.cpp:12:
./boost/functional/hash/extensions.hpp: In member function 'size_t boost::hash<T>::operator()(const T&) const [with T = wchar_t]':
./boost/functional/hash/hash.hpp:249:   instantiated from 'void boost::hash_combine(size_t&, const T&) [with T = wchar_t]'
./boost/functional/hash/hash.hpp:263:   instantiated from 'size_t boost::hash_range(It, It) [with It = __gnu_cxx::__normal_iterator<const wchar_t*, std::basic_string<wchar_t> >]'
./boost/functional/hash/hash.hpp:322:   instantiated from 'size_t boost::hash_value(const std::basic_string<Ch, std::char_traits<_CharT>, A>&) [with Ch = wchar_t, A = std::allocator<wchar_t>]'
./boost/functional/hash/hash.hpp:434:   instantiated from here
./boost/functional/hash/extensions.hpp:269: error: no matching function for call to 'hash_value(const wchar_t&)'
./boost/system/error_code.hpp: At global scope:
./boost/system/error_code.hpp:214: warning: 'boost::system::posix_category' defined but not used
./boost/system/error_code.hpp:215: warning: 'boost::system::errno_ecat' defined but not used
./boost/system/error_code.hpp:216: warning: 'boost::system::native_ecat' defined but not used

    "/home/username/android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic --sysroot=/home/username/android/android-ndk-r8e/platforms/android-9/arch-arm -mthumb -Os -fno-strict-aliasing -O2 -DNDEBUG -g -lstdc++ -I/home/username/android/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I/home/username/android/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/include -I/home/username/android/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -D__GLIBC__ -DBOOST_NO_INTRINSIC_WCHAR_T -pthread -Wextra -Wno-long-long -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_THREAD_POSIX -DNDEBUG  -I"." -c -o "bin.v2/libs/thread/build/gcc-android4.4.3/release/link-static/runtime-link-static/threading-multi/pthread/thread.o" "libs/thread/src/pthread/thread.cpp"

...failed gcc.compile.c++ bin.v2/libs/thread/build/gcc-android4.4.3/release/link-static/runtime-link-static/threading-multi/pthread/thread.o...

答:感谢 Igor R,在user-config.jam中添加 -DBOOST_NO_STD_WSTRING 选项后解决了构建问题。

4

0 回答 0