0

I'm seeing a lot of errors, upwards of 170, when building my j2objc integrated project.

I think the java j2re library is correctly being located and the linking step says

-Llib/j2objcDist/lib -Llib/j2objcDist/lib/macosx -F/Users/username/Library/Developer/Xcode/DerivedData/MyApp-dkbwtvvwogkqknfpbozsmzhgrcei/Build/Products/Debug-iphonesimulator -Flib/j2objcDist/frameworks

Errors seen when building with j2objc

A lot of the paths that I'm seeing include the full user path but on the lib/j2objcDist/lib paths.

My library search paths are ${PROJECT_DIR}/lib/j2objcDist/lib/

My header search paths are ${PROJECT_DIR}/lib/j2objcDist/include ${DERIVED_FILES_DIR} ${PROJECT_DIR}/lib/j2objcDist/frameworks/JRE.framework/Headers ${PROJECT_DIR}/lib/j2objcDist/lib

My framework search paths are ${PROJECT_DIR}/lib/j2objcDist/frameworks

I've replicated the settings in the demo app available on the j2objc.org site to be best of my knowledge.

Any suggestions on what to try or where to look to fix this would be great.

Mark Reid
  • 2,611
  • 3
  • 23
  • 45

2 Answers2

0

It looks like you've set it up correctly for where to find the libraries, but haven't told the linker to include any libraries. In Other Linker Flags, set either "-ljre_emul" (or "-l jre_emul") to tell the linker to include the JRE emulation library.

That will fix all the errors you listed, but if you use other libraries then they need separate -l flags. For example, if you use any Google Guava classes, then "-lguava" also needs to be specified.

The linker finds libraries by taking each -l argument and converting it into a library name ("lib" + arg " + ".a", or libjre_emul.a in this case). It then checks each -L path to find this file, so the library should be listed with "ls ${PROJECT_DIR}/lib/j2objcDist/lib/libjre_emul.a" (substituting the actual project directory, of course).

tball
  • 1,984
  • 11
  • 21
  • I had this added in Other Linker Flags. The one step I was missing was to add jremul.a in to the Link Binary With Libraries section. – Mark Reid May 14 '16 at 00:02
0

If there is a -ljre_emul flag and a valid -L path to that library, then the issue is likely to be using a translator from one J2ObjC release and libraries from a different one. J2ObjC is a compiler, and its generated files need to be treated as transient build artifacts, not permanent source files. If your project saves translated .m and .h files, then every time a new distribution is used, all Java sources need to be updated with new translations.

tball
  • 1,984
  • 11
  • 21