Bug 210297

Summary: java/openjdk8 + jsvc with javaagent: libinstrument.so: Undefined symbol "JLI_ManifestIterate"
Product: Ports & Packages Reporter: Alex Nordlund <deep.alexander>
Component: Individual Port(s)Assignee: Greg Lewis <glewis>
Status: Closed FIXED    
Severity: Affects Some People CC: girgen, glewis, iamasmith.home, rustamabd
Priority: --- Flags: bugzilla: maintainer-feedback? (java)
Version: Latest   
Hardware: amd64   
OS: Any   

Description Alex Nordlund 2016-06-15 07:18:46 UTC
If I add -javaagent:/usr/local/newrelic.jar jsvc fails to start the jvm, errors out with:
/usr/local/openjdk8/jre/lib/amd64/libinstrument.so: Undefined symbol "JLI_ManifestIterate"

If I LD_PRELOAD /usr/local/openjdk8/lib/amd64/jli/libjli.so then it works.

openjdk 1.8.0_92, freebsd 10.2, amd64, newrelic agent 3.29.0
Comment 1 Andrew Smith 2016-09-06 15:00:56 UTC
Could you set JAVA_HOME is set to /usr/local/openjdk8, jsvc defines a set of locations for libjli.so in locations.h but all candidate ones relevant to FreeBSD are relative to $JAVA_HOME.
Comment 2 Andrew Smith 2016-09-26 13:59:18 UTC
Alex, is this still an issue with JAVA_HOME set?
Comment 3 rustamabd 2017-01-08 10:51:29 UTC
Same thing happens to me with a JMX agent.

jsvc -javaagent:/usr/local/etc/jmx/JMXAgent.jar ...

Fails with:

/usr/local/openjdk8/jre/lib/amd64/libinstrument.so: Undefined symbol "JLI_ManifestIterate"

Strangely, it worked fine with openjdk8 8.112.16 (and previous versions), but fails now after upgrading to 8.112.16_2.

Setting JAVA_HOME doesn't help.
Comment 4 Palle Girgensohn freebsd_committer freebsd_triage 2017-04-04 21:59:35 UTC
Hi, I was just hit by this as well... It doesn't happen right away though, it happened after running 20 minutes.

Did you find a soultion?

Palle
Comment 5 Greg Lewis freebsd_committer freebsd_triage 2018-03-04 17:51:20 UTC
It looks like libinstrument.so requires libjli.so but isn't linked with it.
Comment 6 Greg Lewis freebsd_committer freebsd_triage 2018-03-04 17:55:43 UTC
In particular, I'd suggest looking at the build logic in

work/openjdk/jdk/make/lib/ServiceabilityLibraries.gmk

It has some BSD logic in there for libinstrument, but it looks like it isn't being picked up properly.
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-03-06 04:41:23 UTC
A commit references this bug:

Author: glewis
Date: Tue Mar  6 04:41:09 UTC 2018
New revision: 463688
URL: https://svnweb.freebsd.org/changeset/ports/463688

Log:
  . Link libinstrument.so with iconv and jli as intended.

  PR:		210297

Changes:
  head/java/openjdk8/Makefile
  head/java/openjdk8/files/patch-jdk-make-lib-ServiceabilityLibraries.gmk
Comment 8 Greg Lewis freebsd_committer freebsd_triage 2018-03-06 04:42:24 UTC
I've committed a change which links libinstrument.so with libjli.so as intended.  Let me know if that fixes the problem for you.
Comment 9 Greg Lewis freebsd_committer freebsd_triage 2018-03-27 07:12:31 UTC
Please reopen if you have problems.