scala-cli
scala-cli copied to clipboard
FreeBSD support?
Scala, Coursier and SBT are available on FreeBSD's official package repository and freshports, and Coursier officially distributes a JAR version for systems and architectures that aren't covered by their official ports. In fresh ports, FreeBSD also has openjdk 8, 11, 17, 19, 20, 21 and 22. Since scala-cli is going to become the new "scala" command, it should eventually come to all systems that can run Scala.
Currently, scala-cli is not on FreeBSD's repository, and the official website doesn't seem to mention FreeBSD in the downloads.
I propose adding official support for FreeBSD, though I know there will be a few inconveniences:
- Native-image packaging probably won't be supported, as GraalVM doesn't seem to support the BSD systems
- Specifying a JVM version with --jvm downloads it from an external source, I'm not sure if that source also provides FreeBSD builds (probably does or some other does since coursier is on FreeBSD)
It would be cool for there to be FreeBSD support so the system can be used as a working system rather than just for production. As an alternative (or temporary solution, whatever is best), scala-cli could have an option in the downloads that links to a system-agnostic JAR download, like how Coursier does. With a system-agnostic software design, maybe this JAR could have most functionality work on most BSDs and other systems even!
scala-cli could have an option in the downloads that links to a system-agnostic JAR download
@spacebanana420 Is the bootstrapped fat jar we have not sufficient? https://scala-cli.virtuslab.org/install#bootstrapped-standalone-fat-jar
I thought that was meant for a different purpose because of its description, I will check it out
Its purpose wasn't exactly this, but I think it should still fit your requirements... If this is the case, we can just update the installation doc with instructions for FreeBSD
It didn't work on FreeBSD.
I have to paste log screenshots because I'm testing on a VM
Using Coursier from FreeBSD's repository:
And so I downloaded the standalone Coursier JAR from the official website and wanted to run the typical cs setup:
So I ran with the arguments "install scala-cli" instead and it seems to have worked, though scala-cli requires a more recent java than the one in my VM's PATH so I'll fix that first and see if scala-cli works this way.
Running the scala-cli that Coursier installed doesn't work either to build one of my projects:
This seems to be the cause of the first failure (the second one being unable to specify a JVM version)
You can specify the JVM for Bloop with --bloop-jvm.
If you need Bloop to run on a JVM where -XX:+UseZGC isn't supported, then you may need to explicitly pass bloop java options with BLOOP_JAVA_OPTS.
Normally, it's possible to pass Bloop jvm options with --bloop-java-opt, but for that won't override the existing options hardcoded in Bloop.
To check what is hardcoded in Bloop, you can refer here:
https://github.com/scala-cli/bloop-core/blob/1b24bf257f091e7a37a6d72fc85faacf8d9e6a49/bloop-rifle/src/bloop/rifle/BloopRifleConfig.scala#L75-L83
Alternatively, you can skip Bloop altogether with --server=false.
Overall, it sounds like a number of things would need to be delivered first.
coursiershould receive better FreeBSD support to start with, as the errors you've been getting imply there's a lot of room for improvement- we should be able to recognise which JVM to use on a FreeBSD system, as there's no entry in the JVM index for it
- Bloop should be compatible with the JVM which would be used on FreeBSD
@spacebanana420 let me know if --server=false helped.
Overall, I don't think the maintenance team (which at the moment mostly means me) would have time to work on this anytime soon. We are, however, open to contributions. Do let me know if you need any help to get you started, in case you were interested to work on this.
When running my compilation command with --server=false, scala-cli successfully works!
I would like to contribute to adding FreeBSD support to scala-cli, but my Scala experience is still less than 1 year, I'm unsure if I could tackle the dimension of this project. Looks like at least for now, temporary FreeBSD support could be reduced to adding website information/docs/guide, adding warnings for users trying to use --jvm and --native-image, and use --server=false by default or different VM/bloop options.
I see scala-cli's dev environment uses Mill, I never heard about it before, but looks like it's a build tool aimed to be simpler and more flexible than SBT/Maven/Gradle and it looks like it has assembly jar support out of the box.
I'll check this out so i can start checking scala-cli's source code, and in the worst case scenario I can still always use Mill on FreeBSD to satisfy my BSD needs!
When running my compilation command with
--server=false, scala-cli successfully works!
Awesome!
I would like to contribute to adding FreeBSD support to scala-cli, but my Scala experience is still less than 1 year, I'm unsure if I could tackle the dimension of this project.
No worries, let me know when you want to try to tackle this. You might want to try something easier first, like something with the https://github.com/VirtusLab/scala-cli/labels/good%20first%20issue label.
Looks like at least for now, temporary FreeBSD support could be reduced to adding website information/docs/guide, adding warnings for users trying to use --jvm and --native-image, and use --server=false by default or different VM/bloop options.
@spacebanana420 Would you be able to document down what you were able to make work into an advanced ⚡ guide, which we could link on the installation page?
Yes, I could work on documentation like I did for the --preamble=false
I'll check it out
I finished working on the FreeBSD installation guide (considering partial support)! Here it is https://github.com/VirtusLab/scala-cli/pull/2793