zoukankan      html  css  js  c++  java
  • 动态链接库找不到 : error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory

    问题:

    运行gsl(GNU scientific Library)的函数库,用

    gcc erf.c -I/usr/local/include -L/usr/local/lib64 -L/usr/local/lib -g -Wall --std=gnu99 -lgsl -lgslcblas -o m.o

    编译,之后运行./m.o

    提示error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory

    解决方法:

    在shell下

    ldd m.o

    输出:

    ~/test/c $ldd m.o 
    linux-vdso.so.1 => (0x00007fff3d5ff000) 
    libgsl.so.0 => not found 
    libgslcblas.so.0 => not found 
    libc.so.6 => /lib64/libc.so.6 (0x00007f7420c3b000) 
    /lib64/ld-linux-x86-64.so.2 (0x00007f7420fdd000)

    说明libgsl和libgslcblas.so找不到

    sudo ldconfig

    ldconfig的作用是:Configure Dynamic Linker Run Time Bindings.

    然后再次运行ldd m.o

    ~/test/c $ldd m.o 
    linux-vdso.so.1 => (0x00007fff62bad000) 
    libgsl.so.0 => /usr/local/lib/libgsl.so.0 (0x00007f6968a01000) 
    libgslcblas.so.0 => /usr/local/lib/libgslcblas.so.0 (0x00007f69687ce000) 
    libc.so.6 => /lib64/libc.so.6 (0x00007f6968439000) 
    libm.so.6 => /lib64/libm.so.6 (0x00007f69681b5000)

    已经成功运行

    问题出现原因:

    刚刚安装好gsl后,由于gsl的动态链接库没有及时刷新导致识别不到。

  • 相关阅读:
    poj 2418 Hardwood Species
    hdu 3791 二叉搜索树
    九度oj 1544 数字序列区间最小值
    九度oj 1525 子串逆序打印
    九度oj 1530 最长不重复子串
    九度oj 1523 从上往下打印二叉树
    P1190 接水问题
    P1179 数字统计
    P1083 借教室
    P1079 Vigenère 密码
  • 原文地址:https://www.cnblogs.com/vastiny/p/3849169.html
Copyright © 2011-2022 走看看