Get Started Scala-native

To get closer to bare metal, Scala-native is proposed.

I build it in my own laptop with Mac osx system.

The environment setup can be referred here

I still met some problem when I run sbt in scala-native and I just record them for somebody also met these issues.

  • Cannot find sbt-cross plugin. You can download and publish a local repository with sbt.
  • The path of the local publishing is ivy/local path. However, when building scala-native, the dependencies lookup path is ivy/cache. Once you want to use the local published repository, you can remove the folder of the same dependency under cache.

Building scala-native with:

Then you can run a native demo here by running:

In this program, it imports your published native-scala libraries like this:

import scalanative.native._, stdlib._, stdio._

It is a real native problem and you can check its dependencies with otool

otool -L demo/native/target/scala-2.11/demonative-out
/usr/local/opt/bdw-gc/lib/libgc.1.dylib (compatibility version 2.0.0, current version 2.3.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

Leave a Reply

Your email address will not be published. Required fields are marked *