首页 文章

无法使用boost 1.48构建共享库

提问于
浏览
1

我试图在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 配置的共享库 .

1 回答

  • 0

    我有一个类似的问题试图在标准的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挤压服务器是如何破坏的 . 我一直在编译其他挤压系统,没有任何问题 .

相关问题