sateesh mohapatra
sateesh mohapatra

Reputation: 1

libraries not found error/ library path in makefile

I am compiling my code with

gcc  -o ./sample/createUsageXMLd ./obj/createUsageXML.o  -L../../../third_party/lib/openssl-fips/2.0/LSBGCC64 -L../../../third_party/lib/curl/7.45.0/LSBGCC64  -lssl -lcrypto

But I get error /

usr/bin/ld: warning: libssl.so.1.0.0, needed by ../../../third_party/lib/curl/7.45.0/LSBGCC64/libcurl.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by ../../../third_party/lib/curl/7.45.0/LSBGCC64/libcurl.so, not found (try using -rpath or -rpath-link)
../../../third_party/lib/curl/7.45.0/LSBGCC64/libcurl.so: undefined reference to `SSL_CTX_set_srp_username'
../../../third_party/lib/curl/7.45.0/LSBGCC64/libcurl.so: undefined reference to `SSL_CTX_set_srp_password'
collect2: error: ld returned 1 exit status

I have the following in my libraries third party folder

$ cd third_party/lib/openssl-fips/2.0/LSBGCC64/
$ ls
libcrypto.a  libcrypto.so  libcrypto.so.1.0.0  libssl.a  libssl.so  libssl.so.1.0.0

Upvotes: 0

Views: 1069

Answers (2)

sateesh mohapatra
sateesh mohapatra

Reputation: 1

I tried installing curl with yum install. I checked the version of installed curl.It was 7.29.0. My compilation was successful. Later I degraded the version of curl from 7.45.0 to 7.29.0 in third_party folder. Now it compiles fine

Upvotes: 0

Kushal Ramkumar
Kushal Ramkumar

Reputation: 53

You also need to provide the name of the library that you wish to link,

gcc file.c -o file -L/path/to/libs -llibname

In your case, try providing -lssl after including the path to your libraries (which you've done using -L). Note that the prefix "lib" and suffix ".so" are not required.

Upvotes: 1

Related Questions