1

I am getting this error everytime I run make.If I copy libsrt.so from another directory,then it gets compiled. Anyone has idea?

Linking CXX shared library libsrt.so
/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(aes_misc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/srt.dir/build.make:763: recipe for target 'libsrt.so.1.2.0' failed
Domso
  • 970
  • 1
  • 10
  • 22

2 Answers2

1

what the error message is telling you is that the linking of libsrt.so failed because you tried to link libsrt.so with libcrypto.a but libcrypto.a wasn't complied with -fPIC.

-fPIC is a complier flag that changes the code generation to production position indepandent code (PIC) which is required for shared object because the linker doesn't know where the shared object will be loaded.

to fix this issue you can:

  • recomplie libcrypto.a with -fPIC if you complied it yourself
  • use the shared object of libcrypto libcrypto.so if you received compiled binairies

in your case libcrypto being part of openssl using libcrypto.so is much better

Tyker
  • 2,971
  • 9
  • 21
0

You need to build a shared version of libcrypto - libcrypto.so. And link against that (the linker does that automatically when .so is present).

Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271