Bug 186956 - Remote debugging on java/openjdk7 fails with "/usr/local/openjdk7/jre/lib/amd64/libnpt.so: Undefined symbol "libiconv_open"
Summary: Remote debugging on java/openjdk7 fails with "/usr/local/openjdk7/jre/lib/amd...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Greg Lewis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-22 08:10 UTC by Jonathan Chen
Modified: 2014-03-05 21:10 UTC (History)
0 users

See Also:


Attachments
openjdk7.patch (684 bytes, patch)
2014-03-03 22:13 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Chen 2014-02-22 08:10:00 UTC
Starting up tomcat-7 with additional debug flags: "-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n" results in:

/usr/local/openjdk7/jre/lib/amd64/libnpt.so: Undefined symbol "libiconv_open"

Sure enough:

8:53pm> nm /usr/local/openjdk7/jre/lib/amd64/libnpt.so | grep iconv 
0000000000002070 t iconvConvert
                 U libiconv
                 U libiconv_close
                 U libiconv_open

This is because I also have libiconv installed, and openjdk/jdk/src/solaris/instrument/EncodingSupport_md.c is including /usr/local/include/iconv.h instead of /usr/include/iconv.h during compilation from its: #include <iconv.h> directive.

Fix: 

A workaround is to shift /usr/local/include/iconv.h out of the way during the build (and restore once complete).

A possible fix would be to patch EncodingSupport_md.c to force it to use the base system's iconv.h during post-patch?
How-To-Repeat: Install libiconv.
Build java/openjdk7
Comment 1 Edwin Groothuis freebsd_committer 2014-02-22 20:45:51 UTC
Responsible Changed
From-To: freebsd-ports-bugs->glewis

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Tijl Coosemans freebsd_committer 2014-03-03 22:13:29 UTC
Jonathan,

Can you give the attached patch a try?
Comment 3 Jonathan Chen 2014-03-04 21:15:08 UTC
On 4 March 2014 11:13, Tijl Coosemans <tijl@freebsd.org> wrote:
> Jonathan,
>
> Can you give the attached patch a try?

It appears to have built correctly, without the libiconv symbol in libntp.so

Looks good!
-- 
Jonathan Chen <jonc@chen.org.nz>
Comment 4 dfilter service freebsd_committer 2014-03-05 20:59:59 UTC
Author: tijl
Date: Wed Mar  5 20:59:50 2014
New Revision: 347142
URL: http://svnweb.freebsd.org/changeset/ports/347142
QAT: https://qat.redports.org/buildarchive/r347142/

Log:
  - Include bsd.port.pre.mk before testing if ICONV_LIB is empty.  It is
    always empty without this. [1]
  - Add -DLIBICONV_PLUG to CFLAGS to enforce the use of libc iconv even when
    libiconv is installed. [2]
  
  PR:		ports/184204 [1], ports/184782 [1], ports/186956 [2]
  Approved by:	glewis (maintainer)

Modified:
  head/java/openjdk7/Makefile

Modified: head/java/openjdk7/Makefile
==============================================================================
--- head/java/openjdk7/Makefile	Wed Mar  5 20:31:02 2014	(r347141)
+++ head/java/openjdk7/Makefile	Wed Mar  5 20:59:50 2014	(r347142)
@@ -3,7 +3,7 @@
 
 PORTNAME=	openjdk
 PORTVERSION=	${JDK_MAJOR_VERSION}.${PORT_MINOR_VERSION}.${PORT_BUILD_NUMBER}
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	1
 CATEGORIES=	java devel
 MASTER_SITES=	http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}u${JDK_MINOR_VERSION}/promoted/b${JDK_BUILD_NUMBER}/ \
@@ -138,6 +138,12 @@ PATCH_DEPENDS+=	gpatch:${PORTSDIR}/devel
 PATCH=		gpatch
 .endif
 
+.include <bsd.port.pre.mk>
+
+.if empty(ICONV_LIB)
+MAKE_ENV+=	EXTRA_CFLAGS=-DLIBICONV_PLUG
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} "s|%%LOCALBASE%%|${LOCALBASE}|" \
 		${WRKSRC}/hotspot/src/os/bsd/vm/os_bsd.cpp
@@ -180,4 +186,4 @@ post-install:
 	# Register the VM
 	"${LOCALBASE}/bin/registervm" "${INSTALLDIR}/bin/java # OpenJDK${JDK_MAJOR_VERSION}"
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Tijl Coosemans freebsd_committer 2014-03-05 21:01:43 UTC
State Changed
From-To: open->closed

Fixed in r347142.