mbari-org / vars-annotation

Video Annotation Application for MBARI's Media Management (M3) software stack
https://docs.mbari.org/vars-annotation/
Apache License 2.0
16 stars 6 forks source link

Build fails for macOS using JDK15's jpackage #123

Closed hohonuuli closed 2 years ago

hohonuuli commented 3 years ago

tl;dr

jpackage in JDK15 is adding an extra "Contents" in one of the paths in the built executable:

"[...]/VARS Annotation.app/Contents/Contents/app/VARS Annotation.cfg" # JDK15
"[...]/VARS Annotation.app/Contents/app/VARS Annotation.cfg" # JDK14

What are you trying to do?

Build a macOS app using jlink and jpackage. The app is compiled and built (via jlink) on Java 11. I'm using the jpackage tool in later versions of the JDK (e.g. jdk14 and now jdk15) to package it as a mac app. The source code for the application is at https://github.com/mbari-media-management/vars-annotation

Expected behaviour:

Using jdk14's jpackage, the app builds and runs as expected. Using jdk15's jpackage, the app builds but fails to launch

Observed behaviour:

After building with jdk15's jpackage the app fails to launch. The following appears in the system.log:

Jan 22 08:58:03 dharma com.apple.xpc.launchd[1] (org.mbari.vars.ui.101792[34511]): Service exited with abnormal code: 1

I ran the following sanity checks:

Sanity Check 1

I launched the jlink built app and confirmed it runs as expected using:

cd "VARS Annotation.app/Contents/runtime/Contents/Home/bin"
./VARS\ Annotation

Sanity Check 2

I attempted to run the jpackage built executable on the command line using:

cd "VARS Annotation.app/Contents/MacOS"
./VARS\ Annotation

It fails with the following message:

Error opening "[...]/VARS Annotation.app/Contents/Contents/app/VARS Annotation.cfg" file: No such file or directory

The error is that Contents/Contents is wrong. It should only be a single "Contents" in the path. i.e. [...]/VARS Annotation.app/Contents/app/VARS Annotation.cfg

Any other comments:

Working JDK14 version:

openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.2+12)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.2+12, mixed mode, sharing)

JDK15 version that has the bug:

openjdk version "15.0.1" 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9)
OpenJDK 64-Bit Server VM (build 15.0.1+9, mixed mode, sharing)
hohonuuli commented 3 years ago

I sent an email about this to core-libs-dev@openjdk.java.net

andyherrick commented 3 years ago

Can you try with ea version of JDK16 from https://download.java.net/java/early_access/alpine/32/binaries/openjdk-16-ea+32_linux-x64-musl_bin.tar.gz ?

andyherrick commented 3 years ago

Never Mind - I can reproduce with my build of jdk 17, so problem is still there - I will file a bug and fix.

hohonuuli commented 3 years ago

@andyherrick Thanks Andy!

hohonuuli commented 3 years ago

Link to this issue in the JDK bug tracker: https://bugs.openjdk.java.net/browse/JDK-8260335

hohonuuli commented 2 years ago

VARS builds on JDK 17.