c++ - 在OS X上编译Boost时“ld: unknown option: -soname”

标签 c++ xcode macos boost circleci

我想从不同平台上的源代码构建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 Page

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

最佳答案

该工具集应设置为clang-darwin

关于c++ - 在OS X上编译Boost时“ld: unknown option: -soname”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52837095/

相关文章:

c++ - 为什么我的数字在我的猜数字游戏中计算不正确?

ios - CGAffineTransform缩放和平移-动画前跳转

ios - CATextlayer 更改 FONT 的大小以适应框架

php - 在 OS X 10.11 El Capitan、macOS 10.12 Sierra、macOS 10.13 High Sierra (< 10.13.3) 上安装 pecl 和 pear

c++ - OpenCL 代码的 malloc 问题 - OS X 上 mach_vm_map 的大小很大

c++ - 部分名称搜索

c++ - 将 T 数组别名为 std::complex<T> 数组合法吗?

C++ LibVLC 可以用吗?

ios - 如何在 iOS Objective - C 中创建 (DICOM) .dcm 文件?

java - 如何跨更新在 Mac 上保留 CAcerts keystore ?