开发者

g++ -lcurl says its not found, but I can see it in ldconfig -p

开发者 https://www.devze.com 2023-02-05 07:43 出处:网络
I am trying to build some software on a brand new install of CentOS 5.5 My compile line is : g++ -I ../common/ -I ../readers/ -I ../writers/ -I /home/dcole/software/xerces-c-3.1.1/src -O3 -Wall -fo

I am trying to build some software on a brand new install of CentOS 5.5

My compile line is :

 g++ -I ../common/ -I ../readers/ -I ../writers/ -I /home/dcole/software/xerces-c-3.1.1/src -O3 -Wall -fopenmp -fPIC -o chipper chipper.cpp  -L/usr/lib64/ ../../lib/IDT.a ../../lib/Linux/libxerces-c.a -lcurl -lidn -ldl -lssl ../../lib/Linux/libfftw3f.a  -lpthread -lm

and I am getting

[exec] /usr/bin/ld: cannot find -lcurl
 [exec] collect2: ld returned 1 exit status

Even though I can actu开发者_C百科ally see the lib

$ /sbin/ldconfig -p | grep curl
        libcurl.so.3 (libc6,x86-64) => /usr/lib64/libcurl.so.3
        libcurl.so.3 (libc6) => /usr/lib/libcurl.so.3

So why cant g++ see it?


At link time, -lcurl tells the linker to look for libcurl.so.

From there, the SONAME within the library (libcurl.so.3) is embedded into the executable, and that's the filename that is searched for when executing.

You have libcurl.so.3 but may be lacking libcurl.so, which is needed for development.

What is your distribution? Usually there will be a second package with development headers/libraries, separate from the runtime bits.


Copy the file from any source /usr/lib/libcurl.so and place it in /usr/lib/, then try to compile. It will work out.

0

精彩评论

暂无评论...
验证码 换一张
取 消