dimanche 23 août 2015

Errors when linking libsodium.a into a Shared Object

I am trying to use the libsodium library in a C++ project and I'm having difficulty with linking the static Libsodium Library into a Shared Object that I've created. This project is being compiled using G++ and is set to use C++11 Standards.

After reading various forum posts about linking a Static Library into a Shared Object, I've tried using the Whole Archive which seems to get me further but still will not link in correctly.

The following is the Command being used to link:

/usr/bin/g++ -shared -fPIC -o ./Debug/libwowcrypt.so @"libwowcrypt.txt" -L. -L../SharedLibraries/Sodium/lib   -Wl,--whole-archive -lsodium -Wl,--no-whole-archive

The following error messages are returned from ld:

/usr/bin/ld: ../SharedLibraries/Sodium/lib/libsodium.a(libsodium_la-hmac_hmacsha256.o): relocation R_X86_64_PC32 against symbol `crypto_auth_hmacsha256_init' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

Can anyone advise on the correct linker flags that are needed to incorporate this static library into my shared object?

Aucun commentaire:

Enregistrer un commentaire