UnsatisfiedLinkError (gxx and gcj) with JNI and C++ but not C
Andrew Richardson
a.chardson@gmail.com
Sun Feb 27 19:07:00 GMT 2011
Either Ubuntu 10.10 (or my personal standard package list -- I just installed 10.10 today) already comes with libstdc++6-4.4-dev. Just for fun, I installed libstdc++6-4.5-dev. I also grabbed libgcj11-dev, but I get the same error. Here's the output of the makefile:
[exec] javah -classpath ../../parallelsurf.jar -jni parallelsurf.ParallelSURF
[exec] g++ -Wall -lstdc++ -shared -O2 -c -fPIC -D_REENTRANT parallelsurf_jni.cpp -I/usr/lib/jvm/java-6-openjdk/include/
[exec] ld -l stdc++ --shared parallelsurf_jni.o -o libparallelsurf.so
I can confirm that /usr/lib/gcc/x86_64-linux-gnu/4.5/ contains libstdc++.a and (in /usr/lib). There's also a symlink there (libstdc++.so --> /usr/lib/libstdc++.so.6). Since ld couldn't find libstdc++.so, I thought it might not know about this directory and might not know about other important bits there. I added it to the search path for ld (-L /usr/lib/gcc/...) and built again. No improvement (still __gcj_personality_v0)
If you want the output of any diagnostic commands, just let me know.
One note: I'm using openjdk, not the Sun jdk
-Andrew
On Feb 27, 2011, at 1:10 PM, Jonathan Wakely wrote:
> On 27 February 2011 18:09, Jonathan Wakely wrote:
>> On 27 February 2011 17:35, Andrew Richardson wrote:
>>> Good observation. I added '-l stdc++' to the ld call. I also had to add a symlink in /usr/lib (it only contained libstdc++.so.6 and libstdc++.so.6.14. I added libstdc++.so --> libstdc++.so.6)
>>
>> The missing symlink implies you haven't installed the right packages,
>> on my Fedora system it would be provided by libstdc++-devel, which
>> also installs libsupc++.a and other C++ runtime files.
>>
>
> I don't know which library provides the gcj_personality routines, but
> you might want the equivalent of libgcj-devel as well
More information about the Gcc-help
mailing list