设置了/etc/ld.so.conf,运行了ldconfig,编译仍找不到动态库

zzzhktk zzzhktk 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的makefile文件如下:
test:test.o
gcc test.o -ldl -lsmbios -o test
test.o:test.c
gcc -c test.c -o test.o

动态库在/home/lib-jar/test中,我配置了/etc/ld.so.conf
/etc/ld.so.conf内容如下:
include ld.so.conf.d/*.conf
/home/lib-jar/test

然后执行了ldconfig命令,

执行ldconfig -p也能找到动态库
[root@zhaozhanzhong test]# ldconfig -p | grep smbios
libsmbios.so (libc6,x86-64) => /home/lib-jar/test/libsmbios.so

可执行make,却出错,结果如下

[root@zhaozhanzhong test]# make
gcc -c test.c -o test.o
gcc test.o -ldl -lsmbios -o test
/usr/bin/ld: cannot find -lsmbios
collect2: ld returned 1 exit status
make: *** [test] Error 1


但是当我把libsmbios.so拷贝到/usr/lib目录下时就没问题

请问这是怎么回事
...全文

相关推荐

把Lua编译进nginx步骤方法

主要介绍了把Lua编译进nginx步骤方法,本文讲解了操作步骤以及可能出现的错误解决方法,需要的朋友可以参考下

weixin_38617602

linux学习.pdf

linux操作编程新手入门

minenine

海思3159A运行yolov3之caffe安装[源码]

本文详细记录了在Ubuntu16.04系统上,为海思3159A平台运行yolov3而安装caffe框架的完整过程,重点汇总了安装过程中遇到的各种报错及解决方案。环境配置为CUDA10.1和cudnn7.5。文章首先通过git克隆caffe源码,然后指导修改Makefile.config配置文件,包括启用cudnn、opencv3、python接口,并调整python路径和hdf5头文件路径。接着,文章列出了安装依赖库的步骤,如Boost、glog、gflags、lmdb、protobuf、leveldb、snappy、hdf5、atlas和opencv等,并针对每个依赖缺失导致的编译错误给出了具体的apt-get安装命令。此外,还解决了链接libcaffe库时的问题。最终,通过make all -j8成功编译,并通过make test和make runtest验证安装。最后,文章还介绍了安装anaconda和编译pycaffe以配置python接口的步骤。

rainy

浅析python 动态库m.so.1.0错误问题

$ python -V python: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory ldd是列出动态库依赖关系: $ ldd /usr/local/bin/python3.6 linux-vdso.so.1 => (0x00007fffecbba000) libpython3.6m.so.1.0 => not found libpthread.so.0 => /usr/lib64/libpthrea

weixin_38703123

error while loading shared libraries xx.so处理方法

一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库(error while loading shared libraries xx.so)的错误

weixin_38525735
评论 2
收藏 已收藏
分享
返回顶部
zzzhktk
Linux/Unix社区 23,224 成员 74,535 内容