shared library relocation R_X86_64_PC32 error

梦想的初衷 提交于 2019-12-24 05:56:41

问题


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,


回答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.



来源:https://stackoverflow.com/questions/9728213/shared-library-relocation-r-x86-64-pc32-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!