Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build of Kotlin examples fails with Nix on Linux #93

Open
msgilligan opened this issue Sep 29, 2024 · 3 comments
Open

Build of Kotlin examples fails with Nix on Linux #93

msgilligan opened this issue Sep 29, 2024 · 3 comments

Comments

@msgilligan
Copy link
Member

build gradle is failing for me on NixOS, both in my home-manager shell and in a nix develop shell.

The error is:

> Task :secp-examples-kotlin:compileKotlin FAILED
e: No class roots are found in the JDK path: /nix/store/j4miw9k22ivwmga8hibwh3cph601z2nc-openjdk-22.0.2-ga

I can work around it by installing a Gradle wrapper and using the Gradle wrapper to launch Gradle or by commenting out the Kotlin module in settings.gradle.

It seems to be related to these commented out lines in flake.nix:

(mkIf stdenv.isLinux [
       {
              name = "JAVA_HOME";
              eval = "$DEVSHELL_DIR/lib/openjdk";
       }
   ])

I think "jdk home" or "JAVA_HOME" is not being set correctly in the Kotlin plugin when a Nix-installed Gradle is being used and the correct JDK path should be (in the case of the error message above):

/nix/store/j4miw9k22ivwmga8hibwh3cph601z2nc-openjdk-22.0.2-ga/lib/openjdk
@msgilligan
Copy link
Member Author

It's also worth noting that the Kotlin plugin version 2.0.20 says it is not compatible with Gradle 8.10 (it says 8.6 for best results, but 8.7-8.8 should also work) I haven't found Gradle 8.10 to cause problems in any other case on either macOS or Linux.

@msgilligan
Copy link
Member Author

You can build the Kotlin examples on NixOS with the master branch (as of today) but only by using ./gradlew. To build using a Gradle provided by Nixpkgs, you'll have to wait until Gradle 8.11 is available there. See: NixOS/nixpkgs#355951

@msgilligan msgilligan changed the title Build of Kotlin examples fails on NixOS: Build of Kotlin examples fails with Nix on Linux Dec 2, 2024
@msgilligan
Copy link
Member Author

Update. This problem may also occur when using nixpkgs on Linux, but does not occur on macOS.

I have opened an issue on the Nixpkgs repo: NixOS/nixpkgs#360954

The workaround of replacing the jdk23 package with the the temurin-bin-23 package seems to be the best short-term solution. I will make a PR to do that, but we will leave this issue open until we get a fix that lets us use a jdk23 (or later) that is build from source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant