Arch Linux: handle java8 being non-default
Categories
(Firefox Build System :: Bootstrap Configuration, defect, P3)
Tracking
(firefox82 fixed)
| Tracking | Status | |
|---|---|---|
| firefox82 | --- | fixed |
People
(Reporter: mt, Assigned: mhentges)
References
Details
(Keywords: in-triage)
Attachments
(4 files)
I have jdk10-openjdk installed (for some reason I can't remember) on my machine, so when bootstrap installs java 8 it doesn't change the version of java that /usr/bin/java points to. The result is that bootstrap fails.
One option here is to set the default, but that is pretty disruptive and likely unwanted (java 8 is old):
sudo archlinux-java set java-8-openjdk
It might be better to overwrite JAVA_HOME to /usr/lib/jvm/java-8-openjdk if java is installed manually. This appears to work so far (the NDK download is currently eating the remainder of my download quota for the month). I don't know how to make that stick for future invocations of mach though, or I'd provide a patch.
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 1•5 years ago
|
||
When multiple java versions are in use, some OSes have a mechanism to
change the "default"/system Java.
This can cause unexpected build failures if the system Java changes.
So, in bootstrap, if the Java version found is valid, then its path
should be encoded into mozconfig.
Comment 3•5 years ago
|
||
| bugherder | ||
Comment 4•5 years ago
•
|
||
I'm on Fedora 32 and hit this while running mach bootstap for android this morning.
Executing as root: sudo dnf install java-1.8.0-openjdk-devel wget ncurses-compat-libs
Last metadata expiration check: 0:49:43 ago on Fri 18 Sep 2020 06:46:30 AM PDT.
Package java-1.8.0-openjdk-devel-1:1.8.0.265.b01-1.fc32.x86_64 is already installed.
...
Exception: The "java" and "jarsigner" binaries on the PATH are currently coming from two different JDKs. Please resolve this, or explicitly set JAVA_HOME.
As far as I can tell, I don't have multiple JDKs installed.
$ which java
/usr/bin/java
$ which jarsigner
/usr/bin/jarsigner
$ find /usr -name jarsigner 2> /dev/null | xargs ls -la
lrwxrwxrwx. 1 root root 27 Aug 4 06:42 /usr/bin/jarsigner -> /etc/alternatives/jarsigner
-rwxr-xr-x. 1 root root 18816 Jul 27 20:05 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/jarsigner
-rw-r--r--. 1 root root 1661 Sep 21 2017 /usr/share/bash-completion/completions/jarsigner
$ ls -la /etc/alternatives/jarsigner
lrwxrwxrwx. 1 root root 73 Aug 4 06:42 /etc/alternatives/jarsigner -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/jarsigner
Fwiw, $ export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64 fixed this for me.
| Assignee | ||
Comment 5•5 years ago
•
|
||
Hmm, I'm guessing that perhaps your /etc/alternatives/[java|jarsigner] are pointing to different JDKs?
Can you run the following for me?
$ realpath /usr/bin/jarsigner # based on your comment, this'll probably go to that 1.8.0 JDK
$ realpath /usr/bin/java
Comment 6•5 years ago
|
||
$ realpath /usr/bin/jarsigner
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/jarsigner
$ realpath /usr/bin/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/jre/bin/java
| Assignee | ||
Comment 7•5 years ago
|
||
Hey, I've made a small local patch to print some debug log information.
Can you download this file and run
$ hg import --no-commit $path_to_downloaded_patch_file
$ ./mach bootstrap # Select an Android-y option so the `ensure_java()` function is run
Thanks for reporting this, I'm really surprised you're running into an error here :)
Comment 8•5 years ago
|
||
which(java) = /usr/bin/java
which(jarsigner) = /usr/bin/jarsigner
jdk_bin_dir = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin
os.path.realpath(java) = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/jre/bin/java
which(java, path=jdk_bin_dir) = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/java
os.path.realpath(which(java, path=jdk_bin_dir)) = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/java
...
Exception: The "java" and "jarsigner" binaries on the PATH are currently coming from two different JDKs. Please resolve this, or explicitly set JAVA_HOME.
| Assignee | ||
Comment 9•5 years ago
|
||
Woah, does your distro not symlink $JDK/bin/java => $JDK/jre/bin/java?
Can you do the following for me?
$ /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/java
$ /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/jre/bin/java
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
$ ls -la /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/jre/bin/java
-rwxr-xr-x. 1 root root 18688 Jul 27 20:05 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/java
-rwxr-xr-x. 1 root root 18688 Jul 27 20:05 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/jre/bin/java
| Assignee | ||
Comment 12•5 years ago
•
|
||
I'm so sorry, I was multitasking and missed the first part - I'm trying to find out if they're separate binaries or if one links to the other. There should be an ls -al in front 😓
EDIT - it looks like you were one step ahead of me and provided that info, thanks!
They don't link to each other, interesting. I'll create a new bug and resolve this. Thanks again!
| Assignee | ||
Comment 13•5 years ago
|
||
In the build process, there's two ways that java is used:
- From the path
- From the java-bin-path specified in the mozconfig
Before, to assert that both "java" usages would be consistent, the
implementation assumed that there was only a single "java" binary
per-JDK-version, and all duplicate "binaries" were symlinks to the
original.
However, in Fedora, it has two identical full binaries: one in
$JDK/bin, and one in $JDK/jre/bin. The symlink theory was incorrect.
So instead, we can assert that both "java" usages are consistent
by checking their versions and asserting that they are equivalent.
Comment 14•5 years ago
|
||
Comment 15•5 years ago
|
||
Backed out changeset fded12622108 (bug 1663837) as requested by dev. CLOSED TREE
Backout:
https://hg.mozilla.org/integration/autoland/rev/482e3a1e39cc2b3b824dbc459c6aad260a5f9562
| Assignee | ||
Comment 16•5 years ago
|
||
Thanks! The patch has moved to 1666032, as expected :)
Description
•