I am trying to compile a JNI library which uses carbon from the command line.
If I don't -I/System/.../JavaVM.Framework/Headers/, It can't find any of the jni types, and gives errors.
If I just -I/System/.../FlatCarbon.framework/Headers but don't "-framework Carbon", it compiles fine, but the linker gives an error about an undefined symbol.
If I compile with -framework Carbon, it works fine, but it turns out that the -I.../FlatCarbon.framework/Headers/ was entirely unnecessary! It works the same with or without it. Now, everything up till now makes sense, except for what follows:
If I -framework JavaVM, but don't include the header directory, then can't find the jni types!
It seems utterly inconsistent. For one framework, the -I is required, and the -framework is optional, for the other, the -framework is required, and the -I is optional. How is this so? Could someone explain how the -framework option works? Is JavaVM a special case?
I am partially posting this question out of curiosity, but also to help anyone else who was searching for a similar solution, because at least with my google-fu, I wasn't able to find anything explaining frameworks from the command line, or how to link to system libraries with gcc on the command line. gcc --help doesn't even document -framework, and everything I could find was about developing with xcode.