On Sun, 10 Nov 2024 04:09:58 GMT, SendaoYan <s...@openjdk.org> wrote:

> Hi all,
> After [JDK-8338304](https://bugs.openjdk.org/browse/JDK-8338304), below 
> configure command will generate failure `error: Could not find required tool 
> for LLD`. The lld linker located in path which config with option 
> `--with-toolchain-path`, but the check `UTIL_REQUIRE_PROGS(LLD, lld)` 
> introduced by [JDK-8338304](https://bugs.openjdk.org/browse/JDK-8338304) was 
> unable to find the lld. This PR add the condition to deal with user specidied 
> `--with-toolchain-path` to find the correct lld fullpath. The change has 
> beeen verified locally, trivial fix, the risk is low.
> 
> 
> bash configure --with-jobs=128 --with-debug-level=release 
> --enable-unlimited-crypto --with-jvm-variants=server 
> --with-version-opt=f4008968 --with-zlib=system --with-toolchain-type=clang 
> --with-toolchain-path=/home/yansendao/software/acc/x86_64/bin

My first reaction was that "You need to use `UTIL_LOOKUP_TOOLCHAIN_PROGS` 
instead". But then I checked that it did what I thought it did, and it did 
not... It should have prepended `$TOOLCHAIN_PATH` to the set of paths to 
search, but instead we do this by changing the actual path in 
`TOOLCHAIN_PRE_DETECTION`. I think this is a remnant of older times, before we 
started using our own `UTIL_LOOKUP*` functions. 

I think the *proper* solution is to remove this setting of the PATH from 
`TOOLCHAIN_PRE/POST_DETECTION`, and instead update 
`UTIL_LOOKUP_TOOLCHAIN_PROGS`  to use `$TOOLCHAIN_PATH:$PATH` as 3rd variable 
to `UTIL_LOOKUP_PROGS` (if it is not given), and then finally to use 
`UTIL_LOOKUP_TOOLCHAIN_PROGS` for LLD here in `FLAGS_SETUP_LDFLAGS_HELPER`.

But.

That is a bit of a risky change that can cause breakage, so I will not propose 
you do it now.

make/autoconf/flags-ldflags.m4 line 78:

> 76:       if test "x$CXX_IS_USER_SUPPLIED" = xfalse && test 
> "x$CC_IS_USER_SUPPLIED" = xfalse; then
> 77:         if test "x$TOOLCHAIN_PATH" != x; then
> 78:           UTIL_REQUIRE_PROGS(LLD, lld, $TOOLCHAIN_PATH)

Instead, keep this somewhat hacky workaround, but make it function properly by 
doing this:

Suggestion:

          UTIL_REQUIRE_PROGS(LLD, lld, $TOOLCHAIN_PATH:$PATH)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21999#issuecomment-2470528643
PR Review Comment: https://git.openjdk.org/jdk/pull/21999#discussion_r1838102108

Reply via email to