autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Darwin universal binaries and LDFLAGS conundrum


From: Martin-Gilles Lavoie
Subject: Re: Darwin universal binaries and LDFLAGS conundrum
Date: Thu, 24 May 2007 14:16:41 -0400


On 23 mai 2007, at 10:03, Martin-Gilles Lavoie wrote:

[snip]

To resume the problem, I need to build a Universal Binary (aka, PPC + i386) library of BerkeleyDB. Now, normally, this is a simple task but it seems Autoconfig is working against me.

At the strict minimum, I need to have the following flags set in the generated makefile:

CFLAGS= -c $(CPPFLAGS) -O3 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -arch i386 -arch ppc
        LDFLAGS=        -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk

[snip]

This is just an update on the status of my problem for you guys to be curious at. At this moment, I'm waiting for some info from the BerkeleyDB guys (their autoconf environment in particular). There's not much you guys can act upon but some details I've uncovered recently might be of interest to some readers of this list.

I've learned a few things in the past few days as far as this thing is concerned. For one, Tiger and Leopard environment differ in significant ways; not that I didn't expect otherwise but the extent of the changes still surprised me.

Under Tiger, specifically on a PPC machine, one needs the -isysroot flag being passed to CFLAGS and LDFLAGS, targeting the 10.4u SDK because the base OS is not universal. Under Intel machines, all installed libraries are universal and the use of the 10.4u SDK is not required. In fact, passing the 10.4u SDK seems to confuse the compiler more than anything.

What's more, under Leopard, the PPC base OS is exactly like the Intel: universal.

Thus, I need to further tweak my .ac script with the following:

#       ...
        darwin8.*)
        LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk";;
#       ...
        case "$host_os" in
darwin8*) CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk - arch i386 -arch ppc";;
        darwin9*)       CFLAGS="$CFLAGS -arch i386 -arch ppc";;
        esac
#       ...

Disclaimer: the above would still require a tweak for Tiger-on-Intel build environments.

Autoconf requires the m4 macro tool (I didn't bother figuring out what it does--I'm lazy that way), but realized that he up-to-date version of m4 is 1.4.7 wich is required by autoconf to complete all tests and produce a complete-enough configure script as required by that berkeleyDB thing. Tiger (darwin8) ships with an antiquated m4, at version 1.4.1, while Leopard has 1.4.6.

Under Leopard, autoconf still wasn't able to produce me an adequate configure script given our .ac script. So, I'm enquiring about the environment under wich the BDB folks built their configure script.

So, a manually-tweaked configure (or Makefile) does (now) produce the required output on PPC-* or Intel-Leopard:

        blackhole:build_mac lavoie$ file .libs/libdb-4.5.a
        .libs/libdb-4.5.a: Mach-O universal binary with 2 architectures
.libs/libdb-4.5.a (for architecture i386): current ar archive random library .libs/libdb-4.5.a (for architecture ppc): current ar archive random library

I'll let you know when I have more details for your curiosity and your own respective projects, as I get them.

Martin-Gilles Lavoie | Senior software developer | 514.905.8658
Oracle - Macintosh Native Desktop Client, Beehive
600, boul. de Maisonneuve West, Suite 1900 | Montréal (Québec)  H3A 3J2






reply via email to

[Prev in Thread] Current Thread [Next in Thread]