Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiling JNI library for PPC and Intel hardware?



you have to use lipo tool to glue ppc and i386 together
(see man lipo)



so you have to call gcc compiler twice
one time  for ppc (-arch ppc)
and one time for i386 (-arch i386)

hope it will help

On Nov 7, 2006, at 1:53 PM, Rob Ross wrote:

I've read technote 1295 (http://developer.apple.com/qa/qa2005/ qa1295.html) and http://developer.apple.com/java/jniuniversal.html (building a JNI Universal application), but I'm still having trouble creating a jni library that works on both PPC and Intel hardware.

I don't actually have an intel machine, so that makes debugging more difficult for me. But I have created a jni library in the JDIC project which implements the TrayIcon API for Mac OS, and it works great on my G4 machine.

However, it gives an UnsatisfiedLinkError when run on an Intel box.

My jni library is composed of 6 source files, and I am compiling them via a shell script that is invoked via an ant task. The contents of the shell script are simply:

gcc -std=gnu99 -c -arch i386 -arch ppc -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -I/System/Library/Frameworks/JavaVM.framework/ Headers -I/System/Library/Frameworks/Cocoa.framework/Headers *.m

gcc -dynamiclib -o ../libtray.jnilib *.o -framework JavaVM - framework Cocoa


Am I missing something?

Thanks,


Rob Ross, Lead Software Engineer
E! Networks
---------------------------------------------------
"Beware of he who would deny you access to information, for in his heart he dreams himself your master." -- Commissioner Pravin Lal




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

Dmitry Markman

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >compiling JNI library for PPC and Intel hardware? (From: Rob Ross <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.