I had the problem where XCode tried to compile swift-files before my Java files so I decided to move over my Java to a separate target and build it as a static library that my main project has a dependency on. But I get this error:
Undefined symbols for architecture x86_64:
"_IOSClass_fromClass", referenced from:
___ComSiamasterMyClass_class__block_invoke in libJava.a(MyClass.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Also in XCode 7.1, When I try to add the libz.tbd and libicucore.tbd, I get this error:
error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk/usr/lib/libz.tbd (No such file or directory)
Are there any solutions/workarounds for these?
--
You received this message because you are subscribed to the Google Groups "j2objc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to j2objc-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I can see in the log that files are being translated now, but I can't access the header files from the static library or the main project.
Could that have something to do with ${DERIVED_FILES_DIR}?
I've added it as user header search path for both the static lib and the main project target.
if [ ! -f "${J2OBJC_HOME}/j2objc" ]; then echo "J2OBJC_HOME not correctly defined in Settings file, currently set to '${J2OBJC_HOME}'"; exit 1; fi;
"${J2OBJC_HOME}/j2objc" -d ${DERIVED_FILES_DIR} -sourcepath "${PROJECT_DIR}/Java/JavaFiles" -use-arc --no-package-directories ${INPUT_FILE_PATH};
Output files:
${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.m
${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.h
I can actually access the generated files in the static lib. But once I try to access them from the project it stops compiling. I've also tried adding ../ to both User header search paths and Header search paths, but my project is unable to find the generated header files.
Update:
I can actually access the generated files in the static lib. But once I try to access them from the project it stops compiling. I've also tried adding ../ to both User header search paths and Header search paths, but my project is unable to find the generated header files.
I think I had done that. However, I was just about to post an update to say I finally managed to do what I wanted.
I added a Cocoa Touch Framework to my workspace and linked it into my main project.
in my Cocoa Touch framework, I added a build rule that looks like this:
/bin/cp ${DERIVED_FILES_DIR}/*.h ${INCLUDE_DIR}
/bin/cp ${J2OBJC_HOME}/include/J2ObjC_header.h ${INCLUDE_DIR}
/bin/cp ${J2OBJC_HOME}/include/IOSObjectArray.h ${INCLUDE_DIR}
/bin/cp ${J2OBJC_HOME}/include/IOSArray.h ${INCLUDE_DIR}
/bin/cp ${J2OBJC_HOME}/include/J2ObjC_common.h ${INCLUDE_DIR}
/bin/cp ${J2OBJC_HOME}/include/J2ObjC_types.h ${INCLUDE_DIR}
/bin/cp ${J2OBJC_HOME}/include/NSObject+JavaObject.h ${INCLUDE_DIR}
/bin/cp ${J2OBJC_HOME}/include/JavaObject.h ${INCLUDE_DIR}
/bin/cp ${J2OBJC_HOME}/include/IOSReflection.h ${INCLUDE_DIR}
where I've set INCLUDE_DIR to be = ${BUILT_PRODUCTS_DIR}/JavaFramework.framework/Headers in my configuration file.
INCLUDE_DIR = ${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Headers
INCLUDE_DIR = ${BUILT_PRODUCTS_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}
When I include the header files in my umbrella header of the framework project, I can't use the classes in my main project anymore. It's either having all the warnings about missing submodules or not being able to compile.