Bug 236759 - java/openjdk11: jshell fails to launch due to unresolved libiconv symbols
Summary: java/openjdk11: jshell fails to launch due to unresolved libiconv symbols
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Jung-uk Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-24 12:56 UTC by Olivier Cinquin
Modified: 2019-03-28 23:38 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Cinquin 2019-03-24 12:56:20 UTC
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
Comment 1 Greg Lewis freebsd_committer 2019-03-26 20:43:14 UTC
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.
Comment 2 commit-hook freebsd_committer 2019-03-26 20:48:25 UTC
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
Comment 3 Jung-uk Kim freebsd_committer 2019-03-28 23:12:27 UTC
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.
Comment 4 commit-hook freebsd_committer 2019-03-28 23:19:38 UTC
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
Comment 5 commit-hook freebsd_committer 2019-03-28 23:27:47 UTC
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
Comment 6 Jung-uk Kim freebsd_committer 2019-03-28 23:38:40 UTC
Both java/openjdk11 and java/openjdk12 should be fixed now.  Thanks!