/etc/ld.so.conf文件介绍
来源:互联网 发布:mathematics软件安卓 编辑:程序博客网 时间:2024/04/29 20:43
/etc/ld.so.conf文件介绍
/etc/ld.so.conf 此文件记录了编译时使用的动态库的路径,也就是加载so库的路径。
默认情况下,编译器只会使用/lib和/usr/lib这两个目录下的库文件,而通常通过源码包进行安装时,如果不指定--prefix会将库安装在/usr/local目录下,而又没有在文件/etc/ld.so.conf中添加/usr/local/lib这个目录。这样虽然安装了源码包,但是使用时仍然找不到相关的.so库,就会报错。也就是说系统不知道安装了源码包。
www.2cto.com
对于此种情况有2种解决办法:
(1)在用源码安装时,用--prefix指定安装路径为/usr/lib。这样的话也就不用配置PKG_CONFIG_PATH
(2) 直接将路径/usr/local/lib路径加入到文件/etc/ld.so.conf文件的中。在文件/etc/ld.so.conf中末尾直接添加:/usr/local/lib(这个方法给力!)
ldconfig
再来看看ldconfig这个程序,位于/sbin下,它的作用是将文件/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.so.cache以供使用,因此当安装完一些库文件,或者修改/etc/ld.so.conf增加了库的新的搜索路径,需要运行一下ldconfig,使所有的库文件都被缓存到文件/etc/ld.so.cache中,如果没做,可能会找不到刚安装的库。
PKG_CONFIG_PATH: www.2cto.com
最后说下PKG_CONFIG_PATH这个环境变量,它是在安装了pkg-config后出现的
其实pkg-config就是向configure程序提供系统信息的程序,比如软件的版本啦,库的版本啦,库的路径啦,等等
这些信息只是在编译其间使用。你可以 ls /usr/lib/pkgconfig 下,会看到许多的*.pc,用文本编辑器打开
会发现类似下面的信息:
prefix=/usr
exec_prefix=$
libdir=$/lib
includedir=$/include
glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums
Name: GLib
Description: C Utility Library
Version: 2.4.7
Libs: -L$ -lglib-2.0
Cflags: -I$/glib-2.0 -I$/glib-2.0/include
明白了吧,configure就是靠这些信息判断你的软件版本是否符合要求。并且得到这些东东所在的位置,要不去哪里找呀。
不用我说你也知道为什么会出现上面那些问题了吧。
所以要正确配置这个环境变量,我的配置是:
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig
0 0
- /etc/ld.so.conf 文件介绍
- /etc/ld.so.conf 文件介绍
- /etc/ld.so.conf文件介绍
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- /etc/ld.so.conf文件
- etc/ld.so.conf文件
- Codeforces Round #291 (Div. 2) 题解
- 杭电 1230 火星a+b 【大数】【进制转换】
- WebRTC学习资料大全
- Python各种参数
- Android使用Camera2 替代过时的Camera API
- /etc/ld.so.conf文件介绍
- webkit+各种js交互方法
- 微信小程序开发之选择器 时间选择器 日期选择器 地区选择器
- Android多分辨率适配框架使用指南
- 构建嵌入式Linux系统读书笔记
- 用C语言操作MySQL数据库
- 问题记录---java程序内存溢出
- 关于java定义属性数组的心得
- 株洲新程IT 教育 李赞红老师 第二章 Graphics2D API