Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Apr 2007 19:44:00 GMT
From:      Jonas Wolz<jonas.wolz@freenet.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/111544: WITH_JAVA_AWT=yes does not work with lang/gcc41
Message-ID:  <200704131944.l3DJi0jI005267@www.freebsd.org>
Resent-Message-ID: <200704131950.l3DJo1ui013461@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         111544
>Category:       ports
>Synopsis:       WITH_JAVA_AWT=yes does not work with lang/gcc41
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 13 19:50:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Jonas Wolz
>Release:        6.2-RELEASE
>Organization:
>Environment:
FreeBSD nobby 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Sun Jan 21 18:11:14 CET 2007     jonas@nobby:/usr/obj/usr/src/sys/JW_NOBBY  i386

>Description:
When building devel/gcc41-withgcjawt or devel/gcc41 with WITH_JAVA_AWT defined the AWT library seems not to be built.
This results in the error "java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit" when you try to run a java application.

>How-To-Repeat:
Copy the following source code into the file "Hello2.java", compile it with "gcj41 Hello2.java --main=Hello2" and execute ./a.out

//// begin Hello2.java ////
import javax.swing.*;
public class Hello2 extends JFrame {
	public static void main(String[] args) {
		Hello2 h = new Hello2();
		h.setVisible(true);
	}

	public Hello2() {
		super("Hello World");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		pack();
	}
}
//// end Hello2.java ////
>Fix:
Apply the attached patch to the port's Makefile.
I don't know if it is the cleanest or best solution because I have no experience with creating ports but it works for me.

Patch attached with submission follows:

*** Makefile.old	Tue Apr 10 07:24:27 2007
--- Makefile	Fri Apr 13 18:58:37 2007
***************
*** 40,43 ****
--- 40,51 ----
  NOMANCOMPRESS=	yes	# too hard to deal with differences on 5-cur and releng4
  
+ 
+ .if defined(WITH_JAVA_AWT)
+ LIB_DEPENDS+=	cairo.2:${PORTSDIR}/graphics/cairo
+ USE_GNOME=	gtk20 libartlgpl2
+ CONFIGURE_ARGS+=	--enable-java-awt=gtk,xlib \
+ 			--enable-gtk-cairo
+ .endif
+ 
  .include <bsd.port.pre.mk>
  
***************
*** 113,122 ****
  PLIST_SUB+=	JAVA="@comment "
  
- .if defined(WITH_JAVA_AWT)
- LIB_DEPENDS+=	cairo.2:${PORTSDIR}/graphics/cairo
- USE_GNOME=	gtk20 libartlgpl2
- CONFIGURE_ARGS+=	--enable-java-awt=gtk,xlib \
- 			--enable-gtk-cairo
- .endif
  
  .endif
--- 121,124 ----

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704131944.l3DJi0jI005267>