未能使用boost 1.48构建共享库
failed to build shared libraries with boost 1.48
我正试图在amd64计算机上构建boost 1.48,但由于重新定位错误,共享库没有构建。我认为这是由于-fPIC
,但这就是无法解决的原因。
更具体地说,这是我得到的,通过主干
$ ./b2
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a(codecvt.o): relocation R_X86_64_32S against `vtable for std::codecvt<wchar_t, char, __mbstate_t>' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
我也试过这些
./bjam -d2
./bjam address-model=64 cxxflags=-fPIC
如本文所述
http://boost.2283326.n4.nabble.com/fPIC-option-for-boost-td3176976.html
然而,这并没有起到任何作用。我无法构建使用boostrap.sh
配置的共享库。
我在尝试在标准debian挤压安装上构建mosh-1.2.2时遇到了类似的问题。以下对我有效:
# cd /usr/lib/gcc/x86_64-linux-gnu/4.4.5
# rm libstdc++.so
# ln -s ../../../x86_64-linux-gnu/libstdc++.so.6 libstdc++.so
为了更详细地解释,现有的符号链接指向一个不存在的文件:
# cd /usr/lib/gcc/x86_64-linux-gnu/4.4.5
# ls -l libstdc++.so
..
lrwxrwxrwx 1 root root 23 May 3 2011 libstdc++.so -> ../../../libstdc++.so.6
..
我找到了正确的文件位置
# dpkg -S 'libstdc'
..
libstdc++6: /usr/lib/x86_64-linux-gnu/libstdc++.so.6
..
然后按照第一个代码段中的描述修复了符号链接。
我在编译过程中得到的错误是:
make[3]: *** [mosh-client] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a(functexcept.o): relocation R_X86_64_32 against `std::bad_typeid::~bad_typeid()' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a: could not read symbols: Bad value
不知道这个特定的debian挤压服务器是怎么坏的。我一直在其他挤压系统上进行编译,没有遇到任何问题。
相关文章:
- 为 Python 构建共享库C++时出现分段错误
- 如何在 Linux 中构建共享库时使未定义引用的链接器失败
- 从单个.cpp构建共享对象
- 从静态库构建共享库
- 使用 Makefile 构建共享库
- 我可以在Embarcadero C 建造者中为Android(*.so)构建共享库
- setuptools:从C++代码构建共享库,然后构建链接到共享库的 Cython 包装器
- 构建共享对象 - 使用 Ninja 编译适用于 OSX 和 Windows 上的 Ubuntu Crush
- 使用boost :: python手动构建共享对象
- JNI 使用静态 NTL 库构建共享库
- Libtool 在构建共享库时会丢弃静态库
- 使用 C/C++ 以外的语言构建共享库,特别是 prolog
- Eclipse,构建共享库的最佳方式
- OSX Scons构建共享库:体系结构x86_64的未定义符号
- Android NDK构建共享库-中止-停止.local_module_filename不能包含文件扩展名
- 构建共享的帕尔梅蒂斯-4.0.3
- 在linux中使用另一个共享库构建共享库
- 确定用于在*ix操作系统上构建共享对象的编译器和版本
- 未能使用boost 1.48构建共享库
- Qt保持构建共享构建无论我选择什么选项