从Linux到Windows交叉编译boost 1.57的问题
Problems cross-compiling boost 1.57 from Linux to Windows
我正在尝试将boost 1.57从64位Debian测试交叉编译到32位Windows。
Boost有交叉编译页面,这并没有多大帮助。例如,我不得不四处搜索,发现我需要用-sNO_BZIP2=1
显式禁用bzip2,什么都不禁用zlib——它会自动禁用它(以前你必须指定-sNO_ZLIB=1
,但现在它坏了)。
所以,经过一些尝试和错误,我得出了:
$ i686-w64-mingw32-g++ -v
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/4.9-win32/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++ --enable-lto --with-plugin-ld --enable-threads=win32 --program-suffix=-win32 --program-prefix=i686-w64-mingw32- --target=i686-w64-mingw32 --with-as=/usr/bin/i686-w64-mingw32-as --with-ld=/usr/bin/i686-w64-mingw32-ld
Thread model: win32
gcc version 4.9.1 (GCC)
$ wget http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.7z
$ ls
boost_1_57_0.7z
$ 7z x boost_1_57_0.7z
$ cd boost_1_57_0
$ echo "using gcc : : i686-w64-mingw32-g++ ;" > user-config.jam
$ ./bootstrap.sh
$ ./b2 -j10 --user-config=user-config.jam toolset=gcc-mingw address-model=32 binary-format=pe target-os=windows release --prefix=/usr/i686-w64-mingw32/local --without-python --without-wave -sNO_BZIP2=1
-j10
用于10个并发作业,因为我有8个逻辑cpu内核。
用于32位构建的address-model=32
binary-format=pe
被建议作为libs/context/src/asm/make_i386_sysv_elf_gas.S
中构建失败的解决方法。
以上失败:
gcc.compile.c++ bin.v2/libs/context/build/gcc-mingw-4.9.1/release/address-model-32/binary-format-pe/link-static/target-os-windows/threading-multi/unsupported.o
libs/context/src/unsupported.cpp:7:2: error: #error "platform not supported"
#error "platform not supported"
^
"i686-w64-mingw32-g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthreads -m32 -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE -DNDEBUG -I"." -c -o "bin.v2/libs/context/build/gcc-mingw-4.9.1/release/address-model-32/binary-format-pe/link-static/target-os-windows/threading-multi/unsupported.o" "libs/context/src/unsupported.cpp"
...failed gcc.compile.c++ bin.v2/libs/context/build/gcc-mingw-4.9.1/release/address-model-32/binary-format-pe/link-static/target-os-windows/threading-multi/unsupported.o...
...skipped <pbin.v2/libs/context/build/gcc-mingw-4.9.1/release/address-model-32/binary-format-pe/link-static/target-os-windows/threading-multi>libboost_context.a(clean) for lack of <pbin.v2/libs/context/build/gcc-mingw-4.9.1/release/address-model-32/binary-format-pe/link-static/target-os-windows/threading-multi>unsupported.o...
...skipped <pbin.v2/libs/context/build/gcc-mingw-4.9.1/release/address-model-32/binary-format-pe/link-static/target-os-windows/threading-multi>libboost_context.a for lack of <pbin.v2/libs/context/build/gcc-mingw-4.9.1/release/address-model-32/binary-format-pe/link-static/target-os-windows/threading-multi>unsupported.o...
...skipped <pstage/lib>libboost_context.a for lack of <pbin.v2/libs/context/build/gcc-mingw-4.9.1/release/address-model-32/binary-format-pe/link-static/target-os-windows/threading-multi>libboost_context.a...
...failed updating 1 target...
...skipped 3 targets...
在这一点上,我已经陷入困境,我不知道如何解决这个问题,谷歌似乎也没有帮助。
通过简单地禁用失败的库,我碰巧不需要
./b2 -j10 --user-config=user-config.jam toolset=gcc-mingw address-model=32 binary-format=pe target-os=windows release --prefix=/usr/i686-w64-mingw32/local --without-python --without-wave --without-context --without-coroutine --without-mpi --without-test --without-graph --without-graph_parallel -sNO_BZIP2=1
事实上,一些被禁用的图书馆可能不会失败,我只是查看了所有图书馆的列表,并禁用了那些与我所需要的完全无关的图书馆。
当然,这并不能解决将所有的boost库交叉编译到Windows的问题,如果知道如何正确地编译,那就太好了,但目前我对此感到满意。
相关文章:
- 基于boost的程序的静态链接——zlib问题
- C++boost序列化多态性问题
- 在 boost::variant 中类 holden 的复制构造函数存在问题
- 我在使用 boost::serialization 时遇到了一个问题,我的代码在 Linux 中运行良好,但在 Wind
- 将 Boost 与 CMAKE 联系起来时出现问题
- boost Logger出现问题
- 在 Windows 10 上安装 Boost 时遇到问题
- 链接问题 boost::p ython::numpy.
- 递归 Boost.Spirit 解析的问题
- 在C++中读取文件系统时出现问题(Boost 未编译)
- 使用 boost::序列化将派生类指针序列化为向量时出现问题
- 获取“boost::文件系统::p ath”字符指针时出现问题
- Xcode(版本9.2(9C40B)):试图包括Boost时C 语义和链接器问题
- 与 boost.python 和 python3 链接时出现问题
- PCL 构建存在 boost::throw_exception 问题
- 链接boost.python示例的问题
- BOOST-ASIO ASYNC_RECEIVE_FROM功能超载问题( 动态指针)
- 在Windows 10中的Boost :: FileSystem :: remove_all遇到问题
- Boost-beast websocket握手问题
- C++STL版本控制问题+Boost