Relocation R_X86_64_32S against `.rodata' … While compiling on 64-bit platform

前端 未结 6 1642
轮回少年
轮回少年 2020-12-28 14:36

So I\'ve been coding something on 32-bit and yesterday I needed to build a dll and I had a couple of problems with that. Anyway I solved them here.

Unfortunately eve

6条回答
  •  囚心锁ツ
    2020-12-28 14:59

    I also meet this problem. As I try using @Mare and @user2391685 said, it can work well :

    Using -fPIC when comepile to .o file : For example:

    gcc -Wall -fPIC -c hello.c -I./ -I/usr/lib/jvm/java/include/ -I/usr/lib/jvm/java/include/linux/
    

    Then you can build a .so file :

    gcc -Wall -rdynamic -shared -o libhello.so hello.o Main.h -I/usr/lib/jvm/java/include/ -I/usr/lib/jvm/java/include/linux/
    

提交回复
热议问题