site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hope this helps, Eric On May 5, 2006, at 1:12 PM, Kevin Van Vechten wrote: Yes, you can use the -arch argument with gcc or g++, i.e.: g++ -arch i386 -arch ppc -arch ppc64 ... Will build for all three architectures. For more details: <http://developer.apple.com/technotes/tn2005/tn2137.html> - Kevin On May 5, 2006, at 1:05 PM, Paul Archibald wrote: Here is part of my makefile: _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Specifically, you'll want to pass the -arch flags and -isysroot to the compiler, like this: $(TARGET): $(OBJECTS) g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk - o $@ -dynamiclib -install_name $(DESTDIR)/$@ $^ strip -x $@ %.o: %.cpp g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk - c -O2 -o $@ $^ -I /System/Library/Frameworks/JavaVM.framework/Headers You'll need to be sure to build on a system with universal libraries so the link phase will succeed. I don't know whether they encompass JNI, but usually you'll want to use the 10.4u.SDK <http://developer.apple.com/opensource/ buildingopensourceuniversal.html> Our Java app uses a JNI lib for mathematical calculations. We build the JNI with GCC with a makefile. Since we entering the IntelMac age, we need to target our JNIs to both the i86 and PPC architectures. I am doing it now by building the i86 JNI on an intelMini, and the PPC JNI on my PPC powerbook. My question is this: can I build for a different architecture than that of the machine doing the compiling? I would like to be able to build both the PPC and i86 libs on whatever machine I have handy. Is there a g++ option to force which architecture is output? I am not very experienced with makefiles. $(TARGET): $(OBJECTS) g++ -o $@ -dynamiclib -install_name $(DESTDIR)/$@ $^ strip -x $@ %.o: %.cpp g++ -c -O2 -o $@ $^ -I /System/Library/Frameworks/ JavaVM.framework/Headers This email sent to site_archiver@lists.apple.com