One for the Mac Rumor Mill

by James Duncan Davidson

If you've pulled down the latest J2SE 5.0 Release 3 via Software Update on Mac OS X Tiger, execute the following command in the Terminal:

$ lipo -info /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java

If you do this you'll see the following output:

Architectures in the fat file: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java are: i386 ppc

A bit of translation: Apple's latest update to Java is a Universal Binary. Interesting, no?


2005-11-17 14:05:33
Infinity plus 1!

Now the 'write once, run anywhere' code that I write can run, um, anywhere plus 1... or something.

2005-11-17 14:36:43
Xcode 2.2 is Also Universal
$ lipo -info `which gcc`
Architectures in the fat file: /usr/bin/gcc are: i386 ppc
2005-11-17 14:39:51
But of course! :)
Java has been running on intel for a looong time now.

For a really good read, check out Greg Bolsinga (who used to work on the mrj team) talking about it this past summer:

"A few years later I was extra-disclosed and had to sign a NDA (Non-Disclosure Agreement) on the Intel builds. This is when I learned that the Intel builds didn't just compile and link. They actually ran, and they ran fast! I hadn't seen java run so fast on Mac OS X before, on any hardware."

There's lots of other great stuff in that post about Metrowerks as well (he worked for them before working at Apple).

2005-11-17 15:14:53
Indeed. Evidently the whole system is up and going and has been for a while. What's interesting to me is that software coming out of Apple now is starting to ship as Universal instead of PPC-only as has been the practice up to this point.

Thanks for the link--that was a great read!

2005-11-17 16:47:47
More than just Java
In 10.4.3:

$ find /bin /usr/bin | wc -l
$ find /bin /usr/bin -exec lipo -info '{}' \; 2>/dev/null | grep i386 | wc -l

It's still only about 1/6 of the binaries, but obviously Apple's doing lots of fat binary builds, even for command-line tools.

2005-11-17 17:56:34
More than just Java

This is pretty interesting. Doing some more finds on my powerbook running 10.4.3, I've seen a lot more i386 fat binaries than I have ppc64. Is this also the case on G5 systems?

I see

$ find /System/Library/Frameworks -type f -perm +=x -exec lipo -info {} \; 2>/dev/null | egrep -v '^Non-fat' | egrep -c ppc64
$ find /System/Library/Frameworks -type f -perm +=x -exec lipo -info {} \; 2>/dev/null | egrep -v '^Non-fat' | egrep -c i386
$ find /System/Library/Frameworks -type f -perm +=x -exec lipo -info {} \; 2>/dev/null | egrep -c '^Non-fat'


$ find /Developer -type f -perm +=x -exec lipo -info {} \; 2>/dev/null | egrep -v '^Non-fat' | egrep -c ppc64
$ find /Developer -type f -perm +=x -exec lipo -info {} \; 2>/dev/null | egrep -v '^Non-fat' | egrep -c i386
$ find /Developer -type f -perm +=x -exec lipo -info {} \; 2>/dev/null | egrep -c '^Non-fat'

It'll be even more surprising when we do the same investigation and start seeing em64t or amd64.