Bug 157115 - lang/gcc46: gcj cannot compile Java code: helper classes are missing
Summary: lang/gcc46: gcj cannot compile Java code: helper classes are missing
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: Gerald Pfeifer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 13:10 UTC by Joerg Wunsch
Modified: 2011-06-02 23:20 UTC (History)
0 users

See Also:


Attachments
patch-lang_gcc46-ecj.diff (1.97 KB, patch)
2011-05-30 11:22 UTC, Matthias Andree
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Wunsch freebsd_committer freebsd_triage 2011-05-17 13:10:11 UTC
	When trying to compile print/pdftk with gcc46 (a minimum of gcc45
	is required, and Java support must have been comfigured for that),
	the compilation fails with:

	gcj46: error trying to exec 'ecj1': execvp: No such file or directory

	A short Internet search reveals that this means the ecj support
	package (jar file) is not installed.

	In contrast, lang/gcc45 includes that package, and compiling
	pdftk with that version succeeds.

How-To-Repeat: 	Install lang/gcc46, then try compiling print/pdftk.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-05-17 13:10:21 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gerald

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 gerald 2011-05-29 03:35:51 UTC
I have started to look into this, but first want (need) to make a 
change to this port related to upstream packaging changes which I
hope to commit this weekend.

Gerald
Comment 3 gerald 2011-05-29 14:20:48 UTC
Would you mind giving the patch below a try?

Greg, a while ago you hinted at the idea of having pdftk use OpenJDK. Do 
you think that's an option?  It's the only user of GCC's Java frontend 
from all I can tell which I'd like to remove (I think).

Gerald


Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/gcc46/Makefile,v
retrieving revision 1.495
diff -u -r1.495 Makefile
--- Makefile	29 May 2011 11:59:46 -0000	1.495
+++ Makefile	29 May 2011 13:18:30 -0000
@@ -94,6 +94,11 @@
 .endif
 
 .if ! defined(WITHOUT_JAVA)
+ECJ_JAR=	ecj-4.5.jar
+MASTER_SITES+=	${MASTER_SITE_SOURCEWARE:S|$|:ecj|}
+MASTER_SITE_SUBDIR+=	java/:ecj
+DISTFILES+=	${ECJ_JAR}:ecj
+EXTRACT_ONLY=	${DISTFILES:S|${ECJ_JAR}:ecj||}
 BUILD_DEPENDS+=	zip:${PORTSDIR}/archivers/zip
 EXTRA_PATCHES+=	${FILESDIR}/java-patch-hier
 MAN1+=		aot-compile${SUFFIX}.1 \
@@ -124,6 +129,10 @@
 INFO+=		gcc${SUFFIX}/cp-tools \
 		gcc${SUFFIX}/gcj
 PLIST_SUB+=	JAVA=""
+
+# Preps the source tree for the gcj build
+post-patch::
+	@${CP} ${DISTDIR}/${ECJ_JAR} ${SRCDIR}/ecj.jar
 .else
 CONFIGURE_ARGS+=--disable-libgcj
 PLIST_SUB+=	JAVA="@comment "
Index: distinfo
===================================================================
RCS file: /home/pcvs/ports/lang/gcc46/distinfo,v
retrieving revision 1.359
diff -u -r1.359 distinfo
--- distinfo	29 May 2011 11:59:46 -0000	1.359
+++ distinfo	29 May 2011 13:18:30 -0000
@@ -1,2 +1,4 @@
 SHA256 (gcc-4.6-20110527.tar.bz2) = 874f29526189defa134fa0c41f89cf1f572182bbca3b989d244a66beb2a78a3f
 SIZE (gcc-4.6-20110527.tar.bz2) = 67833234
+SHA256 (ecj-4.5.jar) = 98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781
+SIZE (ecj-4.5.jar) = 1470676
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/lang/gcc46/pkg-plist,v
retrieving revision 1.112
diff -u -r1.112 pkg-plist
--- pkg-plist	22 Feb 2011 18:56:53 -0000	1.112
+++ pkg-plist	29 May 2011 13:18:30 -0000
@@ -44,6 +44,7 @@
 %%JAVA%%bin/jv-convert%%SUFFIX%%
 %%JAVA%%bin/rebuild-gcj-db%%SUFFIX%%
 %%JAVA%%libdata/pkgconfig/libgcj-4.6.pc
+%%JAVA%%share/java/ecj.jar
 %%JAVA%%share/java/libgcj-%%GCC_VER%%.jar
 %%JAVA%%share/java/libgcj-tools-%%GCC_VER%%.jar
 @comment Insert PLIST.lib here
Comment 4 Gerald Pfeifer freebsd_committer freebsd_triage 2011-05-29 14:21:16 UTC
State Changed
From-To: open->feedback
Comment 5 Joerg Wunsch 2011-05-29 23:42:41 UTC
As gerald@FreeBSD.org wrote:

> Synopsis: lang/gcc46: gcj cannot compile Java code: helper classes are missing
> 
> State-Changed-From-To: open->feedback
> State-Changed-By: gerald
> State-Changed-When: Sun May 29 13:21:16 UTC 2011
> State-Changed-Why: 
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=157115

The patch in the PR failed to apply cleanly.

Using the following patch, pdftk appears to compile now.

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/lang/gcc46/Makefile,v
retrieving revision 1.494
diff -u -u -r1.494 Makefile
--- Makefile	21 May 2011 12:09:23 -0000	1.494
+++ Makefile	29 May 2011 20:22:13 -0000
@@ -98,6 +98,11 @@
 
 .if ! defined(WITHOUT_JAVA)
 DISTFILES+=	gcc-java-${VERSIONSTRING}${EXTRACT_SUFX}
