Madrugada
Madrugada

Reputation: 1289

Shared library not found

I am running Ubuntu 10.10 and a C program that uses a shared library libcrypto.so When compiling it, though I have a Makefile that has the option -lcrypto, I get this message:

/usr/bin/ld: skipping incompatible ./libcrypto.so when searching for -lcrypto
/usr/bin/ld: cannot find -lcrypto

I did export the current directory before by doing:

export LD_LIBRARY_PATH=D_LIBRARY_PATH:.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.

So what is wrong with my library and what can I do?

Upvotes: 2

Views: 2655

Answers (2)

Jonathan Leffler
Jonathan Leffler

Reputation: 753455

The first error message probably indicates that you have a 64-bit library but are doing a 32-bit compilation, or a 32-bit library but are doing a 64-bit compilation.

Run file libcrypto.so to see what type it is, then adjust your build (restart - remove all the object files) with either the option '-m32' or '-m64' to get the write build mode. If you can't work out how else to get that into the makefile, use:

make CC="gcc -m32" CXX="g++ -m32"

(or the 64-bit version if that's what you're after).

Upvotes: 2

lindelof
lindelof

Reputation: 35240

Could you post the output of this:

$ file ./libcrypto.so

And check that it is the right version for your machine? (I.e. 32 vs 64 bit, etc?)

Upvotes: 2

Related Questions