* [PATCH] perf build: Fix detection of latest openjdk
@ 2026-04-07 8:03 Namhyung Kim
2026-04-07 12:19 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2026-04-07 8:03 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
My fedora system fails to find openjdk even if I installed the
'java-latest-openjdk-devel' package as in the warning message.
It turns out that the directory path is different than what's in the
output of alternatives.
Makefile.config:1122: No openjdk development package found, please install JDK package,
e.g. openjdk-8-jdk, java-latest-openjdk-devel
The Makefile.config has the rule like below to detect the installed
directory with a version number.
$ alternatives --display java | tail -1 | cut -d ' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g'
/usr/lib/jvm/java-21-openjdk
This is to find a directory where the header file (jvmti.h) is like
/usr/lib/jvm/java-21-openjdk/include/jvmti.h. However the header file
was in a different directory.
$ rpm -ql java-latest-openjdk-devel | grep jvmti.h
/usr/lib/jvm/java-latest-openjdk/include/jvmti.h
It seems the directory name is fixed to provide the latest version.
Let's check the directory name before using the parsed name. With this
change, the warning is gone on my system.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Makefile.config | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 333ddd0e4bd814e9..e6686641761fd0bf 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -1096,8 +1096,12 @@ ifndef NO_JVMTI
ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
else
- ifneq (,$(wildcard /usr/sbin/alternatives))
- JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
+ ifneq (,$(wildcard /usr/lib/jvm/java-latest-openjdk/include))
+ JDIR=/usr/lib/jvm/java-latest-openjdk
+ else
+ ifneq (,$(wildcard /usr/sbin/alternatives))
+ JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
+ endif
endif
endif
ifndef JDIR
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] perf build: Fix detection of latest openjdk
2026-04-07 8:03 [PATCH] perf build: Fix detection of latest openjdk Namhyung Kim
@ 2026-04-07 12:19 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-04-07 12:19 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ian Rogers, James Clark, Jiri Olsa, Adrian Hunter, Peter Zijlstra,
Ingo Molnar, LKML, linux-perf-users
On Tue, Apr 07, 2026 at 01:03:20AM -0700, Namhyung Kim wrote:
> My fedora system fails to find openjdk even if I installed the
> 'java-latest-openjdk-devel' package as in the warning message.
> It turns out that the directory path is different than what's in the
> output of alternatives.
>
> Makefile.config:1122: No openjdk development package found, please install JDK package,
> e.g. openjdk-8-jdk, java-latest-openjdk-devel
>
> The Makefile.config has the rule like below to detect the installed
> directory with a version number.
>
> $ alternatives --display java | tail -1 | cut -d ' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g'
> /usr/lib/jvm/java-21-openjdk
>
> This is to find a directory where the header file (jvmti.h) is like
> /usr/lib/jvm/java-21-openjdk/include/jvmti.h. However the header file
> was in a different directory.
>
> $ rpm -ql java-latest-openjdk-devel | grep jvmti.h
> /usr/lib/jvm/java-latest-openjdk/include/jvmti.h
>
> It seems the directory name is fixed to provide the latest version.
> Let's check the directory name before using the parsed name. With this
> change, the warning is gone on my system.
Interesting, I'm not noticing this on Fedora rawhide (44), I created a
fresh toolbox container with fedora:rawhide and had, as you, this:
⬢ [acme@toolbx perf-tools-next]$ m
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j32' parallel build
Warning: Kernel ABI header differences:
diff -u tools/arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/svm.h
Makefile.config:1070: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
Makefile.config:1122: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-latest-openjdk-devel
Then I just followed the suggestion and did a:
$ sudo dnf install java-latest-openjdk-devel
And after that the 1122 warning vanished and:
⬢ [acme@toolbx perf-tools-next]$ ls -la /tmp/build/perf-tools-next/feature/test-jvmti*
-rwxr-xr-x. 1 acme acme 12384 Apr 7 09:14 /tmp/build/perf-tools-next/feature/test-jvmti.bin
-rwxr-xr-x. 1 acme acme 12392 Apr 7 09:14 /tmp/build/perf-tools-next/feature/test-jvmti-cmlr.bin
-rw-r--r--. 1 acme acme 1188 Apr 7 09:14 /tmp/build/perf-tools-next/feature/test-jvmti-cmlr.d
-rw-r--r--. 1 acme acme 0 Apr 7 09:14 /tmp/build/perf-tools-next/feature/test-jvmti-cmlr.make.output
-rw-r--r--. 1 acme acme 1122 Apr 7 09:14 /tmp/build/perf-tools-next/feature/test-jvmti.d
-rw-r--r--. 1 acme acme 0 Apr 7 09:14 /tmp/build/perf-tools-next/feature/test-jvmti.make.output
⬢ [acme@toolbx perf-tools-next]$ cat /tmp/build/perf-tools-next/feature/test-jvmti.make.output
⬢ [acme@toolbx perf-tools-next]$
⬢ [acme@toolbx perf-tools-next]$ alternatives --display java | tail -1 | cut -d ' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g'
/usr/lib/jvm/java-latest-openjdk
⬢ [acme@toolbx perf-tools-next]$
⬢ [acme@toolbx perf-tools-next]$ alternatives --display java
java - status is auto.
link currently points to /usr/lib/jvm/java-latest-openjdk/bin/java
/usr/lib/jvm/java-latest-openjdk/bin/java - priority 1
follower jre: /usr/lib/jvm/java-latest-openjdk
follower alt-java: /usr/lib/jvm/java-latest-openjdk/bin/alt-java
follower jcmd: /usr/lib/jvm/java-latest-openjdk/bin/jcmd
follower keytool: /usr/lib/jvm/java-latest-openjdk/bin/keytool
follower rmiregistry: /usr/lib/jvm/java-latest-openjdk/bin/rmiregistry
follower java.1.gz: /usr/lib/jvm/java-latest-openjdk/man/man1/java.1
follower alt-java.1.gz: /usr/lib/jvm/java-latest-openjdk/man/man1/alt-java.1
follower jcmd.1.gz: /usr/lib/jvm/java-latest-openjdk/man/man1/jcmd.1
follower keytool.1.gz: /usr/lib/jvm/java-latest-openjdk/man/man1/keytool.1
follower rmiregistry.1.gz: /usr/lib/jvm/java-latest-openjdk/man/man1/rmiregistry.1
Current `best' version is /usr/lib/jvm/java-latest-openjdk/bin/java.
⬢ [acme@toolbx perf-tools-next]$
- Arnaldo
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/Makefile.config | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 333ddd0e4bd814e9..e6686641761fd0bf 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -1096,8 +1096,12 @@ ifndef NO_JVMTI
> ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
> JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
> else
> - ifneq (,$(wildcard /usr/sbin/alternatives))
> - JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
> + ifneq (,$(wildcard /usr/lib/jvm/java-latest-openjdk/include))
> + JDIR=/usr/lib/jvm/java-latest-openjdk
> + else
> + ifneq (,$(wildcard /usr/sbin/alternatives))
> + JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
> + endif
> endif
> endif
> ifndef JDIR
> --
> 2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-07 12:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 8:03 [PATCH] perf build: Fix detection of latest openjdk Namhyung Kim
2026-04-07 12:19 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox