From: Dave Korn <dave.korn.cygwin@googlemail.com>
To: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>,
Dave Korn <dave.korn.cygwin@googlemail.com>,
java@gcc.gnu.org, gcc@gcc.gnu.org
Subject: Re: [JAVA,libtool] Big libjava is biiiig.
Date: Mon, 11 May 2009 17:14:00 -0000 [thread overview]
Message-ID: <4A085FAA.6060507@gmail.com> (raw)
In-Reply-To: <20090507214936.GB18769@gmx.de>
Ralf Wildenhues wrote:
> * Dave Korn wrote on Wed, May 06, 2009 at 07:08:17PM CEST:
>> Ralf Wildenhues wrote:
>>> I don't yet see why you would need any kind of libtool hacking.
>> Because of this:
>>
>>> You also have to ensure that the sub libraries are self-contained, or at
>>> least their interdependencies form a directed non-cyclic graph (or you
>>> will need very ugly hacks on w32).
>> I fully expect there to be cyclic interdependencies, which I could resolve
>> by building import libs first with dlltool. I'm not sure yet whether to do
>> this in libtool, but it occurred to me as one possibility.
>
> If you could show the commands that would be needed without libtool,
> then it would be easier for me to understand how libtool could help.
> Of course, the more generally usable the approach, the better.
Ok, so what I have is a big bunch of objects, that would normally be linked
together to make a single DLL, with all interdependencies resolved internally
and no undefined references:
g++ -shared a1.o a2.o a3.o b1.o b2.o b3.o c1.o c2.o c3.o \
-o cygexample.dll -Wl,--out-implb libexample.dll.a
What I instead want to do is partition the objects into (for example) three
separate sublibraries:
g++ -shared a1.o a2.o a3.o \
-o cygexample-a.dll -Wl,--out-implb libexample-a.dll.a
g++ -shared b1.o b2.o b3.o \
-o cygexample-b.dll -Wl,--out-implb libexample-b.dll.a
g++ -shared c1.o c2.o c3.o \
-o cygexample-c.dll -Wl,--out-implb libexample-c.dll.a
That won't work as-is because of the interdependencies; we can assume any of
the a/b/c objects may refer to any of the others. So we need to do:
g++ -shared a1.o a2.o a3.o -lexample-b -lexample-c \
-o cygexample-a.dll -Wl,--out-implb libexample-a.dll.a
g++ -shared b1.o b2.o b3.o -lexample-a -lexample-c \
-o cygexample-b.dll -Wl,--out-implb libexample-b.dll.a
g++ -shared c1.o c2.o c3.o -lexample-a -lexample-b \
-o cygexample-c.dll -Wl,--out-implb libexample-c.dll.a
... but as the import libs libexample-*.dll.a are generated as side-effects of
the link that builds the DLLs, they aren't available in time. So we have to
use dlltool first to generate import libs ahead of final-link time (without
attmepting to build a complete DLL):
dlltool a1.o a2.o a3.o -D cygexample-a.dll -e libexample-a.dll.a
dlltool b1.o b2.o b3.o -D cygexample-b.dll -e libexample-b.dll.a
dlltool c1.o c2.o c3.o -D cygexample-c.dll -e libexample-c.dll.a
g++ -shared a1.o a2.o a3.o -lexample-b -lexample-c \
-o cygexample-a.dll
g++ -shared b1.o b2.o b3.o -lexample-a -lexample-c \
-o cygexample-b.dll
g++ -shared c1.o c2.o c3.o -lexample-a -lexample-b \
-o cygexample-c.dll
>> Another approach
>> would have been to do it in the Makefile, by first building the sub-DLLs all
>> linked against the monolithic libjava DLL, then rebuilding them all but this
>> time linking against their own import libs generated in the previous step; it
>> occurred to me that even this might need a little help from libtool.
>
> I agree that this sounds a bit awkward.
True, but I'm not sure how well the libtool way-of-doing-things will adapt
to building in two stages. It might be simplest just to invoke dlltool from
the libjava makefile to get the import libs built first, and feed them as
ready-made inputs to bog-standard libtool invocation, do you think? I think I
might give that approach a try.
cheers,
DaveK
next prev parent reply other threads:[~2009-05-11 17:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4A01B55C.6060700@gmail.com>
2009-05-06 15:58 ` Dave Korn
2009-05-06 16:15 ` Ralf Wildenhues
2009-05-06 16:27 ` David Daney
2009-05-06 16:31 ` Richard Guenther
2009-05-06 16:40 ` Andrew Haley
2009-08-22 13:24 ` Dave Korn
2009-08-22 16:33 ` Andrew Haley
2009-08-22 18:55 ` Dave Korn
2009-08-28 18:04 ` Tom Tromey
2009-08-28 18:16 ` David Daney
2009-08-28 19:56 ` Dave Korn
2009-05-06 16:57 ` Dave Korn
2009-05-07 21:49 ` Ralf Wildenhues
2009-05-11 17:14 ` Dave Korn [this message]
2009-05-11 17:26 ` Andrew Haley
2009-05-11 18:03 ` Dave Korn
2009-05-13 12:38 ` Dave Korn
2009-05-13 16:18 ` Andrew Haley
2009-05-13 17:59 ` Dave Korn
2009-05-13 15:39 ` Dave Korn
2009-05-06 16:39 ` Andrew Haley
2009-05-06 16:45 ` Dave Korn
2009-05-06 17:12 ` Andrew Haley
2009-05-11 17:33 ` Dave Korn
2009-05-11 17:39 ` Andrew Haley
[not found] ` <7230133d0905060959h5371a608nff03cce1e1e98f47@mail.gmail.com>
2009-05-06 17:08 ` Dave Korn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A085FAA.6060507@gmail.com \
--to=dave.korn.cygwin@googlemail.com \
--cc=Ralf.Wildenhues@gmx.de \
--cc=gcc@gcc.gnu.org \
--cc=java@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).