1. 程式人生 > 其它 >c執行時動態庫的幾種配置方式

c執行時動態庫的幾種配置方式

1、LD_LIBRARAY_PATH方式。系統管理員和DBA經常使用,oracle的做法。

2、修改配置檔案/etc/ld.so.conf,然後執行ldconfig命令。

[lightdb@sdw ~]$ cat /etc/ld.so.c
ld.so.cache ld.so.conf ld.so.conf.d/
[lightdb@sdw ~]$ cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
[lightdb@sdw ~]$ cat /etc/ld.so.conf.d/
kernel-4.19.90-23.8.v2101.ky10.aarch64.conf opencryptoki-aarch64.conf sssd-aarch64.conf tracker-aarch64.conf
mysql-aarch64.conf openldap-aarch64.conf sudo-aarch64.conf tracker-miners-aarch64.conf
[lightdb@sdw ~]$ cat /etc/ld.so.conf.d/kernel-4.19.90-23.8.v2101.ky10.aarch64.conf
# Placeholder file, no vDSO hwcap entries used in this kernel.
[lightdb@sdw ~]$ cat /etc/ld.so.conf.d/mysql-aarch64.conf
/usr/lib64/mysql

3、編譯的時候指定gcc引數-Wl,-rpath。準確的說是連結引數,ld的引數。適合製作二進位制版壓縮包,全部自包含。例如依賴了三方原始碼,但是又不希望或無法安裝到系統預設目錄/usr/local/lib時可以使用。

LightDB Enterprise Postgres--金融級關係型資料庫,更快、更穩、更懂金融!