RFR: 8371914: PNG defines in CFLAGS can cause compilation errors with external libpng
Jayathirth D V
jdv at openjdk.org
Wed Dec 3 05:47:58 UTC 2025
On Fri, 14 Nov 2025 14:48:14 GMT, Kurt Miller <kurt at openjdk.org> wrote:
> When building with external libpng the PNG defines added to CFLAGS may conflict with the installed libpng header pnglibconf.h resulting in compilation errors. For example on OpenBSD/aarch64:
>
> `/usr/local/include/pnglibconf.h:207:9: error: 'PNG_ARM_NEON_OPT' macro redefined [-Werror,-Wmacro-redefined]`
>
> This moves all `-DPNG_*` into the case where internal libpng is used. This has only been tested with the tier1 github actions so needs to be checked on Linux/ppc and AIX.
Code change looks good to me. There is only one minor input about updating a comment.
I have given full client test run with this change.
make/modules/java.desktop/lib/ClientLibraries.gmk line 167:
> 165: ifeq ($(USE_EXTERNAL_LIBPNG), false)
> 166: LIBSPLASHSCREEN_HEADER_DIRS += libsplashscreen/libpng
> 167: LIBSPLASHSCREEN_CFLAGS += -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0
I think we can move these flags which are not specific to any OS/Architecture to src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h itself. But it should be handled in follow-up task not under this bug. Filed https://bugs.openjdk.org/browse/JDK-8372979 for the same.
make/modules/java.desktop/lib/ClientLibraries.gmk line 174:
> 172: endif
> 173:
> 174: # The external libpng submitted in the jdk is a reduced version
I think this comment should start with "The libpng bundled with jdk". Mentioning "external" at this level doesn't seem right. Since we are touching this part we can update the comment.
-------------
PR Review: https://git.openjdk.org/jdk/pull/28324#pullrequestreview-3533249426
PR Review Comment: https://git.openjdk.org/jdk/pull/28324#discussion_r2583689158
PR Review Comment: https://git.openjdk.org/jdk/pull/28324#discussion_r2583697212
More information about the client-libs-dev
mailing list