kieler / elkjs

ELK's layout algorithms for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build from source error (Ubuntu 22.04 LTS)

CorbinFoucart opened this issue · comments

Describe the bug
Following the build instructions, npm gradle generates a versioning incompatibility for JVM

Expected behavior
Following the repo README, I expect the build process to succeed

Additional context
My build script is the following (to create the layout described in the README):

#!/bin/bash

# checkout elkjs 
git clone git@github.com:kieler/elkjs.git

# checkout ELK
git clone git@github.com:eclipse/elk.git

cd elkjs
npm install
npm run build

which fails with

> elkjs@0.10.0 build
> npm run gradle && npm run js

> elkjs@0.10.0 gradle
> ./gradlew lib

FAILURE: Build failed with an exception.

* Where:
Build file '/path/to/elkjs_from_source/elkjs/build.gradle'

* What went wrong:
Could not compile build file '/path/to/elkjs_from_source/elkjs/build.gradle'.
> startup failed:
  General error during conversion: Unsupported class file major version 65
  
  java.lang.IllegalArgumentException: Unsupported class file major version 65
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
...
       at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
        at java.base/java.lang.Thread.run(Thread.java:1583)
  
  1 error

when I check the versioning:

$ ./gradlew --version

------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------

Build time:   2021-08-17 09:59:03 UTC
Revision:     a773786b58bb28710e3dc96c4d1a7063628952ad

Kotlin:       1.5.21
Groovy:       3.0.8
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          21.0.2 (Private Build 21.0.2+13-Ubuntu-122.04.1)
OS:           Linux 6.5.0-21-generic amd64

For those who encounter a similar issue, Gradle 7.2 is incompatible with JVM 21. Setting the bash environment to point to a JVM installation lower than 17 allowed the build to proceed.

$ export JAVA_HOME=/path/to/java-11-openjdk-amd64
$./gradlew --version
------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------

Build time:   2021-08-17 09:59:03 UTC
Revision:     a773786b58bb28710e3dc96c4d1a7063628952ad

Kotlin:       1.5.21
Groovy:       3.0.8
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.22 (Ubuntu 11.0.22+7-post-Ubuntu-0ubuntu222.04.1)
OS:           Linux 6.5.0-21-generic amd64

and npm run build was successful. Closing.