执行期间无法打开共享库

时间:2010-05-07 01:05:53

标签: shared-libraries runtime-error

我按如下方式编写了我的程序:

mpicc b_eff_io.c -o b_eff_io2 -I/scratch/irodero/papi/include -L/scratch/irodero/papi/src -lpapi -lm


 41125309    4 drwxr-xr-x  3 irodero users    4096 May  3 23:14 .
    39649287    4 drwxr-xr-x 12 irodero users    4096 May  3 00:27 ..
    41126356    4 drwxr-xr-x  2 irodero users    4096 May  3 23:10 kk
    41125409 2632 -rw-r--r--  1 irodero users 2688796 May  3 00:27 libpapi.a
    41126357  764 -rwxr-xr-x  1 irodero users  774486 May  3 23:14 libpapi.so
    41126358  764 -rwxr-xr-x  1 irodero users  774486 May  3 23:14 libpapi.so.4
    41126359  764 -rwxr-xr-x  1 irodero users  774486 May  3 23:14 libpapi.so.4.0.0
    41125398   84 -rw-r--r--  1 irodero users   79032 May  3 00:27 libperfctr.a
    41126360   76 -rwxr-xr-x  1 irodero users   72623 May  3 23:14 libperfctr.so
    41126361   76 -rwxr-xr-x  1 irodero users   72623 May  3 23:14 libperfctr.so.6
    41126362   76 -rwxr-xr-x  1 irodero users   72623 May  3 23:14 libperfctr.so.6.2.6.40
    41125312 1216 -rw-r--r--  1 irodero users 1238236 May  3 00:27 libpfm.a
    41126363 1028 -rwxr-xr-x  1 irodero users 1046742 May  3 23:14 libpfm.so
    41126364 1028 -rwxr-xr-x  1 irodero users 1046742 May  3 23:14 libpfm.so.3
    41126365 1028 -rwxr-xr-x  1 irodero users 1046742 May  3 23:14 libpfm.so.3.9.0

但是我收到了这个错误:

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

我该怎么办?

2 个答案:

答案 0 :(得分:2)

也许......

  • 图书馆正在使用
  • 权限不正确
  • 它不存在
  • 它不在图书馆搜索路径中

答案 1 :(得分:2)

我有类似的问题。

$ ./a.out 
./a.out: error while loading shared libraries: libpapi.so: cannot open shared object file:     No such file or directory

$locate libpapi.so
/usr/local/lib64/libpapi.so
/usr/local/lib64/libpapi.so.4
/usr/local/lib64/libpapi.so.4.1.4.0

创建/ usr / lib的符号链接修复了问题

ln -s /usr/local/lib64/libpapi.so /usr/lib/libpapi.so