JDK-8347649 : Build fails by clang after JDK-8313396
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 25
  • Priority: P3
  • Status: Closed
  • Resolution: Withdrawn
  • OS: linux
  • CPU: generic
  • Submitted: 2025-01-14
  • Updated: 2025-04-06
  • Resolved: 2025-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
Configure command:
bash configure --with-toolchain-type=clang --with-debug-level=fastdebug --with-toolchain-path=~/software/acc/x86_64/bin

Make command:
time make images test-image &> build/make.log

Make output:
=== Output from failing command(s) repeated here ===
* For target hotspot_variant-server_libjvm_objs_precompiled_precompiled.hpp.pch:
In file included from /home/yansendao/git/jdk-asan-clang/src/hotspot/share/precompiled/precompiled.hpp:34:
In file included from /home/yansendao/git/jdk-asan-clang/src/hotspot/share/classfile/classLoaderData.hpp:28:
In file included from /home/yansendao/git/jdk-asan-clang/src/hotspot/share/memory/allocation.hpp:29:
In file included from /home/yansendao/git/jdk-asan-clang/src/hotspot/share/nmt/memTag.hpp:28:
In file included from /home/yansendao/git/jdk-asan-clang/src/hotspot/share/utilities/globalDefinitions.hpp:30:
In file included from /home/yansendao/git/jdk-asan-clang/src/hotspot/share/utilities/forbiddenFunctions.hpp:38:
/home/yansendao/git/jdk-asan-clang/src/hotspot/os/posix/forbiddenFunctions_posix.hpp:43:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
   43 | FORBID_C_FUNCTION(char* realpath(const char*, char*), "use os::realpath");
      | ^
/home/yansendao/git/jdk-asan-clang/src/hotspot/share/utilities/compilerWarnings.hpp:109:18: note: expanded from macro 'FORBID_C_FUNCTION'
  109 |   extern "C" { [[deprecated(Alternative)]] Signature; }
      |                  ^
/usr/include/bits/stdlib.h:37:8: note: previous definition is here
   37 | __NTH (realpath (const char *__restrict __name, char *__restrict __resolved))
      |        ^
   ... (rest of output omitted)

Comments
This doesn't seem to be new behavior in clang, so changing "clang17" to just "clang" in the summary. It affects building with clang and using libstdc++. libstdc++ has an inline definition of realpath, to support _FORTIFY_SOURCE. libc++ seems to not have such an inline definition. That's why this didn't show up in my testing of JDK-8313396, which wasn't tested with building with clang on linux.
06-04-2025

This looks to me like a clang bug. I can't find any justification for the warning in the standard, and it interferes with what seem like standard-compliant uses.
18-03-2025

Close this issue as JDK-8313396 has been backouted.
15-01-2025

Caused by JDK-8313396
14-01-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/23102 Date: 2025-01-14 12:51:56 +0000
14-01-2025