* [PATCH] perf build: Fix detection of latest openjdk
@ 2026-04-07 8:03 Namhyung Kim
0 siblings, 0 replies; only message 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] only message in thread
only message in thread, other threads:[~2026-04-07 8:03 UTC | newest]
Thread overview: (only message) (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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox