Makefile changes required to build Java API on OSX

Submitted by free-variation on Sun, 05/08/2016 - 19:39
Forums

I had to make a couple of manual changes to the Makefile to build the Java API -- changes that were not noted in the README.

Here is the build line:

libfreeling_javaAPI.dylib: freeling_javaAPI.cxx
$(GCC) -shared -o libfreeling_javaAPI.so freeling_javaAPI.cxx -lfreeling \
-L$(FREELINGDIR)/lib -I$(FREELINGDIR)/include -I$(FREELINGDIR)/include/treeler -I$(JAVADIR)/include \
-I$(JAVADIR)/include/darwin -fPIC -std=c++0x \
-lboost_system-mt

Note that:
- the extension on the shared library needs to be .dylib, not .so, for System.loadLibrary to work correctly.
- you must include -I$(JAVADIR)/include/darwin as opposed to -I$(JAVADIR)/include/linux in order to link to the Java native libs (unsurprisingly!)
- you need the multithreaded boost libs: -lboost_system-mt.

Hope this helps. Would a pull request on the README be useful?