在已编译的可执行文件中更改boost的链接版本

时间:2014-11-20 14:25:33

标签: c++ boost linker

我有一个已编译的程序,在旧的unix服务器上运行得很好,但在新服务器上却出现了这个错误:

  加载共享库时出现

错误:加载共享库时出现libboost reerror:libboost_reex.so.2

重要的是要提到我不是服务器的所有者,因此我无法进行任何需要root权限的更改。

我在服务器上的两个文件中都使用了ldd命令并收到了以下结果: 在较旧的服务器上:

ldd conglfinder 
    linux-vdso.so.1 =>  (0x00007fff427fd000)
    libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003d64400000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003d5d800000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003d5d000000)
    libboost_regex.so.2 => /usr/lib64/libboost_regex.so.2 (0x00002ba6c486d000)
    libboost_filesystem.so.2 => /usr/lib64/libboost_filesystem.so.2 (0x00002ba6c4b19000)
    libbiu-bio-clone.so => not found
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003d62400000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003d5cc00000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003d5c800000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003d62000000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003d5c400000)
    libicui18n.so.36 => /usr/lib64/libicui18n.so.36 (0x00002ba6c4d2b000)
    libicuuc.so.36 => /usr/lib64/libicuuc.so.36 (0x00002ba6c506f000)
    libicudata.so.36 => /usr/lib64/libicudata.so.36 (0x00002ba6c53a5000)

并在新服务器上:

    linux-vdso.so.1 =>  (0x00007fff3c55c000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003648600000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x000000363b200000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000363b600000)
libboost_regex.so.2 => not found
libboost_filesystem.so.2 => not found
libbiu-bio-clone.so => not found
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x000000363fa00000)
libm.so.6 => /lib64/libm.so.6 (0x000000363be00000)
libc.so.6 => /lib64/libc.so.6 (0x000000363ae00000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000000363ea00000)
/lib64/ld-linux-x86-64.so.2 (0x000000363aa00000)

有没有办法在不重新编译代码的情况下修复此链接错误?

更新

我已经掌握了源文件,并在新的Unix服务器上重新编译它,并在编译后尝试运行该程序,但仍然会出现同样的错误。 此时,新服务器上的ldd命令返回此信息:

linux-vdso.so.1 =>  (0x00007fffe97ff000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x0000003648600000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x000000363b200000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000363b600000)
libboost_regex.so.5 => /usr/lib64/libboost_regex.so.5 (0x00007f80751e7000)
libboost_filesystem.so.5 => /usr/lib64/libboost_filesystem.so.5 (0x00007f8074fd2000)
libbiu-bio-clone.so => not found
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x000000363fa00000)
libm.so.6 => /lib64/libm.so.6 (0x000000363be00000)
libc.so.6 => /lib64/libc.so.6 (0x000000363ae00000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000000363ea00000)
/lib64/ld-linux-x86-64.so.2 (0x000000363aa00000)
libicuuc.so.42 => /usr/lib64/libicuuc.so.42 (0x0000003646600000)
libicui18n.so.42 => /usr/lib64/libicui18n.so.42 (0x0000003647800000)
libboost_system.so.5 => /usr/lib64/libboost_system.so.5 (0x00007f8074dcc000)
libicudata.so.42 => /usr/lib64/libicudata.so.42 (0x0000003649e00000)

回答评论中的问题:

新服务器的boost库中不包含:libboost_regex.so.2,我无法在那里添加它们。

从ldd日志中可以看出Boos安装在新服务器上。

Updates2: 我把丢失的库放到我目录中的另一个地方并重新安装 现在我收到了这个错误:

/usr/bin/ld: warning: libboost_regex.so.2, needed by ../BaseLib/libbiu-bio-clone
.so, may conflict with libboost_regex.so.5
/usr/bin/ld: warning: libicui18n.so.36, needed by /home/ls/ravid/cluster_Try/lib
boost_regex.so.2, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicuuc.so.36, needed by /home/ls/ravid/cluster_Try/libbo
ost_regex.so.2, not found (try using -rpath or -rpath-link)
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `u_isspac
e_3_6'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `u_tolowe
r_3_6'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `u_isblan
k_3_6'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `icu_3_6:
:Collator::createInstance(icu_3_6::Locale const&, UErrorCode&)'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `icu_3_6:
:Locale::~Locale()'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `icu_3_6:
:Locale::Locale(icu_3_6::Locale const&)'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `u_charFr
omName_3_6'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `u_charTy
pe_3_6'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `icu_3_6:
:Locale::Locale()'
/home/ls/ravid/cluster_Try/libboost_regex.so.2: undefined reference to `u_digit_
3_6'
collect2: ld returned 1 exit status
make: *** [conglfinder] Error 1

我该怎么办?

0 个答案:

没有答案