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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: libtool; Reported by: "Daniel Richard G." <skunk@HIDDEN>; dated Wed, 17 Aug 2011 22:01:02 UTC; Maintainer for libtool is bug-libtool@HIDDEN.

Message received at 9316 <at> debbugs.gnu.org:


Received: (at 9316) by debbugs.gnu.org; 20 Aug 2011 14:05:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 20 10:05:51 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QumBJ-00040p-Ro
	for submit <at> debbugs.gnu.org; Sat, 20 Aug 2011 10:05:51 -0400
Received: from pogma.xen.prgmr.com ([68.68.97.8])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <peter@HIDDEN>) id 1Quch2-0005Do-HG
	for 9316 <at> debbugs.gnu.org; Fri, 19 Aug 2011 23:57:58 -0400
Received: from [10.0.0.48] (24-117-47-218.cpe.cableone.net [24.117.47.218])
	(using TLSv1 with cipher AES128-SHA (128/128 bits))
	(No client certificate requested)
	by pogma.xen.prgmr.com (Postfix) with ESMTP id 7FA8DBF5E2;
	Sat, 20 Aug 2011 03:55:46 +0000 (UTC)
X-DKIM: Sendmail DKIM Filter v2.8.3 pogma.xen.prgmr.com 7FA8DBF5E2
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=pogma.com; s=pogmail;
	t=1313812546; bh=G2U+Ev6gcrXmPmgejvHkvwM0Dkn1cC+OpzaPsXf4VIM=;
	h=References:In-Reply-To:Mime-Version:Content-Type:Message-Id:
	Content-Transfer-Encoding:Cc:From:Subject:Date:To;
	b=Kamn2Zp8kk+90UG6YaMchqQ3Sa/O8gaLjzJ2EFnDUih+KakwmA20clBLOJmEj10jm
	H2QnimQ78GQ9ekXqSVIl01wkAJqrroEsYZU07Ccngu8O841Z/fCVR886ZTbhVE5RxH
	7/84IszrCLLbJ5K6DjiwkFJIXUl4wMC5GGRFn2ks=
References: <1313618306.10853.140258130791573@HIDDEN>
In-Reply-To: <1313618306.10853.140258130791573@HIDDEN>
Mime-Version: 1.0 (Apple Message framework v1082)
Content-Type: text/plain; charset=us-ascii
Message-Id: <B421A6DB-DDF3-480C-AB36-BBDE9E675A79@HIDDEN>
Content-Transfer-Encoding: quoted-printable
From: Peter O'Gorman <peter@HIDDEN>
Subject: Re: bug#9316: AIX and JNI: *.so versus *.a
Date: Fri, 19 Aug 2011 22:55:45 -0500
To: Daniel Richard G. <skunk@HIDDEN>
X-Mailer: Apple Mail (2.1082)
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 9316
X-Mailman-Approved-At: Sat, 20 Aug 2011 10:05:48 -0400
Cc: 9316 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)


On Aug 17, 2011, at 4:58 PM, Daniel Richard G. wrote:

> Hello,
>=20
> I am using Libtool 2.4 to build Java JNI modules on AIX.

Hi,

If you add -Wl,-brtl to LDFLAGS at configure time, libtool will build =
plain .so's

Peter


>=20
> 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.
>=20
> When I go to use these JNI modules, however, the JRE makes very clear
> that it doesn't like .a files:
>=20
> 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)
>=20
> 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.
>=20
>=20
> --Daniel
>=20
>=20
> --=20
> NAME =3D Daniel Richard G.     _\|/_    Remember, skunks
> MAIL =3D skunk@HIDDEN     (/o|o\) _- don't smell bad---
> MAIL+=3D skunk@HIDDEN   < (^),>     it's the people who
> WWW  =3D (not there yet!)      /   \      annoy us that do!
>=20
>=20
>=20
> _______________________________________________
> Bug-libtool mailing list
> Bug-libtool@HIDDEN
> https://lists.gnu.org/mailman/listinfo/bug-libtool
>=20

--
Peter O'Gorman
http://pogma.com






Information forwarded to owner <at> debbugs.gnu.org, bug-libtool@HIDDEN:
bug#9316; Package libtool. Full text available.

Message received at 9316 <at> debbugs.gnu.org:


Received: (at 9316) by debbugs.gnu.org; 20 Aug 2011 04:25:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 20 00:25:30 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Qud7h-0007A2-Kf
	for submit <at> debbugs.gnu.org; Sat, 20 Aug 2011 00:25:30 -0400
Received: from out2.smtp.messagingengine.com ([66.111.4.26])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <skunk@HIDDEN>) id 1Qud7e-00079q-Fl
	for 9316 <at> debbugs.gnu.org; Sat, 20 Aug 2011 00:25:27 -0400
Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43])
	by gateway1.messagingengine.com (Postfix) with ESMTP id 93F9820C73;
	Sat, 20 Aug 2011 00:23:17 -0400 (EDT)
Received: from web2.messagingengine.com ([10.202.2.212])
	by compute3.internal (MEProxy); Sat, 20 Aug 2011 00:23:17 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=
	messagingengine.com; h=message-id:from:to:cc:mime-version
	:content-transfer-encoding:content-type:references:subject
	:in-reply-to:date; s=smtpout; bh=Bg0Mtb6IbbX1LkdZXiIyKzzLuWM=; b=
	oW9qL6ogcmWIjfasjicfVfzzX3BfvQ7We9W/wFOhD+7AQ9yVvvNSqW4jNrO47PC4
	UDeDP1BCz1j4D3zt7E1L1nCORhJcCYjlGkUkRs+DNeQ59nhIluNv1yj6ZRfJQzIa
	Vh7eqRO3n0p7cfU57uoQ2w9Dzle28ooe4ZuuJ/1Q5aY=
