Error building QuPath with tensorflow "first number in a CFBundleVersion cannot be zero or negative"

Hi all again,

following yesterday’s smart advice, I am trying to add StarDist directly to QuPath, which requires building QuPath rather than using the ready-made app.

After cloning the repo (commit 901911fa7e2afece6c7732459027fa6fc6e5dea5 for sake of future reproducibility), I run ./gradlew clean build createPackage -Ptensorflow-cpu=true -Ppackager=/Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home/bin/jpackage (the build would previously stop because I wasn’t passing the -pPackager argument).

The process stops at

> Task :createPackage FAILED
/Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home/bin/jpackage --input /Users/stefano/qupath/build/qupath --dest /Users/stefano/qupath/build/dist --main-jar qupath-0.2.3.jar --name QuPath-0.2.3 --java-options -XX:MaxRAMPercentage=50 --mac-package-name QuPath --mac-package-identifier QuPath --type app-image --app-version 0.2.3 --icon /Users/stefano/qupath/build/resources/main/package/macosx/qupath.icns --file-associations /Users/stefano/qupath/build/resources/main/package/associations/project.properties --runtime-image /Users/stefano/qupath/build/jre
WARNING: Using incubator modules: jdk.incubator.jpackage
Bundler Mac Application Image skipped because of a configuration problem: The first number in a CFBundleVersion cannot be zero or negative. 
Advice to fix: Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots.

It’s a problem I haven’t seen happening to others, although it seems related to xcode? and I unfortunately didn’t manage to figure out how to follow the “Advice to fix”… I actually tried to cheat my way through this by changing the content of qupath/VERSION from 0.2.3 to 1.2.3 to satisfy the “no 0 as first number” and, while the build successfully got to a conclusion, the resulting app would refuse to open.

Thanks again in advance!

jpackage changed in OpenJDK 15, so you’ll need to use OpenJDK 14 for it to work properly. Some more info here (basically, it seems to be subtly broken on all platforms in different ways…).

We haven’t updated the build script, because OpenJDK 16 is on the horizon, and it should (I believe) have a stable jpackage at that point. We’re also working towards the next QuPath 0.x release.

So rather than switch twice, we’re sticking with ‘use OpenJDK 14 if you want to build QuPath v0.2.x’ as a consistent rule, and use OpenJDK 16+ for future, as-yet-unreleased QuPath versions.

1 Like

aaand that did the trick! Thank you :slight_smile:

1 Like

Hi,
I have also an other problem to build quPath with tensorflow. It appear when it do the distribution package. Ubuntu 20.10, OpenJDK14:

Task :createRuntime FAILED
Creating default Java runtime
/usr/lib/jvm/java-14-openjdk-amd64/bin/jlink --output /home/phm/Developpement/QuPath/build/jre --add-modules java.desktop,java.xml,java.scripting,java.sql,java.naming,jdk.unsupported,jdk.zipfs,java.net.http,java.management,jdk.management.agent --bind-services --strip-debug --no-header-files --no-man-pages --strip-native-commands --compress=2Error: Hash of jdk.management.jfr (fe13cbaad9132f3aafe8db1febd951ded02ac6f6371c0b1b14fc4fc561ce3b70) differs to expected hash (27de2b003ba0131d772e6a60bfc17c30168643f86714186d11e3e7e23df06ec2) recorded in java.base

Philippe

I can find references to the problem independently of QuPath, e.g. see java.lang.module.FindException: Hash of jdk.management.jfr differs to expected hash recorded in java.base · Issue #165 · AdoptOpenJDK/openjdk-support · GitHub

Using AdoptOpenJDK rather than OpenJDK may help.

Hi Pete,

Thanks for the info. To bypass the problem I downloaded the binaries and build the sources with tensorflow option and copy the builded tensorflow extension in the lib folder of QuPath.

I will try the adoptOpenJDK later.

Philippe