public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ian Rogers <irogers@google.com>,
	James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: [PATCH] perf build: Fix detection of latest openjdk
Date: Tue,  7 Apr 2026 01:03:20 -0700	[thread overview]
Message-ID: <20260407080320.45372-1-namhyung@kernel.org> (raw)

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


                 reply	other threads:[~2026-04-07  8:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260407080320.45372-1-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox