boost库交叉编译ARM版本
1.下载boost源码:地址:https://sourceforge.net/projects/boost/files/boost/编译:1)解压,cd 到目录–show-libraries可查看所有库,如下Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86/b2The followi
1.下载boost源码:
地址:https://sourceforge.net/projects/boost/files/boost/
- 编译:
1)解压,cd 到目录
–show-libraries可查看所有库,如下
Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86/b2
The following Boost libraries have portions that require a separate build
and installation step. Any library not listed here can be used by including
the headers only.
The Boost libraries requiring separate building and installation are:
link.jam: No such file or directory
- atomic
- chrono
- context
- coroutine
- date_time
- exception
- filesystem
- graph_parallel
- iostreams
- locale
- log
- math
- mpi
- program_options
- random
- regex
- serialization
- signals
- system
- test
- thread
- timer
- wave
使用 --without-libraries=, , , 逗号隔开去掉不想编译的库,–prefix指定编译后的安装路径
这里去掉了pytho和graph,其他的全部编译
./bootstrap.sh --without-libraries=python,graph --prefix=/home/ubuntu/workplace/asio/boost_lib
生成有 b2 和 bjam ,以及一个 project-config.jam 的文件,修改该文件的一行(指定自己的编译器):
# Boost.Build Configuration
# Automatically generated by bootstrap.sh
import option ;
import feature ;
# Compiler configuration. This definition will be used unless
# you already have defined some toolsets in your user-config.jam
# file.
if ! gcc in [ feature.values <toolset> ]
{
using gcc : : /opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin/arm-hisiv500-linux-gcc ;
}
project : default-build <toolset>gcc ;
# List of --with-<library> and --without-<library>
# options. If left empty, all libraries will be built.
# Options specified on the command line completely
# override this variable.
libraries = --without-python --without-graph ;
# These settings are equivivalent to corresponding command-line
# options.
option.set prefix : /home/fens/workplace/asio/boost_lib ;
option.set exec-prefix : /home/fens/workplace/asio/boost_lib ;
option.set libdir : /home/fens/workplace/asio/boost_lib/lib ;
option.set includedir : /home/fens/workplace/asio/boost_lib/include ;
# Stop on first error
option.set keep-going : false ;
注意:这中间是有空格的,如下图标示的地方:
特别是最后一个分号前是有空格的,要不然会出错。
2)执行 ./bjam 即可,这是编译,创建的 lib 文件默认在 stage 文件夹
3)编译完后,执行 ./bjam install 即进行安装到上面 --prefix指定的目录
编译完成的库文件如下(包括静态版本和动态版本):
boost库有80%是只需要引用头文件就可以使用的,比较方便
参考:
boost库交叉编译(Linux生成ARM的库) - findumars - 博客园
https://www.cnblogs.com/findumars/p/7461244.html
更多推荐
所有评论(0)