我正在尝试为Android构建Boost 1.54.我能够为date_time,文件系统,正则表达式,program_options,信号,系统和增强的线程库执行此操作.但是,如果我在其中添加了boost日志库,则构建失败,并说“更新8个目标失败”.
我在user-config.jam中添加了以下几行
import os ;
androidNDKRoot = C:/android-ndk-r8e ; # put the relevant path
using gcc : android :
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-g++ :
--sysroot=$(androidNDKRoot)/platforms/android-8/arch-arm
-mthumb
-Os
-fno-strict-aliasing
-O2
-DNDEBUG
-g
-lstdc++
-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/include
-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi/include
-D__GLIBC__
-D_GLIBCXX__PTHREADS
-D__arm__
-D_REENTRANT
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ar
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ranlib
;
我还更改了libs / filesystem / src / operations.cpp文件以编译线程库.您可以找到必要的更改here.
我的构建命令如下
set CXXFLAGS="-I%ANDROID_NDK%/platforms/android-8/arch-arm/usr/include -I%ANDROID_NDK%/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I%ANDROID_NDK%/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include "
set TOOLSET=gcc-android
.\b2 --toolset=%TOOLSET% --user-config=./user-config-android.jam cxxflags=%CXXFLAGS% threadapi=pthread --prefix=..\boost_android_arm --builddir=./ target-os=linux --with-date_time --with-filesystem --with-regex --with-log define=BOOST_FILESYSTEM_VERSION=3 --with-program_options --with-signals --with-system --with-thread link=static runtime-link=shared threading=multi install
如前所述,如果我在build命令中不键入–with-log的话,它确实可以编译.
这是输出的几行,
gcc.compile.c++ bin.v2\libs\log\build\gcc-android\release\build-no\link-static\log-api-unix\target-os-linux\threadapi-pthread\threading-multi\attribute_name.o
In file included from libs\log\src\attribute_name.cpp:32:0:
./boost/log/detail/light_rw_mutex.hpp:131:5: error: 'pthread_rwlock_t' does not name a type
./boost/log/detail/light_rw_mutex.hpp: In constructor 'boost::log::v2s_mt_posix::aux::light_rw_mutex::light_rw_mutex()':
./boost/log/detail/light_rw_mutex.hpp:136:30: error: 'm_Mutex' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp:136:43: error: 'pthread_rwlock_init' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp: In destructor 'boost::log::v2s_mt_posix::aux::light_rw_mutex::~light_rw_mutex()':
./boost/log/detail/light_rw_mutex.hpp:140:33: error: 'm_Mutex' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp:140:40: error: 'pthread_rwlock_destroy' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp: In member function 'void boost::log::v2s_mt_posix::aux::light_rw_mutex::lock_shared()':
./boost/log/detail/light_rw_mutex.hpp:144:32: error: 'm_Mutex' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp:144:39: error: 'pthread_rwlock_rdlock' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp: In member function 'void boost::log::v2s_mt_posix::aux::light_rw_mutex::unlock_shared()':
./boost/log/detail/light_rw_mutex.hpp:148:32: error: 'm_Mutex' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp:148:39: error: 'pthread_rwlock_unlock' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp: In member function 'void boost::log::v2s_mt_posix::aux::light_rw_mutex::lock()':
./boost/log/detail/light_rw_mutex.hpp:152:32: error: 'm_Mutex' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp:152:39: error: 'pthread_rwlock_wrlock' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp: In member function 'void boost::log::v2s_mt_posix::aux::light_rw_mutex::unlock()':
./boost/log/detail/light_rw_mutex.hpp:156:32: error: 'm_Mutex' was not declared in this scope
./boost/log/detail/light_rw_mutex.hpp:156:39: error: 'pthread_rwlock_unlock' was not declared in this scope
它包括许多这样的行,但这是它给的第一个错误.
有人可以看到我做错了什么或应该更改什么吗?
谢谢
解决方法:
只需将平台更改为android-9即可解决此问题.
之后,它给出了另一个错误,该错误已在here中修复
标签:boost-log,boost,c-4,android
来源: https://codeday.me/bug/20191122/2062665.html