linux 动态链接库查找方法;查找动态链接库位置; LIBRARY_PATH 和 LD_LIBRARY_PATH 的区别;LD_LIBRARY_PATH and LD_RUN_PATH的区别;
今天配置之前项目的时候,发现有些动态链接库变了,想看看现在应用在使用哪些动态链接库的时候,进一步查了点资料;
下面针对linux动态链接库查找方法和动态链接库位置配置的过程进行记录:
LIBRARY_PATH 和 LD_LIBRARY_PATH 的区别: (参考链接)
LIBRARY_PATH is used by gcc before compilation to search directories containing static and shared libraries that need to be linked to your program. LD_LIBRARY_PATH is used by your program to search directories containing shared libraries after it has been successfully compiled and linked.
As pointed below, your libraries can be static or shared. If it is static then the code is copied over into your program and you don't need to search for the library after your program is compiled and linked. If your library is shared then it needs to be dynamically linked to your program and that's when LD_LIBRARY_PATH comes into play.
LD_LIBRARY_PATH and LD_RUN_PATH 的区别: (参考链接)
LD_RUN_PATH is used for the link time resolution of libraries whilst LD_LIBRARY_PATH is used for run time resolution of libraries. LD_RUN_PATH Specifies the directories that are to be searched for libraries at both link and run time. LD_LIBRARY_PATH indicates to the dynamic loader to search the colon delimited paths for libraries required to execute the binary. LD_RUN_PATH is used by the linker to specify where to look for libraries only at run time. This differs ever so slightly from LD_LIBRARY_PATH in that this set of paths are not searched during link time.
动态链接库查找路径配置:
1. 可以使用上面 LD_LIBRARY_PATH 等环境变量进行配置;
2. 可以使用 /etc/ld.so.conf 全局配置文件,配置动态链接库运行时的搜索路径; 然后使用ldconfig命令,进行将/etc/ld.so.conf加载到ld.so.cache之中(需要root权限);
3. 然后使用:ldconfig -p | grep "your lib" 进行查找所需要动态链接库的位置;
4. 针对已有程序,可以使用 ldd "your bin" 进行直接看当前执行程序所需要的链接库的情况;
保持更新,转载请注明出处;更多内容,请关注 cnblogs.com/xuyaowen;

/etc/ld.so.conf.d/x86_64-linux-gnu.conf,多体系结构支持配置,以x86_64为例:
# Multiarch support
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
保持更新;
otool -L pk # macos 使用此方法进行查看;
linux 动态链接库查找方法;查找动态链接库位置; LIBRARY_PATH 和 LD_LIBRARY_PATH 的区别;LD_LIBRARY_PATH and LD_RUN_PATH的区别;的更多相关文章
- linux下如何查找nginx配置文件的位置
nginx的配置放在nginx.conf文件中,一般我们可以使用以下命令查看服务器中存在的nginx.conf文件. locate nginx.conf /usr/local/etc/nginx/ng ...
- linux系统中批量查找文件与文件内容的方法
在linux中查看与修改文件权限我们都必须使用命令来操作,不能像windows一样点几下就好了,下面我们简单的介绍一下linux中的相关命令 比如查找当前目录下面所有的php文件里面某个关键字 fin ...
- <1>Linux日志查找方法
Linux日志查找方法 适用于测试,开发,运维人员,用来查找Linux服务器问题的一般方法,比较实用,如果有更好的办法可以一块讨论,欢迎大神们来指导哈!!! 进入正题 第一步.通过Xshell登录服务 ...
- Linux系统中如何查找大文件或文件夹的方法
在Windows系统中,我们可以使用TreeSize工具查找一些大文件或文件夹,非常的方便高效,在Linux系统中,如何去搜索一些比较大的文件呢?下面我整理了一下在Linux系统中如何查找大文件或文件 ...
- dorado 的学习位置、控件使用方法查找、示例演示地址
dorado的学习位置: http://wiki.bsdn.org/display/dorado7/Project+Home dorado的控件使用方法查找: http://dorado7.bsdn. ...
- Linux - 文件查找方法
文件查找方法 1.which 查找可执行文件的位置 [root@local /]# which passwd /usr/bin/passwd 2.whereis 查找可执行文件的位置与相关的文件 [r ...
- php利用反射机制查找类和方法的所在位置
//参数1是类名,参数2是方法名 $func = new ReflectionMethod('UnifiedOrder_pub', 'getPrepayId'); //从第几行开始 $start = ...
- 【转载】ArrayList使用LastIndexOf方法查找最后一个符合条件的元素位置
在C#的编程开发中,ArrayList集合是一个常用的非泛型类集合,在ArrayList集合中如果需要查找最后一个符合条件的元素所在的位置,可以使用ArrayList集合的LastIndexOf方法, ...
- 【转载】C#的ArrayList使用IndexOf方法查找第一个符合条件的元素位置
在C#的编程开发中,ArrayList集合是一个常用的非泛型类集合,在ArrayList集合中如果需要查找第一个符合条件的元素所在的位置,可以使用ArrayList集合的IndexOf方法,Index ...
随机推荐
- c#-EntitySet<TEntity>
MSDN 解释: https://msdn.microsoft.com/zh-cn/library/bb341748.aspx 为 LINQ to SQL 应用程序中的一对多关系和一对一关系的集合方提 ...
- SpringSecurity环境下配置CORS跨站资源共享规则
一.CORS简述 要说明CORS(Cross Origin Resourse-Sharing) 跨站资源共享,就必须先说同源策略.长话短说,同源策略就是向服务端发起请求的时候,以下三项必须与当前浏览器 ...
- 程序员的算法课(3)-递归(recursion)算法
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/m0_37609579/article/de ...
- 2. Python环境安装
Centos 下环境安装 我们通过pyenv来管理python环境,更好的帮助开发者避免在环境上出现各种各样的问题 准备工作 安装之前,确保已经安装了git yum install git -y 安装 ...
- 大白话OSI七层协议
目录 一.物理层 二.数据链路层 2.1 以太网协议 2.2 Mac地址 2.3 广播地址 三.网络层 3.1 IP协议详解 3.1.1 IP地址的两部分 3.2 子网掩码详解 3.3 IP数据包详解 ...
- php-fpm的pool、php-fpm慢执行日志、open_basedir、php-fpm进程管理
6月13日任务 12.21 php-fpm的pool12.22 php-fpm慢执行日志12.23 open_basedir12.24 php-fpm进程管理 12.21 php-fpm的pool p ...
- jQuery实现倒计时重新发送短信验证码功能示例
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- Codeforces Round #451 (Div. 2) A B C D E
Codeforces Round #451 (Div. 2) A Rounding 题目链接: http://codeforces.com/contest/898/problem/A 思路: 小于等于 ...
- 《Windows内核安全与驱动开发》 5.1&5.2 内核与应用方面的编程
<Windows内核安全与驱动开发>阅读笔记 -- 索引目录 <Windows内核安全与驱动开发> 5.1&5.2 内核与应用方面的编程 一.生成控制设备 如果一个驱 ...
- 小白的springboot之路(八)、继承Redis以及@Cacheable注解实现Redis缓存
0.前言 在项目中,缓存作为一种高效的提升性能的手段,几乎必不可少,Redis作为其中的佼佼者被广泛应用: 一.spring boot集成Redis 1.添加依赖 <dependency> ...