jshell from the openjdk11 or openjdk12 ports won't launch. It fails as follows: Launching JShell execution engine threw: ld-elf.so.1: /usr/local/openjdk11/lib/libjdwp.so: Undefined symbol "libiconv_open" The problem can be worked around as follows: env LD_PRELOAD=/usr/local/lib/libiconv.so /usr/local/openjdk11/bin/jshell
This is due to mismatches between preprocessor and linker paths. The FreeBSD system header iconv.h and the iconv routines in libc are sufficient for what libjdwp.so needs. However, due to the current build infrastructure, -I/usr/local/include is used when compiling libjdwp files, meaning that the version of iconv.h from /usr/local/include is picked up instead, and the iconv routines in libc don't resolve all of the symbols defined there. The fix is to just use the system header and libc and not pick up the third party iconv library at all. Or at least that gets me a jshell that starts. I'll commit that shortly. The fix still needs to be forward ported to openjdk12.
A commit references this bug: Author: glewis Date: Tue Mar 26 20:48:06 UTC 2019 New revision: 496923 URL: https://svnweb.freebsd.org/changeset/ports/496923 Log: Fixes for include path, jshell, and process issues. * Put MD specific include files (e.g. jni_md.h) in a subdirectory named 'freebsd' rather than 'bsd'. [1] * Remove the necessity to always have /usr/local/include in the header paths and linker paths. This allows jshell to use the system iconv.h rather than the third party one and link correctly. [2] * Fix getting process commands and arguments on FreeBSD. * Bump PORTREVISION. All fixes need forward porting to openjdk12. PR: 236754 [1], 236759 [2] Submitted by: Kurt Miller [2] Changes: head/java/openjdk11/Makefile head/java/openjdk11/files/patch-make_autoconf_flags-cflags.m4 head/java/openjdk11/files/patch-make_autoconf_lib-bundled.m4 head/java/openjdk11/files/patch-make_autoconf_lib-cups.m4 head/java/openjdk11/files/patch-make_autoconf_libraries.m4 head/java/openjdk11/files/patch-make_autoconf_platform.m4 head/java/openjdk11/files/patch-make_autoconf_spec.gmk.in head/java/openjdk11/files/patch-make_autoconf_toolchain.m4 head/java/openjdk11/files/patch-make_lib_Awt2dLibraries.gmk head/java/openjdk11/files/patch-src_hotspot_os_bsd_os__bsd.cpp head/java/openjdk11/files/patch-src_java.base_bsd_native_libjava_ProcessHandleImpl__bsd.c
Unfortunately, r496923 wasn't enough for me. % /usr/local/openjdk11/bin/java -jar /usr/local/openjdk11/demo/jfc/SwingSet2/SwingSet2.jar ld-elf.so.1: /usr/local/openjdk11/lib/libsplashscreen.so: Undefined symbol "libiconv_open" libjdwp.so and libinstrument.so do not need anything from ${LOCALBASE} but libsplashscreen.so does. I'll commit a patch for this problem.
A commit references this bug: Author: jkim Date: Thu Mar 28 23:19:01 UTC 2019 New revision: 497060 URL: https://svnweb.freebsd.org/changeset/ports/497060 Log: Refine r496923. libinstrument.so and libjdwp.so do not need anything from $LOCALBASE but libsplashscreen.so does. For example, % cd /usr/local/openjdk11 % bin/java -jar demo/jfc/SwingSet2/SwingSet2.jar ld-elf.so.1: /usr/local/openjdk11/lib/libsplashscreen.so: Undefined symbol "libiconv_open" PR: 236759 Changes: head/java/openjdk11/Makefile head/java/openjdk11/files/patch-make_autoconf_libraries.m4
A commit references this bug: Author: jkim Date: Thu Mar 28 23:27:13 UTC 2019 New revision: 497061 URL: https://svnweb.freebsd.org/changeset/ports/497061 Log: Fix iconv(3) issues. PR: 236759 Changes: head/java/openjdk12/Makefile head/java/openjdk12/files/patch-make_autoconf_libraries.m4
Both java/openjdk11 and java/openjdk12 should be fixed now. Thanks!