[MINC-users] dyld errors

Rick Hoge r.hoge at umontreal.ca
Fri Mar 6 08:54:00 EST 2009


Hi guys,

Some info on Mac architectures:

Apple hasn't sold a 32-bit processor in quite a while now - if you are  
running a recent (since late 2007) Mac Pro, MacBook, MacBook Pro,  
iMac, Mac Mini or whatever it will be a 64-bit processor (the only 32- 
bit Mac processor shipping now is the ARM in the iPhone).  If "About  
this Mac" says you have a Core 2 Duo, it is 64-bit processor (Note  
that if it just says 'Core Duo' it's 32-bit).

Build a "Hello World" program for x86_64 on a low-end MacBook and it  
will happily report that sizeof(void*) is 8, even though file / 
mach_kernel says

/mach_kernel: Mach-O universal binary with 2 architectures
/mach_kernel (for architecture i386):	Mach-O executable i386
/mach_kernel (for architecture ppc):	Mach-O executable ppc

and uname -a gives

Darwin Rick-MBP.local 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24  
17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386

Confusion often arises from the fact that, in MacOSX 10.5, the  
*kernel* is the 32-bit i386 architecture, but it will happily run both  
i386 and x86_64 binaries (and ppc binaries for that matter, via  
Rosetta).   The kernel does *not* need to be 64-bit for x86_64 apps to  
run. The inverse is not true - you can't run an x86_64 executable on a  
32-bit "Core Duo" processor (the first Intel MacBooks).

Recent 10.6 seeds have the 64-bit kernel enabled for some  
configurations (most systems that have shipped since early 2008).   
Rosetta will also probably be optional under 10.6 (which may or may  
not drop PPC support).

In the Mac software world, you just build a 4-way fat binary (packaged  
with lipo) and the 'most natural' architecture is loaded at launch  
time. For cross-platform Unix software, the safest and easiest thing  
is often to build for a single arch but obviously you need to make  
sure that all libraries linked provide that architecture.

Hope this helps - uname is not always a reliable way to get the full  
details on the architecture (in this case it happens to give the  
lowest common denominator that will run natively on the system).

For some more information, see

http://developer.apple.com/DOCUMENTATION/Darwin/Conceptual/64bitPorting/indications/chapter_2_section_2.html#/ 
/apple_ref/doc/uid/TP40001064-CH206-DontLinkElementID_21

The only thing that's missing is an answer to the question "how can I  
tell if my processor is 64-bit".  I can't find any command-line  
utility (uname, arch, machine, etc.) that will generate an x86_64  
output on my MacBook Pro (on which I'm developing and running all  
kinds of 64-bit stuff).

Cheers,

Rick

> jween:~ jween$ uname -a
> Darwin jween.local 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24
> 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386
> jween:~ jween$ sw_vers
> ProductName:	Mac OS X
> ProductVersion:	10.5.6
> BuildVersion:	9G55
>
> I find it a bit odd, but have not seen anywhere in my browsing how to
> change these settings to indicate that your native architecture is
> x86_64 but i'm betting it has an impact when you just naively compile
> things and don't deliberately set parameters to "cross-platform"
> compile.




More information about the MINC-users mailing list