博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2.3 Shared Libraries
阅读量:7008 次
发布时间:2019-06-28

本文共 1263 字,大约阅读时间需要 4 分钟。

hot3.png

2.3 Shared Libraries

To run a program linked with the shared version of the library the operating system must be able to locate the corresponding .so file at runtime. If the library cannot be found, the following error will occur:

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

To avoid this error, either modify the system dynamic linker configuration5 or define the shell variable LD_LIBRARY_PATH to include the directory where the library is installed.

For example, in the Bourne shell (/bin/sh or /bin/bash), the library search path can be set with the following commands:

$ LD_LIBRARY_PATH=/usr/local/lib $ export LD_LIBRARY_PATH $ ./example

In the C-shell (/bin/csh or /bin/tcsh) the equivalent command is,

% setenv LD_LIBRARY_PATH /usr/local/lib

The standard prompt for the C-shell in the example above is the percent character ‘%’, and should not be typed as part of the command.

To save retyping these commands each session they can be placed in an individual or system-wide login file.

To compile a statically linked version of the program, use the -static flag in gcc,

$ gcc -static example.o -lgsl -lgslcblas -lm

source:

转载于:https://my.oschina.net/randy1986/blog/1810354

你可能感兴趣的文章
Azure运维系列10:跨订阅迁移ARM虚拟机
查看>>
c3p0数据源用户名密码加密
查看>>
Perl的经典用法及源码
查看>>
更改邮件发送语言为英语,解决编码为UTF8邮箱注册账号,邮件内容乱码问题
查看>>
网站内容的需求性影响关键词的排名
查看>>
POSIX信号量——环形buf实现生产者消费者模型
查看>>
代码重构计划 New Code Style
查看>>
lisp format
查看>>
简陋的swift carthage copy-frameworks 辅助脚本
查看>>
S3C2440上touchscreen触摸屏驱动
查看>>
ios开发博客收集
查看>>
守护线程 & 终结器
查看>>
购物车类
查看>>
H3C设备之多区域OSPF
查看>>
关于ORA-01950: no privileges on tablespace 的解决
查看>>
八、MySQL索引
查看>>
【分享】Java中如何读写cookie
查看>>
word导出html实现在线预览
查看>>
redhat 7.x 、redhat 6.x查看硬盘UUID方法
查看>>
nginx做负载均衡,引起写io大的优化
查看>>