我想从不同平台上的源代码构建Boost。我已经能够在linux上(在docker镜像上)做到这一点。我也可以在自己的计算机(Mac OS X 10.13 Xcode 9.4.1)上执行此操作,但是当我在circleci图像上尝试相同的操作(使用Xcode 9.4.1)时,它失败并显示以下错误:
这可能不是很相关,但是我使用cGet来解决我的依赖项,包括Boost。在这种情况下,cGet只是下载Boost并运行b2命令。这是输出:
我明确地尝试使用GNU编译器和链接器,并且如您在输出中所见,工具集已正确传递给 b2 命令,但出现了--soname
名称问题。我知道可以使用install_name
来解决它,但这是b2必须解决的事情,对吧?
Extracting archive /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/boost_1_68_0.tar.bz2 ...
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/gcc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
using clang-linux : cget : "/Library/Developer/CommandLineTools/usr/bin/c++" :
<rc>
<archiver>/Library/Developer/CommandLineTools/usr/bin/ar
<ranlib>/Library/Developer/CommandLineTools/usr/bin/ranlib
<include>/Users/distiller/project/cget/include
<library-path>/Users/distiller/project/cget/lib
;
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build
Scanning dependencies of target bootstrap
-n Bootstrapping the build engine with toolset darwin...
engine/bin.macosxx86_64/b2
Bootstrapping is done. To build and install, run:
./b2 install --prefix=<DIR>
[ 0%] Built target bootstrap
Scanning dependencies of target boost
[100%] /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/boost_1_68_0/tools/build/b2 -q -j 4 --ignore-site-config --user-config=/Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/user-config.jam --build-dir=/Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build address-model=64 link=shared target-os=darwin threadapi=pthread threading=multi toolset=clang-linux-cget variant=release cxxflags=-std=c++11 -std=c++11 --layout=system --disable-icu --with-filesystem --prefix=/Users/distiller/project/cget/cget/pkg/boost/install --exec-prefix=/Users/distiller/project/cget/cget/pkg/boost/install/bin --libdir=/Users/distiller/project/cget/cget/pkg/boost/install/lib --includedir=/Users/distiller/project/cget/cget/pkg/boost/install/include
Performing configuration checks
- default address-model : 64-bit
- default architecture : x86
Building the Boost C++ Libraries.
- symlinks supported : yes
Component configuration:
.
.
.
- filesystem : building
.
.
.
...patience...
...found 701 targets...
...updating 28 targets...
link.mklink boost/chrono/stopwatches.hpp
mklink-or-dir boost/chrono/stopwatches
clang-linux.compile.c++.without-pth /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/filesystem/build/clang-linux-cget/release/threading-multi/codecvt_error_category.o
clang-linux.compile.c++.without-pth /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/system/build/clang-linux-cget/release/threading-multi/error_code.o
clang-linux.link.dll /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/system/build/clang-linux-cget/release/threading-multi/libboost_system.dylib
ld: unknown option: -soname
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"/Library/Developer/CommandLineTools/usr/bin/c++" -o "/Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/system/build/clang-linux-cget/release/threading-multi/libboost_system.dylib" -Wl,-soname -Wl,libboost_system.dylib -shared "/Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/system/build/clang-linux-cget/release/threading-multi/error_code.o" -fPIC -m64
...failed clang-linux.link.dll /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/system/build/clang-linux-cget/release/threading-multi/libboost_system.dylib...
...skipped <pstage/lib>libboost_system.dylib for lack of <p/Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/system/build/clang-linux-cget/release/threading-multi>libboost_system.dylib...
clang-linux.compile.c++.without-pth /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/filesystem/build/clang-linux-cget/release/threading-multi/path_traits.o
clang-linux.compile.c++.without-pth /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/filesystem/build/clang-linux-cget/release/threading-multi/path.o
clang-linux.compile.c++.without-pth /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/filesystem/build/clang-linux-cget/release/threading-multi/operations.o
clang-linux.compile.c++.without-pth /Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build/build/boost/bin.v2/libs/filesystem/build/clang-linux-cget/release/threading-multi/unique_path.o
...failed updating 1 target...
...skipped 1 target...
...updated 21 targets...
make[2]: *** [CMakeFiles/boost] Error 1
make[1]: *** [CMakeFiles/boost.dir/all] Error 2
make: *** [all] Error 2
Command failed: ['/usr/local/bin/cmake', '--build', '/Users/distiller/project/cget/cget/build/tmp-00245e52aeba4b19b5a676b97304b3b5/build', '--config', 'Release', '--', '-j', '4']
Failed to build package boost
Exited with code 1
答案 0 :(得分:1)
工具集应设置为clang-darwin
。