2

I am trying to make 32 bit library on a 64 bit Ubuntu box. I am creating .so as follows

gcc - shared -Wl,-soname,libtest.so *.o

I am getting /usr/bin/ld : relocation R_X86_64_PC32 against symbol "set_bright' cann't be used when making shared object;recompile with -fPIC.

Already I tried compiling with -fPIC. It didn't work.

Please let me know if I need to use any flag while compilation .c or some flag while creating .so

thanks,

G G
  • 1,049
  • 4
  • 17
  • 26

1 Answers1

1

I believe you get that error if there you're calling a function declared as hidden, e.g.

int set_hidden(void) __attribute__((visibility("hidden")));

and it's not defined in the same shared object.

To solve it you have to also link the object file containing the definition of set_hidden, or remove the call to it.

Per Johansson
  • 6,697
  • 27
  • 34