+ECJ_JAR=	ecj-4.5.jar
+MASTER_SITES+=	${MASTER_SITE_SOURCEWARE:S|$|:ecj|}
+MASTER_SITE_SUBDIR+=	java/:ecj
+DISTFILES+=	${ECJ_JAR}:ecj
+EXTRACT_ONLY=	${DISTFILES:S|${ECJ_JAR}:ecj||}
 BUILD_DEPENDS+=	zip:${PORTSDIR}/archivers/zip
 EXTRA_PATCHES+=	${FILESDIR}/java-patch-hier
 MAN1+=		aot-compile${SUFFIX}.1 \
@@ -128,6 +133,10 @@
 INFO+=		gcc${SUFFIX}/cp-tools \
 		gcc${SUFFIX}/gcj
 PLIST_SUB+=	JAVA=""
+
+# Preps the source tree for the gcj build
+post-patch::
+	@${CP} ${DISTDIR}/${ECJ_JAR} ${SRCDIR}/ecj.jar
 .else
 CONFIGURE_ARGS+=--disable-libgcj
 PLIST_SUB+=	JAVA="@comment "
Index: distinfo
===================================================================
RCS file: /home/ncvs/ports/lang/gcc46/distinfo,v
retrieving revision 1.358
diff -u -u -r1.358 distinfo
--- distinfo	21 May 2011 12:09:23 -0000	1.358
+++ distinfo	29 May 2011 15:58:38 -0000
@@ -1,5 +1,7 @@
 SHA256 (gcc-core-4.6-20110520.tar.bz2) = c1beb5e7385f76005957cf4245306a846cdd8a5bc35ff78b53538c97737233b2
 SIZE (gcc-core-4.6-20110520.tar.bz2) = 26329536
+SHA256 (ecj-4.5.jar) = 98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781
+SIZE (ecj-4.5.jar) = 1470676
 SHA256 (gcc-fortran-4.6-20110520.tar.bz2) = b0b58d51690cf4a1d05e0206606a4407f85e94693d48dda2025295dc8158e4a1
 SIZE (gcc-fortran-4.6-20110520.tar.bz2) = 1545529
 SHA256 (gcc-g++-4.6-20110520.tar.bz2) = 1f2287e1766aae0d6333a763e3a66416e17b58e543a1b13fbe7094c1d0c88449
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/lang/gcc46/pkg-plist,v
retrieving revision 1.112
diff -u -u -r1.112 pkg-plist
--- pkg-plist	22 Feb 2011 18:56:53 -0000	1.112
+++ pkg-plist	29 May 2011 15:58:38 -0000
@@ -44,6 +44,7 @@
 %%JAVA%%bin/jv-convert%%SUFFIX%%
 %%JAVA%%bin/rebuild-gcj-db%%SUFFIX%%
 %%JAVA%%libdata/pkgconfig/libgcj-4.6.pc
+%%JAVA%%share/java/ecj.jar
 %%JAVA%%share/java/libgcj-%%GCC_VER%%.jar
 %%JAVA%%share/java/libgcj-tools-%%GCC_VER%%.jar
 @comment Insert PLIST.lib here

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
Comment 6 Matthias Andree freebsd_committer freebsd_triage 2011-05-30 11:22:32 UTC
Updated patch (for upodated lang/gcc46 port) that works for me (i. e. 
lets me successfully install pdftk, and combine a few .pdfs to a new 
document on amd64) attached.

-- 
Matthias Andree
Comment 7 Greg Larkin freebsd_committer freebsd_triage 2011-05-31 20:56:38 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/29/11 9:20 AM, Gerald Pfeifer wrote:
> Would you mind giving the patch below a try?
> 
> Greg, a while ago you hinted at the idea of having pdftk use OpenJDK. Do 
> you think that's an option?  It's the only user of GCC's Java frontend 
> from all I can tell which I'd like to remove (I think).
> 
> Gerald
> 
[...]

A while back, I did start the process of converting pdftk to build with
OpenJDK, but I didn't get to the linking phase.  I'll research whether
gcc can link C++ objects with Java libs generated by OpenJDK.

I sent an email to the pdftk maintainer a while back to ask for some
advice, but I don't believe I ever heard back from him.  I'll ping him
again, too.

Thank you,
Greg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3lR/YACgkQ0sRouByUApDDfQCgzWVX1FC2o4paDgMOpcm20AuJ
BggAn1cLv8PjFH3d+2P8dfXcsNwz5yYq
=yD5s
-----END PGP SIGNATURE-----
Comment 8 dfilter service freebsd_committer freebsd_triage 2011-06-02 23:12:02 UTC
gerald      2011-06-02 22:11:48 UTC

  FreeBSD ports repository

  Modified files:
    lang/gcc46           Makefile distinfo pkg-plist 
  Log:
  Complete Java support by providing a pre-built copy of ecj.jar.
  
  PR:             157115
  Tested by:      joerg, mandree
  
  Revision  Changes    Path
  1.496     +9 -0      ports/lang/gcc46/Makefile
  1.360     +2 -0      ports/lang/gcc46/distinfo
  1.113     +2 -1      ports/lang/gcc46/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 9 Gerald Pfeifer freebsd_committer freebsd_triage 2011-06-02 23:13:07 UTC
State Changed
From-To: feedback->closed

Thanks for your report and testing, Joerg and Matthias, really 
appreciated.