GNU bug report logs - #9316
AIX and JNI: *.so versus *.a

Previous Next

Package: libtool;

Reported by: "Daniel Richard G." <skunk <at> iSKUNK.ORG>

Date: Wed, 17 Aug 2011 22:01:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: "Daniel Richard G." <skunk <at> iSKUNK.ORG>
To: 9316 <at> debbugs.gnu.org
Subject: bug#9316: AIX and JNI: *.so versus *.a
Date: Wed, 17 Aug 2011 17:58:26 -0400
Hello,

I am using Libtool 2.4 to build Java JNI modules on AIX.

I've noticed that on AIX, a shared library is initially built as an .so
file via "gcc -shared", but then this .so is packed up into an .a file
using ar(1). This is the case even if -export-dynamic -module is
specified.

When I go to use these JNI modules, however, the JRE makes very clear
that it doesn't like .a files:

Exception in thread "main" java.lang.UnsatisfiedLinkError: jni_test (    0509-022 Cannot load module /tmp/jni/libjni_test.a.
        0509-103   The module has an invalid magic number.)
        at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:994)
        at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:958)
        at java.lang.System.loadLibrary(System.java:453)
        at com.example.jnitest.JniTest.<clinit>(JniTest.java:21)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
        at JniTest.main(JniTest.java:56)

If I extract the .so files from the .a files, however, the JRE happily
uses those. Currently, I am using an install-exec-hook rule to perform
this step during "make install". There does not appear to be a Libtool
option to skip the use of ar(1), which would be a preferable approach.


--Daniel


-- 
NAME = Daniel Richard G.     _\|/_    Remember, skunks
MAIL = skunk <at> iSKUNK.ORG     (/o|o\) _- don't smell bad---
MAIL+= skunk <at> alum.MIT.EDU   < (^),>     it's the people who
WWW  = (not there yet!)      /   \      annoy us that do!




This bug report was last modified 14 years and 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.