[习题29]解决:relocation R_X86_64_32

2018-12-28  本文已影响33人  AkuRinbu

问题解决

$ cc -shared -o libex29.so libex29.o
/usr/bin/ld: libex29.o: relocation R_X86_64_32 against `.rodata' 
can not be used when making a shared object; 
recompile with -fPIC
libex29.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
$ cc -fPIC -c libex29.c -o libex29.o
$ cc -shared -o libex29.so libex29.o

$ ls
dbg.h  ex29.c  libex29.c  libex29.o  libex29.so

参考资料

上一篇下一篇

猜你喜欢

热点阅读