On Mon, 24 Jul 2023 20:24:23 GMT, Phil Race <[email protected]> wrote:
>> There is a simple build failure after >> [JDK-8280982](https://bugs.openjdk.org/browse/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.) >> >> Additional testing: >> - [x] Linux GCC 6 fastdebug build (passes with HarfBuzz warnings, to be >> fixed separately) > > src/java.desktop/unix/native/libpipewire/include/spa/utils/defs.h line 62: > >> 60: # define SPA_FALLTHROUGH [[clang::fallthrough]]; >> 61: #elif defined(__GNUC__) && __GNUC__ >= 7 >> 62: # define SPA_FALLTHROUGH __attribute__ ((fallthrough)); > > Upstream still has this issue/bug. > https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/spa/include/spa/utils/defs.h > Do they intend to support only GNUC 7 and up ? Not clear. Best to ask. Ideally, this should be fixed upstream, but while we wait, we can try to fix the build failure in our source by adding definition of `__clang_major__` just before including the [pipewire/stream.h](https://github.com/openjdk/jdk/blob/master/src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.h#L36) // some comment why we are doing this #ifndef __clang_major__ #define __clang_major__ 0 #endif It looks like that the `defs.h` is the only file that uses `__clang_major__` in libxawt, so this define should be safe. But the question of GCC < 7 support remains open. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14995#discussion_r1274858361
