在OS X上编译Boost时,出现 "ld: unknown option: -soname"。

问题描述 投票:2回答:1

我想在不同的平台上从源头上构建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必须要解决的问题,对吧?

cGet Github页面

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
c++ xcode macos boost circleci
1个回答
1
投票

工具集应该设置为 clang-darwin.

© www.soinside.com 2019 - 2024. All rights reserved.