Re: Building a library using as universal for 10.3.9 ppc from an Intel build box
Re: Building a library using as universal for 10.3.9 ppc from an Intel build box
- Subject: Re: Building a library using as universal for 10.3.9 ppc from an Intel build box
- From: Greg Guerin <email@hidden>
- Date: Thu, 20 Jul 2006 11:57:36 -0700
rohit dhamija wrote:
>ARCHS = ppc i386
>SDKROOT =
>MACOSX_DEPLOYMENT_TARGET =
>GCC_VERSION_i386 = 4.0
>GCC_VERSION_ppc = 3.3
>MACOSX_DEPLOYMENT_TARGET_i386 = 10.4
>MACOSX_DEPLOYMENT_TARGET_ppc = 10.3
>SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk/
>SDKROOT_ppc = /Developer/SDKs/MacOSX10.3.9.sdk/
If the unadorned SDKROOT or MACOSX_DEPLOYMENT_TARGET is empty, then I think
some of the production tools (compiler, linker, whatever) may assume you're
building for the current host target only. On a PPC machine, that would be
PPC; on a Intel-based machine, that would be i386. I don't know which
tools do this, but see story below.
On Intel-based machines, most frameworks and libraries are universal, so
Rosetta'ed apps can run, but this can cause things to link that you had
hoped would fail. The reason is that the linker matches architectures, so
it will link a PPC object with the PPC version of what's on the Intel-based
host. That isn't necessarily the same as the PPC version of the framework
or lib that's on the PPC-based host.
I have a different approach for setting up my SDK and target values. I set
all the base values to the oldest PPC target I'm compiling for, then I
override those only with i386 versions. For example, using your list of
variables, I would set it up like this:
ARCHS = ppc i386
SDKROOT = /Developer/SDKs/MacOSX10.3.9.sdk/
MACOSX_DEPLOYMENT_TARGET = 10.3
GCC_VERSION = 3.3
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk/
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4
GCC_VERSION_i386 = 4.0
I don't remember exactly when I started doing this, but I vaguely recall
that it was a situation similar to what you have. That is, I wanted a lib
for i386 to target 10.4, but for ppc to target earlier. I thought I had
set all the variables correctly for both archs, but the PPC version
inevitably failed when run on 10.3. So in the process of starting the
project-file over, I decided to get a ppc build running on 10.3 FIRST.
This was most easily done by setting the base variables, not the "_ppc"
ones. The reason is obvious: you only define one set of variables, not two
(base plus "_ppc" overrides). With that working, I then changed archs to
ppc+i386, and also changed the minimum number of "_i386" variables to get
the Universal build working. Any that I missed would cause a link or
compile error, because i386 code would be linking or compiling against the
10.3 PPC SDK versions, NOT the current local-host versions. This was all
done on Xcode 2.2.1.
I have never figured out what was wrong with my first attempt, but I'm no
expert in how Xcode works internally, so an answer may be blindingly
obvious to someone who is. Since then, I have used this same strategy in
other universal builds, and it's always worked. That is, I define the base
variables to indicate the oldest PPC target I want, and only override these
bases with a few "_i386" definitions.
I don't know if this will work for static libs or not, but it's pretty easy
to set up a project this way, so it may be worth trying. I've also been
down the road of separate per-arch targets combined with a separate lipo
target, and I assure you this strategy is far simpler to set up and manage.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden