Saturday, June 18, 2011

Where the heck is “jni.h” on OSX?

I’ve been trying to get tinyos to run on my snow leopard machine (10.6.5) and got hit with a rather unexpected error message…


g++ -O2 -bundle "-I/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers" \
-o libtoscomm.jnilib NativeSerial_darwin.cpp
In file included from NativeSerial_darwin.cpp:521:
TOSComm_wrap.cxx:32:17: error: jni.h: No such file or directory



Thinking this must’ve been a mistake, I even rebuilt everything from scratch (thought it was a missing environment variable or something). But no, to my surprise “jni.h” is not bundled with OSX. At least not before you install the dev package.

g++ -O2 -bundle "-I/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers" \
"-I/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers" \
-o libtoscomm.jnilib NativeSerial_darwin.cpp



Good to go… 

3 comments:

  1. Hello I ran into the same problem and I am new to mac. So how do I install the dev package.

    ReplyDelete
  2. Hi Suvil, start here: http://developer.apple.com/technologies/mac/

    You don't need to pay for the new XCode, but with it all the dev headers and libraries will be installed.

    ReplyDelete