JDK-8332129 : Cross-compile build error after JDK-8283326
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 23
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux
  • CPU: aarch64
  • Submitted: 2024-05-13
  • Updated: 2024-05-16
  • Resolved: 2024-05-16
Related Reports
Relates :  
Description
reproducer:
$ bash ./configure --with-debug-level=fastdebug --openjdk-target=aarch64-linux-gnu --with-devkit=/ws/aarch64/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/ --with-sysroot=/ws/aarch64/sysroot --with-freetype=bundled --disable-warnings-as-errors --with-boot-jdk=/ws/jdk-22 '--with-extra-cflags=-D_GLIBCXX_HAVE_OBSOLETE_ISNAN=1 -D_GLIBCXX_HAVE_OBSOLETE_ISINF=1' ; make bundles

aarch64 build output:
=== Output from failing command(s) repeated here ===
* For target support_test_hotspot_jtreg_native_support_exeinvoke_BUILD_TEST_exeinvoke_run_ld:
/ws/aarch64/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.4.1/../../../../aarch64-linux-gnu/lib/../lib64/libstdc++.so: undefined reference to `__cxa_thread_atexit_impl@GLIBC_2.18'
collect2: error: ld returned 1 exit status
* For target support_test_hotspot_jtreg_native_support_exestack-gap_BUILD_TEST_exestack-gap_run_ld:
/ws/aarch64/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.4.1/../../../../aarch64-linux-gnu/lib/../lib64/libstdc++.so: undefined reference to `__cxa_thread_atexit_impl@GLIBC_2.18'
collect2: error: ld returned 1 exit status
* For target support_test_hotspot_jtreg_native_support_exestack-tls_BUILD_TEST_exestack-tls_run_ld:
/ws/aarch64/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.4.1/../../../../aarch64-linux-gnu/lib/../lib64/libstdc++.so: undefined reference to `__cxa_thread_atexit_impl@GLIBC_2.18'
collect2: error: ld returned 1 exit status
* For target support_test_jdk_jtreg_native_support_exeBasicSleep_BUILD_TEST_exeBasicSleep_run_ld:
/ws/aarch64/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.4.1/../../../../aarch64-linux-gnu/lib/../lib64/libstdc++.so: undefined reference to `__cxa_thread_atexit_impl@GLIBC_2.18'
collect2: error: ld returned 1 exit status
* For target support_test_jdk_jtreg_native_support_exeCallerAccessTest_BUILD_TEST_exeCallerAccessTest_run_ld:
/ws/aarch64/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.4.1/../../../../aarch64-linux-gnu/lib/../lib64/libstdc++.so: undefined reference to `__cxa_thread_atexit_impl@GLIBC_2.18'
collect2: error: ld returned 1 exit status
* For target support_test_lib-test_jtreg_native_support_exejvm-test-launcher_BUILD_TEST_exejvm-test-launcher_run_ld:
/ws/aarch64/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.4.1/../../../../aarch64-linux-gnu/lib/../lib64/libstdc++.so: undefined reference to `__cxa_thread_atexit_impl@GLIBC_2.18'
collect2: error: ld returned 1 exit status
=== End of repeated output ===

Workaround: return allow-shlib-undefined option removed by JDK-8283326 change:
```
diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4
index c4a75fb89c3..acb815515a2 100644
--- a/make/autoconf/flags-ldflags.m4
+++ b/make/autoconf/flags-ldflags.m4
@@ -118,6 +118,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],

   # Setup LDFLAGS for linking executables
   if test "x$TOOLCHAIN_TYPE" = xgcc; then
+    EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
     # Enabling pie on 32 bit builds prevents the JVM from allocating a continuous
     # java heap.
     if test "x$OPENJDK_TARGET_CPU_BITS" != "x32"; then
```
Comments
Reclosing as "Won't Fix" instead of Resolving as...
16-05-2024

[~bulasevich] The resolution "Fixed" is only used for issues where a change is integrated. Please reopen and use the proper resolution. See https://openjdk.org/guide/#resolving-or-closing-an-issue for more information.
15-05-2024

I'm closing the issue as it must be fixed by correcting cross-build toolchain sysroot
14-05-2024