Here's the error I got: Compiling up to 2774 files for java.desktop gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[4]: Entering directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' Compiling up to 11 files for jdk.jstatd gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ21WB_HandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ24WB_HandshakeReadMonitorsE19ReadMonitorsClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ26WB_AsyncHandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZL20reinitialize_itablesvE18ReinitTableClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN12JvmtiEnvBase27check_for_periodic_clean_upEvE28ThreadInsideIterationClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN14ClassLoaderExt20process_module_tableEP10JavaThreadP16ModuleEntryTableE19ModulePathsGatherer' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN15ClassLoaderData19demote_strong_rootsEvE25TransitionRootsOopClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN15G1RemSetSummary6updateEvE11CollectData' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16DefNewGeneration26remove_forwarding_pointersEvE22ResetForwardedMarkWord' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet22set_active_all_threadsEbbE22SetThreadActiveClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet23abandon_partial_markingEvE25AbandonThreadQueueClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16java_lang_Thread21async_get_stack_traceEP7oopDescP10JavaThreadE20GetStackTraceClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN17BarrierSetNMethod21nmethod_entry_barrierEP7nmethodE19OopKeepAliveClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN18G1ConcurrentRefine30get_and_reset_refinement_statsEvE12CollectStats' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet22abandon_logs_and_statsEvE23AbandonThreadLogClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN7Threads25change_thread_claim_tokenEvE11ResetClaims' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN9G1CardSet14num_containersEvE21GetNumberOfContainers' failed: symbol not defined c++: error: linker command failed with exit code 1 (use -v to see invocation) gmake[4]: *** [lib/CompileJvm.gmk:155: /usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/build/bsd-x86_64-server-release/support/modules_libs/java.base/server/libjvm.so] Error 1 gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make/hotspot' gmake[3]: *** [make/Main.gmk:252: hotspot-server-libs] Error 2 gmake[3]: *** Waiting for unfinished jobs.... gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[4]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make' gmake[3]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1' ERROR: Build failed for target 'images' in configuration 'bsd-x86_64-server-release' (exit code 2) gmake[3]: Entering directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1' === Output from failing command(s) repeated here === * For target hotspot_variant-server_libjvm_objs_BUILD_LIBJVM_link: c++: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument] c++: warning: argument unused during compilation: '-static-libgcc' [-Wunused-command-line-argument] ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ21WB_HandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ24WB_HandshakeReadMonitorsE19ReadMonitorsClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ26WB_AsyncHandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZL20reinitialize_itablesvE18ReinitTableClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN12JvmtiEnvBase27check_for_periodic_clean_upEvE28ThreadInsideIterationClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN14ClassLoaderExt20process_module_tableEP10JavaThreadP16ModuleEntryTableE19ModulePathsGatherer' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN15ClassLoaderData19demote_strong_rootsEvE25TransitionRootsOopClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN15G1RemSetSummary6updateEvE11CollectData' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16DefNewGeneration26remove_forwarding_pointersEvE22ResetForwardedMarkWord' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet22set_active_all_threadsEbbE22SetThreadActiveClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet23abandon_partial_markingEvE25AbandonThreadQueueClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16java_lang_Thread21async_get_stack_traceEP7oopDescP10JavaThreadE20GetStackTraceClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN17BarrierSetNMethod21nmethod_entry_barrierEP7nmethodE19OopKeepAliveClosure' failed: symbol not defined ... (rest of output omitted) * All command lines available in /usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/build/bsd-x86_64-server-release/make-support/failure-logs. === End of repeated output === No indication of failed target found. HELP: Try searching the build log for '] Error'. HELP: Run 'make doctor' to diagnose build problems. gmake[3]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1' gmake[2]: *** [/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make/Init.gmk:323: main] Error 2 gmake[2]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1' gmake[1]: *** [/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1/make/Init.gmk:189: images] Error 2 gmake[1]: Leaving directory '/usr/ports/java/openjdk21/work/jdk21u-jdk-21.0.1-12-1' *** Error code 1 Stop.
The issue seems similar to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274106
In fact, the following patch (copied and pasted), inspired from https://cgit.freebsd.org/ports/commit/?id=a2f61c3e68e228e7d4186d18672da9d39218e289, fixes the compilation, but someone more expert with the port should check it. diff --git a/java/openjdk21/Makefile b/java/openjdk21/Makefile index fdeab8ad3..37d53258c 100644 --- a/java/openjdk21/Makefile +++ b/java/openjdk21/Makefile @@ -148,6 +148,7 @@ EXTRA_CFLAGS+= -Wno-error=deprecated-non-prototype .endif CONFIGURE_ARGS+= --with-extra-cflags="${EXTRA_CFLAGS}" CONFIGURE_ARGS+= --with-extra-cxxflags="${EXTRA_CFLAGS}" +CONFIGURE_ARGS+= --with-extra-ldflags="-Wl,--undefined-version" .endif .endif
(In reply to Matteo Riondato from comment #2) I haven't got time to do a build now, but that looks reasonable enough, if it actually works. :)
Same here with: 13.3-PRERELEASE 6a7eaf04f GENERIC amd64
This happens with Java 19 as well here.
I have good news and bad news: Bad news: https://cgit.freebsd.org/ports/commit/?id=a2f61c3e68e228e7d4186d18672da9d39218e289 does NOT work Good news: https://cgit.freebsd.org/ports/commit/?id=2bd641cc196eebc4dcb3df64df89fe30934106c0 seems to work here on OpenJDK 19. I will try to verify against OpenJDK 21 as well.
Here is a patch: https://reviews.freebsd.org/D43620 Works for me on 13.3-PRERELEASE and llvm 17 in base.
*** Bug 276519 has been marked as a duplicate of this bug. ***
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=a1f91b22f1fc8ada691c47864c6365731cf8ef86 commit a1f91b22f1fc8ada691c47864c6365731cf8ef86 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2023-11-12 20:00:48 +0000 Commit: Michael Osipov <michaelo@FreeBSD.org> CommitDate: 2024-01-26 22:23:12 +0000 java/openjdk{19,20,21}: fix build with lld 17 Building java/openjdk{19,20,21} with lld 17 results in the following link errors: ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ21WB_HandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ24WB_HandshakeReadMonitorsE19ReadMonitorsClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ26WB_AsyncHandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZL20reinitialize_itablesvE18ReinitTableClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN12JvmtiEnvBase27check_for_periodic_clean_upEvE28ThreadInsideIterationClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN15G1RemSetSummary6updateEvE11CollectData' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet22set_active_all_threadsEbbE22SetThreadActiveClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet23abandon_partial_markingEvE25AbandonThreadQueueClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN18G1ConcurrentRefine30get_and_reset_refinement_statsEvE12CollectStats' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet12abandon_logsEvE23AbandonThreadLogClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet16concatenate_logsEvE27ConcatenateThreadLogClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet30get_and_reset_refinement_statsEvE12CollectStats' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN7Threads25change_thread_claim_tokenEvE11ResetClaims' failed: symbol not defined This is because lld 17 defaults to errors when undefined symbols are referenced in linker version scripts. The problem is due to the Makefile JvmMapfile.gmk, which generates a linker version script. It uses "nm --defined-only" to dump symbols in object files, but this also includes local (hidden) symbols. Add "--extern-only" to make it only dump global symbols. PR: 276425 Approved by: otis (mentor), dim MFH: 2024Q1 Differential Revision: https://reviews.freebsd.org/D43620 .../patch-make_hotspot_lib_JvmMapfile.gmk (new) | 20 ++++++++++++++++++++ .../patch-make_hotspot_lib_JvmMapfile.gmk (new) | 20 ++++++++++++++++++++ .../patch-make_hotspot_lib_JvmMapfile.gmk (new) | 20 ++++++++++++++++++++ 3 files changed, 60 insertions(+)
Applied and backported.
A commit in branch 2024Q1 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=cfb52bd42c007e6e909bc915f8081a1b033a7bfd commit cfb52bd42c007e6e909bc915f8081a1b033a7bfd Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2023-11-12 20:00:48 +0000 Commit: Michael Osipov <michaelo@FreeBSD.org> CommitDate: 2024-01-26 22:25:04 +0000 java/openjdk{19,20,21}: fix build with lld 17 Building java/openjdk{19,20,21} with lld 17 results in the following link errors: ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ21WB_HandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ24WB_HandshakeReadMonitorsE19ReadMonitorsClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZ26WB_AsyncHandshakeWalkStackE16TraceSelfClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZL20reinitialize_itablesvE18ReinitTableClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN12JvmtiEnvBase27check_for_periodic_clean_upEvE28ThreadInsideIterationClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN15G1RemSetSummary6updateEvE11CollectData' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet22set_active_all_threadsEbbE22SetThreadActiveClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN16SATBMarkQueueSet23abandon_partial_markingEvE25AbandonThreadQueueClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN18G1ConcurrentRefine30get_and_reset_refinement_statsEvE12CollectStats' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet12abandon_logsEvE23AbandonThreadLogClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet16concatenate_logsEvE27ConcatenateThreadLogClosure' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN19G1DirtyCardQueueSet30get_and_reset_refinement_statsEvE12CollectStats' failed: symbol not defined ld: error: version script assignment of 'SUNWprivate_1.1' to symbol '_ZTVZN7Threads25change_thread_claim_tokenEvE11ResetClaims' failed: symbol not defined This is because lld 17 defaults to errors when undefined symbols are referenced in linker version scripts. The problem is due to the Makefile JvmMapfile.gmk, which generates a linker version script. It uses "nm --defined-only" to dump symbols in object files, but this also includes local (hidden) symbols. Add "--extern-only" to make it only dump global symbols. PR: 276425 Approved by: otis (mentor), dim MFH: 2024Q1 Differential Revision: https://reviews.freebsd.org/D43620 (cherry picked from commit a1f91b22f1fc8ada691c47864c6365731cf8ef86) .../patch-make_hotspot_lib_JvmMapfile.gmk (new) | 20 ++++++++++++++++++++ .../patch-make_hotspot_lib_JvmMapfile.gmk (new) | 20 ++++++++++++++++++++ .../patch-make_hotspot_lib_JvmMapfile.gmk (new) | 20 ++++++++++++++++++++ 3 files changed, 60 insertions(+)