views:

112

answers:

1

Hi Everyone,
I have an Java applet that loads native code through JNI. Everything worked just fine until I made the upgrade to Snow Leopard, and then Safari decided to be dumb. It turns out Safari will only load 64 bit binaries when in 64 bit mode. (You can put it in 32 bit mode, but that is not an option.) I changed my build system (g++) to support building a universal binary instead of a single 32 bit binary. I have successfully created a universal binary, but when I try and load it into my applet, I get an unsatisfied link exception saying that there is not a suitable image found and it cannot map it. Has anyone dealt with this before?

For extra info... When I typed in 'file native.dylib' in Terminal, the original 32 binary came out as:
Mach-O dynamically linked shared library i386

And when I did the same for the universal binary, it came out as:
native.dylib: Mach-O universal binary with 2 architectures
native.dylib (for architecture i386): Mach-O object i386
native.dylib (for architecture x86_64): Mach-O 64-bit object x86_64

A: 

I found out what I had done that was making things not work. In changing things around in all the Makefiles (which there were about 10), I was not creating the .a's correctly. I had some weird way that built each arch version of the source individually and then lipo'ed them together. I realize now that that was dumb on my part, but you live and learn.... Anyway, I determined that by using libtool instead of doing all that helped a lot. Instead of building all the archs separately, I passed multiple arch flags to g++ and merged them together with libtool.

Robbie