编译错误:/ usr / bin / ld:找不到-lclntsh

问题描述 投票:2回答:3

在尝试使用make文件编译C程序时,我面临下面描述的以下链接错误。

我知道很多其他帖子已经讨论过这类问题,但我尝试了其中提出的解决方案,但它们都没有用。

/ usr / bin / ld:找不到-lclntsh

libclntsh.so和libclntsh.so.10.1存在于oracle路径/u01/app/oracle/product/10.2.0/lib中,并且在make文件中以-L选项的形式给出。我仍然面临着这个问题: -

Linking yieldrpt ...
cc -v -g -D_HPUX_SOURCE -DPARETO -Wl,-aarchive -L/u01/app/oracle/product/10.2.0/lib/         yieldrpt.o  -lclntsh `cat /u01/app/oracle/product/10.2.0/lib/ldflags`   -lmalloc -ldl -lm   \
                -lmalloc -o yieldrpt
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)
/usr/libexec/gcc/i386-redhat-linux/4.1.2/collect2 --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -o yieldrpt /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o -L/u01/app/oracle/product/10.2.0/lib/ -L/usr/lib/gcc/i386-redhat-linux/4.1.2 -L/usr/lib/gcc/i386-redhat-linux/4.1.2 -L/usr/lib/gcc/i386-redhat-linux/4.1.2/../../.. -aarchive yieldrpt.o -lclntsh -lnbeq10 -lnhost10 -lnus10 -lnldap10 -lldapclnt10 -lnsslb10 -lntcp10 -lntcps10 -lnsslb10 -lntcp10 -lntns10 -lmalloc -ldl -lm -lmalloc -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o     /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
/usr/bin/ld: cannot find -lclntsh
collect2: ld returned 1 exit status
make: *** [yieldrpt] Error 1

如果需要任何其他信息,请告诉我。谢谢

c compilation linker
3个回答
0
投票

您正在将-aarchive传递给链接器。这是HP / UX兼容性选项,与-Bstatic同义,后者指示链接器不链接动态库。因此你的libclntsh.so被忽略了。见the documentation

如果您不知道为什么会出现此选项,您可以将其删除并重试。如果您知道有必要,那么您将不得不找到静态库,包括libclntsh.a链接。


0
投票

如果已经安装了libclntsh.so.12.1或类似版本,则可以尝试使用以下命令将库符号链接到libclntsh.so:ln -s /usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1 / usr / lib中/ ORACLE / 12.1 / client64 / LIB / libclntsh.so


-3
投票
[oracle@em12c bin]$ pwd
/u01/em12c/middleware/oms/bin
[oracle@em12c bin]$ export ORACLE_HOME=/u01/em12c/middleware/oms
[oracle@em12c bin]$ ./genclntsh

[oracle@em12c bin]$ ls -l /u01/em12c/middleware/oms/lib32//libclntsh.so
lrwxrwxrwx. 1 oracle oinstall 17 Oct 23 22:16 /u01/em12c/middleware/oms/lib32//libclntsh.so -> libclntsh.so.11.1
© www.soinside.com 2019 - 2024. All rights reserved.