All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
	James Clark <james.clark@linaro.org>,
	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: Re: [PATCH] perf build: Fix detection of latest openjdk
Date: Tue, 7 Apr 2026 09:19:57 -0300	[thread overview]
Message-ID: <adT2berZ52tb1O-P@x1> (raw)
In-Reply-To: <20260407080320.45372-1-namhyung@kernel.org>

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

  reply	other threads:[~2026-04-07 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2026-04-08  5:46   ` Namhyung Kim

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=adT2berZ52tb1O-P@x1 \
    --to=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=namhyung@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.