Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    nigredo-tori
    @nigredo-tori
    @Sciss
    Hanns Holger Rutz
    @Sciss
    thanks again. I have to talk to a colleague of mine in office. i'm pretty sure he builds installers for mac and windows on a VM running in linux, and the OS images are indeed available, seems a gray area (don't remember what the container is)
    nigredo-tori
    @nigredo-tori
    Might be ModernIE.
    Hanns Holger Rutz
    @Sciss

    jlink --add-modules java.base --output /tmp/stripped-jre

    Yeah, that's 414 MB. Is that correct?

    nigredo-tori
    @nigredo-tori
    No, that's way too much. Could you try with a portable JVM from https://adoptopenjdk.net/ ?
    Hanns Holger Rutz
    @Sciss
    sorry, what do mean by "portable"? or just, that it's not debian's own installation?
    would it be useful if I learned how to install and use docker?
    nigredo-tori
    @nigredo-tori

    sorry, what do mean by "portable"?

    Ah, sorry, I'm stuck in Windows mode... Just download an archive for your OS from that site, extract, and run the command above (with full path to the required jlink executable).

    Hanns Holger Rutz
    @Sciss
    ok, so I try with adopt's build of openjdk11 linux x64...
    nigredo-tori
    @nigredo-tori

    would it be useful if I learned how to install and use docker?

    In general - yes :smile:. With respect to this issue - depends on what you're trying to achieve. Docker won't help you cross-build, so you only need it if you want to distribute Docker images, or do something clever/tricky with your CI.

    Hanns Holger Rutz
    @Sciss
    50 MB - awesome :)
    Why wouldn't Docker help to cross-build? Couldn't I use one of its official Windows images, and have it git clone myproject && sbt universal:packageBin inside to obtain, for example, a Windows standalone of my application? (Perhaps I don't understand the scope of Docker; at least it appears to me that way via GitLab CI)
    I thought many people today use CI to package their applications already. Isn't Docker essentially a headless virtual machine?
    Hanns Holger Rutz
    @Sciss
    If someone confirms that this is principally possibly, I take that as a heads-up to actually try it out ;)
    nigredo-tori
    @nigredo-tori

    @Sciss, you can't run Windows Docker images on a Linux host, so you need a working Windows machine/VM anyway. At that point Docker is only useful to keep your build isolated from the machine's configuration. So you might want it if you're doing some complicated CI stuff that requires a lot of different software environments, but until then it's just extra weight.

    Isn't Docker essentially a headless virtual machine?

    Docker is more lightweight. It reuses the OS kernel, making the whole thing faster, but sacrificing portability and security. At least as far as I know (I am by no means qualified to discuss this).

    If someone confirms that this is principally possibly, I take that as a heads-up to actually try it out ;)

    Well, Docker works with Windows, and it should be possible to build your project in a Docker container running a Windows image. But, as I said before, at that point you already have a Windows machine/VM, so why bother?

    Hanns Holger Rutz
    @Sciss
    oh ok, then I was mistaken; I thought it could run a windows or mac image on a linux computer.
    nigredo-tori
    @nigredo-tori
    Hanns Holger Rutz
    @Sciss
    :thumbsup:
    Hanns Holger Rutz
    @Sciss
    Still confused. When I look at this for example - https://github.com/soywiz/docker-wine-openjdk-gradle-kotlin-native - the impression given is that a docker image is provided to build binaries, in this case based on Kotlin native, for all three platforms.
    Hanns Holger Rutz
    @Sciss
    I think I'll have a go at WINE first
    nigredo-tori
    @nigredo-tori

    @Sciss, you do that. JlinkPlugin probably won't pick up the executables, though - so you will need a forwarder like this (save this as bin/jlink in your Windows JDK directory, and chmod +x):

    #!/usr/bin/env bash
    DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
    exec wine "$DIR/jlink.exe"

    You'd have to do the same for bin/jdeps (forwarding to bin/jdeps.exe). That should do it.

    A PR with extension points for the JlinkPlugin (e.g. a jlinkBuildImage / jlinkCommand and jlinkBuildImage / jlinkJdepsCommand tasks) would be welcome.
    nigredo-tori
    @nigredo-tori
    Sorry, the above script should read
    #!/usr/bin/env bash
    DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
    exec wine "$DIR/jlink.exe" "$@"
    Hanns Holger Rutz
    @Sciss
    ok, thanks, will try
    Hanns Holger Rutz
    @Sciss
    btw sbt -java-home <path-to-openjdk> universal:packageBin also seems to work (at least on my host system), without creating aliases for jlink etc.
    nigredo-tori
    @nigredo-tori
    @Sciss, that should work for native JDK (by default, JlinkPlugin uses whatever JVM it runs in), but you would still need the above forwarders for cross-building with Wine. Unless Wine somehow changes executable lookup rules now - which I don't think is the case.
    Hanns Holger Rutz
    @Sciss
    ok
    Hanns Holger Rutz
    @Sciss

    Sorry, again @nigredo-tori I'm running into akka/akka#25640

    Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
        at akka.dispatch.AbstractNodeQueue.<clinit>(AbstractNodeQueue.java:181)
    ...
    Caused by: java.lang.ExceptionInInitializerError
        at akka.util.Unsafe.<clinit>(Unsafe.java:52)
        at akka.dispatch.AbstractNodeQueue.<clinit>(AbstractNodeQueue.java:179)
        ... 44 more
    Caused by: java.lang.NoClassDefFoundError: sun/misc/Unsafe
        at akka.util.Unsafe.<clinit>(Unsafe.java:27)
        ... 45 more

    how can I add this to the jlink plugin:

    --add-modules=jdk.unsupported

    ?

    Hanns Holger Rutz
    @Sciss
    Ok, this works:
      jlinkModules := {
        jlinkModules.value :+ "jdk.unsupported"
      },
    cool - I have my app packaged to "uncompressed" 184 MB on linux. versus 87 MB without bundled JDK. Kind of a good proportion I'd say.
    nigredo-tori
    @nigredo-tori
    @Sciss, idiomatically that is written as
    jlinkModules += "jdk.unsupported"
    Hanns Holger Rutz
    @Sciss
    @nigredo-tori thanks. Good news for now - using the jlink plugin by simply running sbt/java through wine worked without problems.
    It's super simple, because apart from installing the wine package, I can just point to the extracted zip archives for sbt and openjdk, no need to "install" or configure anything.
    Hanns Holger Rutz
    @Sciss
    how do I set the name of the .deb file created by DebianPlugin? I tried packageName in Debian (that controls the name of the installed package and what is written in the control file) and many other things, none seem to work, I always end up with <name>_<version>_all.deb. I want to override that to be <name>-full_<version>_<arch>.deb where arch is something like x64.
    Hanns Holger Rutz
    @Sciss
    name in Debian and packageArchitecture in Debian seem to work, as they are hardcoded references in private[debian] def archiveFilename
    Hanns Holger Rutz
    @Sciss
    how can I make a setting conditional on a sys.prop, like "os.name"? i.e. I want to use useNativeZip only when running on macOS. Is that possible in sbt?
    nigredo-tori
    @nigredo-tori
    @Sciss, if you assume the property/setting won't change during SBT runtime (and in this case it shouldn't), you can just do
    useNativeZip := isMacOsName(sys.props("os.name"))
    nigredo-tori
    @nigredo-tori
    About DebianPlugin - judging by the code, Debian / name := "my-package-full" should work, but I'm not familiar enough with that plugin to say that something won't break.
    Nepomuk Seiler
    @muuki88
    Thanks @nigredo-tori for all the detailed explanations. @Sciss would you like to write all your findings in a pull request and add a new section in the recip
    recipes folder?
    ( the mobile version of gitter is not peak UX 😁 )
    Hanns Holger Rutz
    @Sciss
    ok; yes, I will do that when I find time. Just a quick follow-up: unless I did something wrong, useNativeZip actually doesn't help with the executable bits when building on macOS itself. So I had to copy the zip from the Mac back to my Linux machine, unpack it and re-zip it, to be able to use it on a Mac, LOL. Not sure what's going on there.
    Nepomuk Seiler
    @muuki88
    This is a long standing-never-able-to-fix-properly issue for years 😭
    dvir
    @dvirf1
    hi, after building a graal native-image with sbt-native-packager, is there a task that creates a docker image from it? (looking for something like docker:publishNativeImageLocal, similar to docker:publishLocal)
    João Ferreira
    @jtjeferreira
    namely (packageBin in GraalVMNativeImage).value -> s"${(defaultLinuxInstallLocation in Docker).value}/bin/${executableScriptName.value}"
    ang-mic
    @ang-mic

    Hi, I hope everyone is well. I have a silly question to ask. I use the DockerPlugin to build my Scala app image. Let's say my OS (my laptop) uses jdk 11 and my base image is openjdk:jre-alpine which uses java 8 runtime. I am right to think that SbtNativePackager is going to use my OS' jdk 11 to compile my Scala code?

    Snippet from build.sbt

    .settings(
        dockerUpdateLatest := true,
        packageName in Docker := "sample-app",
        dockerBaseImage := "openjdk:jre-alpine",
        version in Docker := version.value,
        dockerExposedPorts := Seq(80),
        daemonUser in Docker := "root",
        dockerEntrypoint := Seq("usr/share/bin/entrypoint"),
        dockerRepository := Some("ang")
      )

    Thanks in advance

    nafg
    @nafg
    Sbt native packager doesn't compile your code, sbt does. Sbt runs on whatever jvm you run it on. The other question is what classfile version it outputs
    ang-mic
    @ang-mic
    @nafg Thank you for your response. It makes sense :)