I'm trying to build an iOS application on os x with scala-native and running into a number of problems when doing the sbt build. Any hints about what to do are welcome.
I set build.sbt, using Xcode directories for iOS files, as follows:
nativeCompileOptions := Seq("-v",
"-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk")
nativeLinkingOptions := Seq("-v",
"-I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include",
"-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib",
"-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk")
When the initial compilations are done for the c files included in the nativelib (e.g., wrap, time, dyndispatch, gc, posix, eh (c++), unwind and target) I can't see a way to add options to the sbt compilation command line. Since these compilations create .o files (not .ll) the target platform is already set once these compilations complete. An example compilation follows:
/Users/nnovod/tools/clang+llvm-4.0.0-x86_64-apple-darwin/bin/clang -I/usr/local/include -I/Users/nnovod/tools/clang+llvm-4.0.0-x86_64-apple-darwin/include -c /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/posix.c -o /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/posix.c.o
When compiling the scala-native code I can add options via the nativeCompileOptions and adding the xcode simulator sdk directory as a system root (-isysroot .../iPhoneSimulator.10.3.sdk) appears to do the trick, although there are warnings about "overriding the module target triple with x86_64-apple-ios10.3.0"
When linking there are 2 problems: a)the gc library is not found (do I need to build one for iOS? A cross-build of Boehm?) b)The initial compilations done for MacOS, now conflict with the ones done for iOS. Following is the link command produced by sbt:
"/usr/bin/ld" -demangle -lto_library /Users/nnovod/tools/clang+llvm-4.0.0-x86_64-apple-darwin/lib/libLTO.dylib -dynamic -arch x86_64 -ios_simulator_version_min 10.3.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -o /Users/nnovod/projects/scalaNative/target/scala-2.11/scalanative-out -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib -lgc /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/__const.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/__dispatch.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/__empty.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/__extern.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/__instance.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/__main.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/example.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/java.io.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/java.lang.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/java.lang.reflect.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/java.nio.charset.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/java.nio.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/java.util.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/niocharset.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.collection.generic.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.collection.immutable.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.collection.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.collection.mutable.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.collection.script.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.compat.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.io.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.math.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.reflect.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.runtime.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.scalanative.native.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.scalanative.runtime.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.util.control.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.util.hashing.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/ll/scala.util.ll.o /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/dyndispatch.c.o /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/eh.cpp.o /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/gc.c.o /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/posix.c.o /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/time.c.o /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/unwind.c.o /Users/nnovod/projects/scalaNative/target/scala-2.11/nativelib/wrap.c.o -lc++ -lSystem /Users/nnovod/tools/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.ios.a
Am I going about this all wrong? I'm not a sbt expert, but do I need to do major modifications of the scala-native sbt code?
Thank you.