Compilation sous Linux fedora 10 x86-64
Bonjour,
Voila mon problème. Je travail en Jni et je ne comprends pas mon erreur: lorsque je crée la librairie "libTestJni.so" a partir de "TestJni.o" avec cette commande:
$ gcc -shared -o libTestJni.so -lcwiimote -lbluetooth -lm -I/usr/include/libcwiimote TestJni.o
L'erreur suivante apparait:
/usr/bin/ld: TestJni.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
TestJni.o: could not read symbols: Bad value
collect2: ld a retourné 1 code d'état d'exécution
J'essaye alors cette compilation:
$ gcc -fPIC -o libTestJni.so -lcwiimote -lbluetooth -lm -I/usr/include/libcwiimote TestJni.o
mais sans succes :
/usr/lib/gcc/x86_64-redhat-linux/4.3.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld a retourné 1 code d'état d'exécution
Pouvez-vous m'aider a comprendre mon erreur svp? Merci d'avance.
Voila mon problème. Je travail en Jni et je ne comprends pas mon erreur: lorsque je crée la librairie "libTestJni.so" a partir de "TestJni.o" avec cette commande:
$ gcc -shared -o libTestJni.so -lcwiimote -lbluetooth -lm -I/usr/include/libcwiimote TestJni.o
L'erreur suivante apparait:
/usr/bin/ld: TestJni.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
TestJni.o: could not read symbols: Bad value
collect2: ld a retourné 1 code d'état d'exécution
J'essaye alors cette compilation:
$ gcc -fPIC -o libTestJni.so -lcwiimote -lbluetooth -lm -I/usr/include/libcwiimote TestJni.o
mais sans succes :
/usr/lib/gcc/x86_64-redhat-linux/4.3.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld a retourné 1 code d'état d'exécution
Pouvez-vous m'aider a comprendre mon erreur svp? Merci d'avance.
Configuration: Linux Fedora Firefox 3.0.5
1 réponse
-
Contributeuril te dit de rajouter l'option -fPIC, pas de remplacer -shared. Et de plus, il dit de recompiler !
Je ne suis pas sur que cette option fasse ce que tu as envie de faire, regarde le man.
Je ne comprends pas le terme de relocation. Cherche R_X86_64_32 dans le source pour voir où est le souci.