编译 Boost 时在 OS X 上的"ld:未知选项:-soname"
“ld: unknown option: -soname” on OS X when compiling Boost
我想从不同平台上的源代码构建 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
工具集应设置为clang-darwin
。
相关文章:
- 理解boost::asio-async_read在无需读取内容时的行为
- boost::进程间消息队列引发错误
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- cmake如何在fedora工作站中找到boost静态库包
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- Boost Graph Library,修复节点大小
- 什么是"#include <boost/functional/hash.hpp> "?
- 基于boost的程序的静态链接——zlib问题
- C++:如何在CLion IDE中安装Boost
- C++Boost Asio Pool线程,带有lambda函数和传递引用变量
- 如何在boost beast http请求中设置http头
- Boost Spirit,获取迭代器内部语义动作
- boost::asio::steady_timer()与sleep()我应该使用哪一个
- boost::asio如何生成多个协同程序,然后加入它们
- 当我尝试使用 sstream 和分面将 Boost Time_duration转换为字符串时,我没有得到所需的格式
- Visual Studio(或任何其他工具)能否将地址解释为调用堆栈(boost上下文)的开头
- 如何使用boost::具有嵌套结构和最小代码更改的序列化
- 使用Boost Interprocess创建托管共享内存需要很长时间
- Boost::posix_time::ptime舍入到给定的分钟数
- "非静态数据成员之前需要构造函数" - 我是否使用"boost::variant"