No announcement yet.

Cannot link SYSV static lib with GNU/Linux

  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot link SYSV static lib with GNU/Linux

    I want to link to some external static lib, let's say somelib. I'm trying to do this by FIND_LIBRARY in cmake and it seems to work ok - cmake finds libsomelib.a but there is a problem with linking:

    (somelib.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

    I'm sure somelib is compiled with PIC enabled. Some interesting things: file somelib.o shows FpgaPicAPI.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped and here's the file output of one of my project's object file: ELF 64-bit LSB relocatable, x86-64, version 1 (GNU/Linux), not stripped. As far as I know, SYSV means "this object file does not use any OS-specific features" but can I link such object files with different OS/ABI? The second thing is compiler version: somelib uses gcc 5.4.0 and I have to use 4.8.5 but I believe it's not the problem - Ive got side project using somelib and it works okay with gcc 4.8 (executable becames SYSV btw). No idea what to check next.

  • #2
    any of my known methods of determining PIC presance works, but the authors of this lib are sure that this is PIC version. They gave me libfpga.a and libfpgapic.a files. I think it's safe to assume that it's not the problem here. I googled this "relocation against" and solutions were really weird - no file found, no symlink, no PIC and much more.