您的位置:首页 > 其它

定位问题的利器之strace

2012-08-23 14:43 106 查看
svn安装在了tools目录外面,把文件夹移动tools/下的时候,发现svn不能用了,报错

error while loading shared libraries: libsvn_client-1.so.0: cannot open shared object file: No such file or directory

1、之前出现过这样的问题,大师教招:strace。于是用strace svn跑了下,发现

strace ./bin/svn
execve("./bin/svn", ["./bin/svn"], [/* 22 vars */]) = 0
uname({sys="Linux", node="cq01-testing-img12.vm.baidu.com", ...}) = 0
brk(0) = 0x52e000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a95556000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/home/work/svn/lib/tls/x86_64/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/work/svn/lib/tls/x86_64", 0x7fbfffed30) = -1 ENOENT (No such file or directory)
open("/home/work/svn/lib/tls/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/work/svn/lib/tls", 0x7fbfffed30) = -1 ENOENT (No such file or directory)
..open("/usr/lib64/tls/x86_64/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/tls/x86_64", 0x7fbfffed30) = -1 ENOENT (No such file or directory)
open("/usr/lib64/tls/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/tls", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib64/x86_64/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/x86_64", 0x7fbfffed30) = -1 ENOENT (No such file or directory)
open("/usr/lib64/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=24576, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=75094, ...}) = 0
mmap(NULL, 75094, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2a95557000
close(3) = 0
open("/lib64/tls/x86_64/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/tls/x86_64", 0x7fbfffed30) = -1 ENOENT (No such file or directory)
open("/lib64/tls/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/tls", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/lib64/x86_64/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/x86_64", 0x7fbfffed30) = -1 ENOENT (No such file or directory)
open("/lib64/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib64/tls/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/libsvn_client-1.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)

修改了bashrc中的path变量,加入这个路径还是有问题。只能请教大师

2、大师招数1——ldd命令查看 so文件,发现so not found

libsvn_client-1.so.0 => not found
libsvn_wc-1.so.0 => not found

3、大师招数2——查看LD_LIBRARY_PATH变量

发现是空的

于是传授入下

1)LD_LIBRARY_PATH变量设置上svn的lib路径

于是在~/.bashrc里面加入了

“export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/tools/”

source ~/.bashrc后解决
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: