Re: Universal binary with x86_64 for 10.6 only
Re: Universal binary with x86_64 for 10.6 only
- Subject: Re: Universal binary with x86_64 for 10.6 only
- From: Clark Cox <email@hidden>
- Date: Wed, 20 Jan 2010 17:18:54 -0800
On Wed, Jan 20, 2010 at 4:41 PM, Steve Christensen <email@hidden> wrote:
> I seem to recall that the Leopard kernel is 64-bit
No, the Leopard kernel is not 64-bit. Additionally, whether or not the
kernel is 32- or 64-bit is irrelevant to whether or not a 32- or
64-bit user-space binary will launch.
> On Jan 20, 2010, at 2:41 PM, BJ Homer wrote:
>
> I'm building a command-line tool, and I want it to run 32-bit on Tiger and
> Leopard and 64-bit on Snow Leopard. I have set the Base SDK to be 10.4, with
> a conditional build setting on x86_64 for 10.6. I have done the same for the
> deployment target; 10.4 generally, 10.6 for x86_64.
> When I run the binary on Snow Leopard, it works fine. When I run it on
> Leopard, I get the following error:
>
> Dyld Error Message: unknown required load command 0x80000022
>
> I've used otool to inspect the binary. It appears that the unknown required
> load command is LC_DYLD_INFO_ONLY. On the Leopard machine, `otool -lv -arch
> x86_64 <binary>` shows the unknown command. Running the same command on Snow
> Leopard shows LC_DYLD_INFO_ONLY in the same place. So I've verified that I
> can identify it. When I run it with -arch i386, the command isn't there.
> This is what I expected; the x86_64 build is targeted for 10.6 only, so it's
> fine if SL-only load commands are present there.
> The problem: Running the binary from the command line on Leopard crashes. In
> the crash report it's apparent that it's attempting to run the x86_64
> version, even though that one has a deployment target of 10.6.
> I've found the LSMinimumSystemVersionByArchitecture key that can be put into
> an app bundle's Info.plist, but this is a flat file. I tried embedding the
> Info.plist inside the flat binary, but it didn't seem to make a difference.
AIUI, that should work
> Am I doing something wrong? I had thought that when running a universal
> binary, it would look through all the binaries and find the best choice that
> it can run. Since x86_64 is linked against the 10.6 SDK, I had thought it
> would pass over that and use the 10.5 SDK. Is this incorrect?
This was true between 10.4 and 10.5, because more drastic changes were
made in the binary file format (i.e. an x86_64 binary built with a
10.4 deployment target actually had a different architecture than one
built for 1.05 or later). However, there is no such difference between
10.5 and 10.6 binaries.
> Any ideas?
One possible idea, is to build your x86_64 slice with a 10.5
deployment target (so that it is runnable on 10.5 and will launch
without crashing), but check at runtime for the OS version. If the OS
version is less than 10.6, re-exec yourself as 32-bit.
--
Clark S. Cox III
email@hidden
_______________________________________________
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