I don't know how to build Boost with C++0x compilers. Which option must be given to bjam? Should the user.config file be modified?Can someone help me?
我不知道如何用c++ 0x编译器来构建Boost。bjam应该选择哪个选项?应用户。配置文件被修改?有人能帮助我吗?
Best, Vicente
最好,韦森特
5 个解决方案
#1
40
I have found the answer. I was waiting for a features something like 'std' and call it as follows:
我找到了答案。我在等待一个类似“std”的功能,并将其命名为:
bjam std=0x
but currently we need to use the low level variables cxxflags and add the specific compiler flags. For example for gcc we can do
但是目前我们需要使用低级变量cxxflags并添加特定的编译器标志。例如,对于gcc,我们可以这样做
bjam toolset=gcc cxxflags=-std=gnu++0x
Other compilers will need a different setting.
其他编译器需要不同的设置。
Waiting for a new Boost.Build feature, you can also define your own toolset as follows: Add the user.config or site.config file
等待新的刺激。构建特性,您还可以定义自己的工具集如下:添加用户。配置或站点。配置文件
using gcc
: std0x
: "/usr/bin/g++" # your path to the C++0x compiler
: <cxxflags>-std=gnu++0x
;
And now call as
现在的电话
bjam toolset=gcc-std0x
#2
9
Use something like this:
使用这样的:
./bootstrap.sh --with-toolset=gcc --prefix=/usr/local
./b2 -j12 toolset=gcc variant=release link=shared threading=multi address-model=64 cxxflags=-std=c++11 install
The -j12 is for parallel (12 threads) build use -std=c++11
for better compatibility and -std=gnu++11
for the gnu extensions (only for gcc)
j12用于并行(12个线程)构建,使用-std=c+ 11用于更好的兼容性,而-std=gnu+ 11用于gnu扩展(仅用于gcc)
if boost::mpi is not build (see the output of above command) -> edit the user-config.jam
如果boost::mpi没有构建(请参阅上面命令的输出)->编辑用户配置。jam。
if you want to build only certain components: add:
如果您只想构建某些组件:添加:
--with-libraries=system,thread,serialization
for example
例如
Here is an adapted script from my framework from travis (adjust ROOT_PATH
):
这是一个改编自我的travis框架的脚本(调整ROOT_PATH):
BOOST_DOWNLOAD_URL="http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2/download"
BOOST_BUILD=${ROOT_PATH}/boostBuild
mkdir -p ${BOOST_BUILD}
wget --no-verbose --output-document="${ROOT_PATH}/boost.tar.bz2" "$BOOST_DOWNLOAD_URL"
cd ${BOOST_BUILD}
tar jxf "${ROOT_PATH}/boost.tar.bz2" --strip-components=1 -C "${BOOST_BUILD}"
./bootstrap.sh --with-toolset=gcc --with-libraries=system,thread,serialization,filesystem,chrono,atomic,date_time
sudo ./b2 -j12 toolset=gcc threading=multi link=shared release install
which installs into /usr/local
.
/ usr / local下安装成
#3
8
To compile using clang, use the cxxflags
and linkflags
:
要使用clang进行编译,请使用cxxflags和linkflags:
./b2 \
...
cxxflags="-std=c++0x -stdlib=libc++" \
linkflags="-stdlib=libc++" \
...
Passing a -v
to cxxflags
is also helpful when debugging.
将-v传递给cxxflags也有助于调试。
#4
3
I came across an article for compiling Boost using clang: http://blog.llvm.org/2010/05/clang-builds-boost.html. It might be possible to adapt the changes proposed there for compiling Boost using Boost.Jam to your favorite C++0x compiler.
我看到了一篇用clang来编译Boost的文章:http://blog.llvm.org/2010/05/clang-build - Boost .html。有可能修改那里提出的使用Boost编译Boost的更改。阻塞到您最喜欢的c++ 0x编译器。
#5
3
Also, you can change compilation flags for one file like this:
此外,您还可以为这样的一个文件更改编译标志:
exe test : test.cpp : <cxxflags>-std=gnu++0x ;
exe测试:测试。cpp:< cxxflags >化gnu c++ 0 x;
#1
40
I have found the answer. I was waiting for a features something like 'std' and call it as follows:
我找到了答案。我在等待一个类似“std”的功能,并将其命名为:
bjam std=0x
but currently we need to use the low level variables cxxflags and add the specific compiler flags. For example for gcc we can do
但是目前我们需要使用低级变量cxxflags并添加特定的编译器标志。例如,对于gcc,我们可以这样做
bjam toolset=gcc cxxflags=-std=gnu++0x
Other compilers will need a different setting.
其他编译器需要不同的设置。
Waiting for a new Boost.Build feature, you can also define your own toolset as follows: Add the user.config or site.config file
等待新的刺激。构建特性,您还可以定义自己的工具集如下:添加用户。配置或站点。配置文件
using gcc
: std0x
: "/usr/bin/g++" # your path to the C++0x compiler
: <cxxflags>-std=gnu++0x
;
And now call as
现在的电话
bjam toolset=gcc-std0x
#2
9
Use something like this:
使用这样的:
./bootstrap.sh --with-toolset=gcc --prefix=/usr/local
./b2 -j12 toolset=gcc variant=release link=shared threading=multi address-model=64 cxxflags=-std=c++11 install
The -j12 is for parallel (12 threads) build use -std=c++11
for better compatibility and -std=gnu++11
for the gnu extensions (only for gcc)
j12用于并行(12个线程)构建,使用-std=c+ 11用于更好的兼容性,而-std=gnu+ 11用于gnu扩展(仅用于gcc)
if boost::mpi is not build (see the output of above command) -> edit the user-config.jam
如果boost::mpi没有构建(请参阅上面命令的输出)->编辑用户配置。jam。
if you want to build only certain components: add:
如果您只想构建某些组件:添加:
--with-libraries=system,thread,serialization
for example
例如
Here is an adapted script from my framework from travis (adjust ROOT_PATH
):
这是一个改编自我的travis框架的脚本(调整ROOT_PATH):
BOOST_DOWNLOAD_URL="http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2/download"
BOOST_BUILD=${ROOT_PATH}/boostBuild
mkdir -p ${BOOST_BUILD}
wget --no-verbose --output-document="${ROOT_PATH}/boost.tar.bz2" "$BOOST_DOWNLOAD_URL"
cd ${BOOST_BUILD}
tar jxf "${ROOT_PATH}/boost.tar.bz2" --strip-components=1 -C "${BOOST_BUILD}"
./bootstrap.sh --with-toolset=gcc --with-libraries=system,thread,serialization,filesystem,chrono,atomic,date_time
sudo ./b2 -j12 toolset=gcc threading=multi link=shared release install
which installs into /usr/local
.
/ usr / local下安装成
#3
8
To compile using clang, use the cxxflags
and linkflags
:
要使用clang进行编译,请使用cxxflags和linkflags:
./b2 \
...
cxxflags="-std=c++0x -stdlib=libc++" \
linkflags="-stdlib=libc++" \
...
Passing a -v
to cxxflags
is also helpful when debugging.
将-v传递给cxxflags也有助于调试。
#4
3
I came across an article for compiling Boost using clang: http://blog.llvm.org/2010/05/clang-builds-boost.html. It might be possible to adapt the changes proposed there for compiling Boost using Boost.Jam to your favorite C++0x compiler.
我看到了一篇用clang来编译Boost的文章:http://blog.llvm.org/2010/05/clang-build - Boost .html。有可能修改那里提出的使用Boost编译Boost的更改。阻塞到您最喜欢的c++ 0x编译器。
#5
3
Also, you can change compilation flags for one file like this:
此外,您还可以为这样的一个文件更改编译标志:
exe test : test.cpp : <cxxflags>-std=gnu++0x ;
exe测试:测试。cpp:< cxxflags >化gnu c++ 0 x;