JDK-8364177 : JDK fails to build due to undefined symbol in libpng on LoongArch64
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,17,21,25,26
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: other
  • Submitted: 2025-07-28
  • Updated: 2025-08-11
  • Resolved: 2025-08-04
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 25 JDK 26
25.0.2Fixed 26 b10Fixed
Related Reports
Relates :  
Description
Steps (on loongarch64 platforms):
$ bash configure --with-boot-jdk=../jdk-24 --with-jvm-variants=zero
$ make images

Errors:
Creating jdk/modules/jdk.jpackage/jdk/jpackage/internal/resources/libjpackageapplauncheraux.so from 19 file(s)
/usr/bin/ld: /root/aoqi/tmp/jdk-ls/build/linux-loongarch64-zero-release/support/native/java.desktop/libsplashscreen/pngrutil.o: in function `png_do_read_interlace':
make/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c:3961:(.text+0x2e7c): undefined reference to `png_init_filter_functions_lsx'
collect2: error: ld returned 1 exit status
gmake[3]: *** [lib/ClientLibraries.gmk:224: /root/aoqi/tmp/jdk-ls/build/linux-loongarch64-zero-release/support/modules_libs/java.desktop/libsplashscreen.so] Error 1
gmake[3]: *** Waiting for unfinished jobs....
gmake[2]: *** [make/Main.gmk:188: java.desktop-libs] Error 2
gmake[2]: *** Waiting for unfinished jobs....
Creating ct.sym classes

Cause:
After https://bugs.openjdk.org/browse/JDK-8329004, the following code was added. 

#ifndef PNG_LOONGARCH_LSX_OPT
#  if defined(__loongarch_sx)
#     define PNG_LOONGARCH_LSX_OPT 1
#  else
#     define PNG_LOONGARCH_LSX_OPT 0
#  endif
#endif

Some compilers on LoongArch64 platforms enable __loongarch_sx, which causes PNG_LOONGARCH_LSX_OPT to be defined and an undefined error occurs. Refer to https://bugs.openjdk.org/browse/JDK-8078245, add -DPNG_LOONGARCH_LSX_OPT=0 to LIBSPLASHSCREEN_CFLAGS flags.
Comments
[jdk25u-fix-request] Approval Request from Ao Qi The backport is clean. This patch fixes a build issue with the zero build on some loongarch platforms. This patch affects a client-libs CFLAGS macro definition, which only works on LoongArch. The loongarch zero builds passed.
06-08-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk25u/pull/61 Date: 2025-08-05 01:50:00 +0000
05-08-2025

Changeset: a9f3d3a2 Branch: master Author: Ao Qi <aoqi@openjdk.org> Committer: Erik Joelsson <erikj@openjdk.org> Date: 2025-08-04 12:37:11 +0000 URL: https://git.openjdk.org/jdk/commit/a9f3d3a290060f98967feaad2fa03ef077a64534
04-08-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/26501 Date: 2025-07-28 09:25:34 +0000
28-07-2025