While I was looking at setup.py, the default location for OS X also looked a bit dodgy. I asked about it on the Apple java-dev mailing list, and got back the attached reply.
I believe what he's saying is that you should always have the developer SDK installed to build on OS X, and you should reference the headers though that SDK rather than by looking in /System/Library/... I know I ran into trouble in 2009 trying to build pylucene on pre-release Snow Leopard, because the JNI headers were only in the SDK. Bill
--- Begin Message ---On Mar 19, 2010, at 9:23 PM, Bill Janssen wrote: > I'd like to be able to find the right JDK to use when compiling a JNI > extension. It seems that taking the output of "java_home 1.5+", and > trimming the last directory off of it works well, to get, for instance, > > /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0 > > Is this a good idea? No. There are no binaries that you may link against in the versioned JVM directories, so it is not appropriate to use headers from those directories either. > Or, would it be useful to add a new option to java_home, perhaps another > possible argument to the --task option, "Development"? > > Or, should I always use > /Developer/SDKs/System/Library/Frameworks/JavaVM.framework/Versions/XX/Headers > when compiling JNI code? Presumably at some point in the future, Apple might > like to introduce more of the JDK/JRE distinction, perhaps for the iPhone or > iPad? In which case jni.h might not be there at all without the developer > SDK. You should link against the JavaVM.framework and use the jni.h from the Mac OS X 10.x SDK. The only exception to this is to link directly against the JavaVM.framework on your system if you require new functionality that was provided in a Java software update, and not part of an actual SDK (though this case should be rare). Java is a core framework of Mac OS X, and the only public aperture into any JVM version from native code is through the JavaVM.framework. Regards, Mike Swingler Java Runtime Engineer Apple Inc.
--- End Message ---