加载共享库

时间:2013-02-07 00:38:26

标签: bash shell unix libraries shared

我在运行需要它们的脚本时遇到加载共享库的问题:

error while loading shared libraries: libirc.so: cannot open shared object file: No such file or directory

但是,我认为我的设置没问题:

set LD_LIBRARY_PATH = /lfs/data0/g_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64
export LD_LIBRARY_PATH

ls /lfs/data0/g_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64表明libirc.so确实存在。

echo $LD_LIBRARY_PATH正确返回:

/lfs/data0/g_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64

它仍然无效,所以我有点绝望...... :)

有人可以帮我吗?

一些有用的信息:

echo ${SHELL}
/bin/bash

另外,我运行的脚本在开头包含了这个:

#!/bin/csh
#PBS -z
#PBS -S /bin/csh

set PATH = /usr/local/x86_64/gnu/openmpi-1.4.5/bin
export PATH

谢谢!

2 个答案:

答案 0 :(得分:0)

听起来你在群集上运行它,在这种情况下,问题与你的shell无关。试试:

#PBS -v LD_LIBRARY_PATH="/lfs/data0/g_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64"

值得注意的是

set LD_LIBRARY_PATH = /lfs/data0/g_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64

是csh语法,而你说你正在运行bash。 bash等价物是

LD_LIBRARY_PATH=/lfs/data0/g_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64

它的间距敏感。

答案 1 :(得分:0)

感谢nneonneo,这是它给出的内容:(我只是粘贴消息的开头,因为它很长,让我知道是否需要完整的输出):

LD_DEBUG=all ./mpp_starter
 26489: 
 26489: file=librt.so.1 [0];  needed by ./mpp_starter [0]
 26489: find library=librt.so.1 [0]; searching
 26489:  search path=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/tls/x86_64:/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/tls:/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/x86_64:/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64      (LD_LIBRARY_PATH)
 26489:   trying file=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/tls/x86_64/librt.so.1
 26489:   trying file=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/tls/librt.so.1
 26489:   trying file=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/x86_64/librt.so.1
 26489:   trying file=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/librt.so.1
 26489:  search cache=/etc/ld.so.cache
 26489:   trying file=/lib64/librt.so.1
 26489: 
 26489: file=librt.so.1 [0];  generating link map
 26489:   dynamic: 0x0000003a74a06dc8  base: 0x0000000000000000   size: 0x0000000000207bb0
 26489:     entry: 0x0000003a74802140  phdr: 0x0000003a74800040  phnum:                  9
 26489: 
 26489: 
 26489: file=libnuma.so.1 [0];  needed by ./mpp_starter [0]
 26489: find library=libnuma.so.1 [0]; searching
 26489:  search path=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64       (LD_LIBRARY_PATH)
 26489:   trying file=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/libnuma.so.1
 26489:  search cache=/etc/ld.so.cache
 26489:   trying file=/usr/lib64/libnuma.so.1
 26489: 
 26489: file=libnuma.so.1 [0];  generating link map
 26489:   dynamic: 0x0000003a77207450  base: 0x0000000000000000   size: 0x0000000000207d60
 26489:     entry: 0x0000003a770026d0  phdr: 0x0000003a77000040  phnum:                  7
 26489: 
 26489: 
 26489: file=libdl.so.2 [0];  needed by ./mpp_starter [0]
 26489: find library=libdl.so.2 [0]; searching
 26489:  search path=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64       (LD_LIBRARY_PATH)
 26489:   trying file=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/libdl.so.2
 26489:  search cache=/etc/ld.so.cache
 26489:   trying file=/lib64/libdl.so.2
 26489: 
 26489: file=libdl.so.2 [0];  generating link map
 26489:   dynamic: 0x0000003a73a02da0  base: 0x0000000000000000   size: 0x0000000000203100
 26489:     entry: 0x0000003a73800de0  phdr: 0x0000003a73800040  phnum:                  9
 26489: 
 26489: 
 26489: file=libirc.so [0];  needed by ./mpp_starter [0]
 26489: find library=libirc.so [0]; searching
 26489:  search path=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64       (LD_LIBRARY_PATH)
 26489:   trying file=/lfs/data0/gstar_local/intel/composer_xe_2011_sp1.7.256/compiler/lib/intel64/libirc.so
 26489: 
 26489: file=libirc.so [0];  generating link map
 26489:   dynamic: 0x00007f6635da51b0  base: 0x00007f6635c66000   size: 0x0000000000142bc0
 26489:     entry: 0x00007f6635c6d040  phdr: 0x00007f6635c66040  phnum:                  5
 26489: 
 26489: