JDK-8312591 : GCC 6 build failure after JDK-8280982
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 21,22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-07-24
  • Updated: 2025-01-08
  • Resolved: 2023-08-02
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.
JDK 21 JDK 22
21.0.1Fixed 22 b09Fixed
Related Reports
Relates :  
Description
There is a simple build failure after JDK-8280982 with older GCCs:

```
* For target support_native_java.desktop_libawt_xawt_screencast_pipewire.o:
In file included from /home/buildbot/worker/build-jdkX-debian9/build/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h:12:0,
                 from /home/buildbot/worker/build-jdkX-debian9/build/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h:171,
                 from /home/buildbot/worker/build-jdkX-debian9/build/src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.h:36,
                 from /home/buildbot/worker/build-jdkX-debian9/build/src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c:33:
/home/buildbot/worker/build-jdkX-debian9/build/src/java.desktop/unix/native/libpipewire/include/spa/utils/defs.h:61:24: error: "__clang_major__" is not defined [-Werror=undef]
 #elif __GNUC__ >= 7 || __clang_major__ >= 10
                        ^~~~~~~~~~~~~~~
```

There is an obvious fix for this: we need to check for `defined(__GNUC__)` explicitly before touching `__clang_major__`.

(Yes, GCC 6 is old; but we would like to make sure it builds until we run into hard to resolve build issues. This allows modern JDKs to be built in legacy enterprise environments for e.g. portable builds.)
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/14995 Date: 2023-07-24 10:21:52 +0000
08-01-2025

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/32 Date: 2023-08-02 08:22:52 +0000
02-08-2023

Fix Request (21u) Fixes the build on older toolchains. Applies cleanly. Risk is low: adds a few warning exclusions.
02-08-2023

Changeset: 9454b2bb Author: Aleksey Shipilev <shade@openjdk.org> Date: 2023-08-02 07:00:37 +0000 URL: https://git.openjdk.org/jdk/commit/9454b2bbe130fdbe86485b928b80d19156c709ee
02-08-2023