解决安装oracle /usr/bin/ld: cannot find -lclntshcore的问题

博客讲述了在编译过程中遇到GCC无法找到Oracle库-lclntshcore的问题。作者通过检查LD_RUN_PATH和创建软链接到/usr/lib解决了这个问题,确保编译器能够正确找到所需的库文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题:

"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs 644
rm -f blib/arch/auto/DBD/Oracle/Oracle.so
LD_RUN_PATH="/opt/user/lib/instantclient_19_15" x86_64-linux-gnu-gcc  -shared -L/usr/local/lib -fstack-protector-strong  Oracle.o dbdimp.o oci8.o  -o blib/arch/auto/DBD/Oracle/Oracle.so  \
   -L/opt/user/lib/instantclient_19_15/ -Wl,-rpath,/opt/user/lib/instantclient_19_15/ -lclntsh -Wl,--no-as-needed -lclntshcore -lipc1 -lmql1   \
  
/usr/bin/ld: cannot find -lclntshcore
collect2: error: ld returned 1 exit status
make: *** [Makefile:524: blib/arch/auto/DBD/Oracle/Oracle.so] Error 1

root# ln -s /oracle/base/dbhome_1/lib/libclntshcore.so.12.1 /usr/lib/
root# ls -l /usr/lib/libclntshcore.so.12.1
lrwxrwxrwx 1 root root 47 Sep 19 11:08 /usr/lib/libclntshcore.so.12.1 -> /oracle/base/dbhome_1/lib/libclntshcore.so.12.1
root#

Weird, this lib is an oracle lib..and the installer is looking for it in the wrong location. I’ll link this lib in the general lib location where it always can be found: /usr/lib.

这个库是oracle的一个库 并不是放在/usr/lib下 所以gcc找不到路径
我明白了,是gcc找不到,于是我在/usr/lib下做了软连接
ln -s $ORACLE_HOME libclntshcore.so.19.1 libclntshcore.so
说白了就是保证/usr/lib下目录面有 libclntshcore.so文件
在这里插入图片描述

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值