Received: by web2.messagingengine.com (Postfix, from userid 99)
	id 6BE5C32005D; Sat, 20 Aug 2011 00:23:17 -0400 (EDT)
Message-Id: <1313814197.23567.140258131704837@HIDDEN>
X-Sasl-Enc: q2ngQKRk/J44VYYh+Qw6cyefNTtwNLI24trCbCrtXe8Y 1313814197
From: "Daniel Richard G." <skunk@HIDDEN>
To: "Peter O'Gorman" <peter@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
X-Mailer: MessagingEngine.com Webmail Interface
References: <1313618306.10853.140258130791573@HIDDEN>
	<B421A6DB-DDF3-480C-AB36-BBDE9E675A79@HIDDEN>
Subject: Re: bug#9316: AIX and JNI: *.so versus *.a
In-Reply-To: <B421A6DB-DDF3-480C-AB36-BBDE9E675A79@HIDDEN>
Date: Sat, 20 Aug 2011 00:23:17 -0400
X-Spam-Score: -4.8 (----)
X-Debbugs-Envelope-To: 9316
Cc: 9316 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.8 (----)

On Fri, 2011 Aug 19 22:55-0500, Peter O'Gorman wrote:
>
> If you add -Wl,-brtl to LDFLAGS at configure time, libtool will build
> plain .so's

Interesting. This bit from doc/notes.txt in the Libtool source
distribution seems relevant:

   * On AIX there are two different styles of shared linking, one in
     which symbols are bound at link-time and one in which symbols are
     bound at runtime only, similar to ELF.  In case of doubt use
     `LDFLAGS=-Wl,-brtl' for the latter style.

Why isn't Libtool itself already adding this flag when -module is
specified?




Information forwarded to owner <at> debbugs.gnu.org, bug-libtool@HIDDEN:
bug#9316; Package libtool. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Aug 2011 22:00:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 17 18:00:33 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QtoA4-0001ej-BD
	for submit <at> debbugs.gnu.org; Wed, 17 Aug 2011 18:00:33 -0400
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <skunk@HIDDEN>) id 1QtoA0-0001c7-1i
	for submit <at> debbugs.gnu.org; Wed, 17 Aug 2011 18:00:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <skunk@HIDDEN>) id 1Qto87-0006dU-P7
	for submit <at> debbugs.gnu.org; Wed, 17 Aug 2011 17:58:32 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,
	T_DKIM_INVALID autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([140.186.70.17]:43783)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <skunk@HIDDEN>) id 1Qto87-0006dQ-Nh
	for submit <at> debbugs.gnu.org; Wed, 17 Aug 2011 17:58:31 -0400
Received: from eggs.gnu.org ([140.186.70.92]:56794)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <skunk@HIDDEN>) id 1Qto86-0001V1-Rx
	for bug-libtool@HIDDEN; Wed, 17 Aug 2011 17:58:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <skunk@HIDDEN>) id 1Qto85-0006d6-CR
	for bug-libtool@HIDDEN; Wed, 17 Aug 2011 17:58:30 -0400
Received: from out2.smtp.messagingengine.com ([66.111.4.26]:51790)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <skunk@HIDDEN>) id 1Qto85-0006cM-49
	for bug-libtool@HIDDEN; Wed, 17 Aug 2011 17:58:29 -0400
Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41])
	by gateway1.messagingengine.com (Postfix) with ESMTP id EB33921989
	for <bug-libtool@HIDDEN>; Wed, 17 Aug 2011 17:58:26 -0400 (EDT)
Received: from web2.messagingengine.com ([10.202.2.212])
	by compute1.internal (MEProxy); Wed, 17 Aug 2011 17:58:26 -0400
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=
	messagingengine.com; h=message-id:from:to:mime-version
	:content-transfer-encoding:content-type:subject:date; s=smtpout;
	bh=HaPD4OE5AWiqednAUiEFDfcypqo=; b=ZjJPNa1Ym1T/BP37kmLuIpDMNfyK
	zRpW0gnBwWxrgQ6laU6EQHN9gcPD4W4cR4EO7PkHUlKjjzREAKh/649xc5D4yzNU
	ItoCuUUOKBKqbSK9Glias1zwxHpiNVQ7+Aywnda4NMzBIf9ObnkVP2JxPDggU6Wl
	p5TLuvR88m3unwo=
Received: by web2.messagingengine.com (Postfix, from userid 99)
	id CB6433056EB; Wed, 17 Aug 2011 17:58:26 -0400 (EDT)
Message-Id: <1313618306.10853.140258130791573@HIDDEN>
X-Sasl-Enc: Kz0dDGnl61ssO8JtMjT9FZi0lGPcVpumLXN/ELMav0Ev 1313618306
From: "Daniel Richard G." <skunk@HIDDEN>
To: bug-libtool@HIDDEN
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
X-Mailer: MessagingEngine.com Webmail Interface
Subject: AIX and JNI: *.so versus *.a
Date: Wed, 17 Aug 2011 17:58:26 -0400
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 140.186.70.17
X-Spam-Score: -6.2 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.3 (------)

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@HIDDEN     (/o|o\) _- don't smell bad---
MAIL+= skunk@HIDDEN   < (^),>     it's the people who
WWW  = (not there yet!)      /   \      annoy us that do!




Acknowledgement sent to "Daniel Richard G." <skunk@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-libtool@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-libtool@HIDDEN:
bug#9316; Package libtool. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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