在Linux上为Android框架构建boost库时出错

时间:2013-05-23 14:15:58

标签: linux boost android-ndk boost-thread boost-regex

latest version 1.53.0构建boost库时遇到问题。

在遵循Android NDK Linux系统上构建boost库的大多数教程中描述的所有步骤的同时,出现了一个奇怪的错误:

  

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

的函数

仅为正则表达式线程 wave 图形构建代码文件时遇到此错误,其他然后这一切都成功编译了。

以下是 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- regex toolset = gcc-android4.4.3 link = static runtime-link = static target-os = linux --stagedir = android

     

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

     

./ b2 --with- graph toolset = 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选项后解决了构建问题。

0 个答案:

没有答案