こんにちは、私は jni ライブラリを構築しようとしています。ビルドは Windows では正常に動作していますが、Linux フェドラでは、このようなエラーがスローされるという問題に直面しています。
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbeginT.o: relocation R_X86_64_32 against `__DTOR_END__' can not be used when making a shared object; recompile with -fPIC
この方法でコードをコンパイルしています
gcc -o libTest.so -shared -I/usr/java/jdk1.6.0_18/include -I/usr/java/jdk1.6.0_18/include/linux arrayUtil.c -static -lc
誰が私が間違っているのか教えてもらえますか?
これは、JNI から呼び出したときのエラーです。
Instructions: (pc=0x00002aaaab22627a)
0x00002aaaab22626a: 00 00 48 8b 44 24 18 4d 8b 7e 68 48 8b 5c 24 18
0x00002aaaab22627a: 0f b6 10 48 0f be c2 41 f6 44 47 01 20 74 1c 48
Stack: [0x000000004012b000,0x000000004022c000], sp=0x000000004022a660, free space=3fd0000000000000018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0x3527a]
[error occurred during error reporting (printing native stack), id 0xb]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.utils.ArrayUtils.setup(Ljava/lang/String;)I+0
j com.utils.ArrayUtils.init(Ljava/lang/String;)V+245
j com.utils.ArrayUtils.main([Ljava/lang/String;)V+3
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x00002aaacff55000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5624, stack(0x0000000040832000,0x0000000040933000)]
0x00002aaacff52800 JavaThread "CompilerThread1" daemon [_thread_blocked, id=5623, stack(0x0000000040731000,0x0000000040832000)]
0x00002aaacff4d800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=5622, stack(0x0000000040630000,0x0000000040731000)]
0x00002aaacff4b800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5621, stack(0x000000004052f000,0x0000000040630000)]
0x00002aaacff28000 JavaThread "Finalizer" daemon [_thread_blocked, id=5620, stack(0x000000004042e000,0x000000004052f000)]
0x00002aaacff26000 JavaThread "Reference Handler" daemon [_thread_blocked, id=5619, stack(0x000000004032d000,0x000000004042e000)]
=>0x0000000040111800 JavaThread "main" [_thread_in_native, id=5617, stack(0x000000004012b000,0x000000004022c000)]
Other Threads:
0x00002aaacff21800 VMThread [stack: 0x000000004022c000,0x000000004032d000] [id=5618]
0x00002aaacff58000 WatcherThread [stack: 0x0000000040933000,0x0000000040a34000] [id=5625]