Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 91340 - SWT library segfaults on amd64
Summary: SWT library segfaults on amd64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: AMD64 Linux
: High blocker
Assignee: Java team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2005-05-03 12:02 UTC by Ricardo Correia
Modified: 2005-05-04 04:53 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
swt-3.1_pre5.ebuild (swt-3.1_pre5.ebuild,4.19 KB, text/plain)
2005-05-03 13:36 UTC, Ricardo Correia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ricardo Correia 2005-05-03 12:02:01 UTC
I can successfully emerge swt-3.0-r2 and swt-3.1_pre2, but in the process it generates hundreds of warnings like this:
warning: cast to pointer from integer of different size

But when I try to run an SWT program (I've tried a simple SWT Hello World and Azureus), it always segfaults giving this stack trace:

Stack: [0x00007fffffe00000,0x0000800000000000),  sp=0x00007fffffffc668,  free space=2033k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libc.so.6+0x6fb3b]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.eclipse.swt.internal.gtk.OS.memmove([BII)V+0
j  org.eclipse.swt.internal.Converter.wcsToMbcs(Ljava/lang/String;[CZ)[B+68
j  org.eclipse.swt.internal.Converter.wcsToMbcs(Ljava/lang/String;Ljava/lang/String;Z)[B+23
j  org.eclipse.swt.widgets.Display.<clinit>()V+11
v  ~StubRoutines::call_stub
j  SWTHello.main([Ljava/lang/String;)V+0
v  ~StubRoutines::call_stub


Reproducible: Always
Steps to Reproduce:
1. emerge swt
2. Run any SWT program
3.

Actual Results:  
segfault

Expected Results:  
It shouldn't have segfaulted..

PORTAGE_GPG_DIR is invalid. Removing gpg from FEATURES.
Portage 2.0.51.19 (default-linux/amd64/2005.0, gcc-3.4.3, glibc-2.3.4.20041102-
r1, 2.6.11-gentoo-r6 x86_64)
=================================================================
System uname: 2.6.11-gentoo-r6 x86_64 AMD Athlon(tm) 64 Processor 3000+
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.4-r1,dev-lang/python-2.4-r2 [2.4 (#1, 
Feb 25 2005, 20:46:42)]
dev-lang/python:     2.3.4-r1, 2.4-r2
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.6.3, 1.4_p6, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r4
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CFLAGS="-march=athlon64 -mtune=athlon64 -ffast-math -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/
share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /
usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon64 -mtune=athlon64 -ffast-math -O2 -pipe"
DISTDIR="/usr/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox strict"
GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ http://
gentoo.blueyonder.co.uk http://ftp.snt.utwente.nl/pub/os/linux/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="amd64 X a52 aac aalib acpi acpi4linux adns aio alsa aotuv apache2 arts 
async atm audiofile authdaemond avi bash-completion bcmath beepmp berkdb bitmap-
fonts bluetooth bmp bzip2 bzlib c++ cairo calendar cdparanoia cdr crypt cups 
curl dga doc dvd dvdr dvdread edl emul-linux encode ex exif fam fastcgi flac 
fortran ftp gd gdbm gif gimpprint gimpshop gmp gnutls gphoto2 gpm gtk gtk2 hal 
hotplug icq imagemagick imap imlib innodb ipv6 irmc jabber java javascript jp2 
jpeg jpeg2k junit kde lesstif libclamav libg++ libwww lirc live lzo lzw lzw-tiff 
mad maildir maildrop matroska mbox md5sum mikmod mime mmap mng motif mozilla mp3 
mpeg msn ncurses noantlr nobcel nobeanutils nobsh nocommonslogging nocommonsnet 
nojdepend nojsch nojython nolog4j nooro noregexp norhino noxalan noxerces nptl 
nptlonly ntlm nut odbc offensive ogg oggvorbis openal opengl oscar oss pam 
pdflib php plotutils png postgres ppds python qt quicktime readline real remote 
rtc samba sasl scanner sdl slang sndfile sockets socks5 softmmu sqlite ssl stats 
svg theora threads tiff timidity transcode truetype truetype-fonts unicode 
uptimed usb userlocales v4l v4l2 vorbis wmf wxwindows xine xinerama xml xml2 
xosd xpm xprint xrandr xv xvid zlib userland_GNU kernel_linux libc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 1 Ricardo Correia 2005-05-03 12:03:49 UTC
Here's the Hello World program I'm trying to run:

import org.eclipse.swt.widgets.*;
import org.eclipse.swt.*;

public class SWTHello {
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		Label label = new Label(shell, SWT.NONE);
		label.setText("Hello, World!");
		shell.pack();
		label.pack();
		shell.open();

		while(!shell.isDisposed())
			if(!display.readAndDispatch())
				display.sleep();
		display.dispose();
		label.dispose();
	}
}
Comment 2 Ricardo Correia 2005-05-03 12:06:35 UTC
I forgot to say I'm using sun-jdk-1.5.
And just to make it clearer: it segfaults both with swt-3.0-r2 and swt-3.1_pre2.
Comment 3 Ricardo Correia 2005-05-03 12:37:14 UTC
I think I've made some progress:

In the swt-3.1_pre2 ebuild, I've replaced the source download file "swt-3.1M2-linux-gtk.zip" with "swt-3.1M2-linux-gtk-amd64.zip".

It emerges fine - and now, instead of hundreds of warnings, it only generates 2:

cc -O -Wall             -DSWT_VERSION=3106                              -DLINUX -DGTK           -I/opt/sun-jdk-1.5.0.02/include -I/opt/sun-jdk-1.5.0.02/include/linux               -fpic            -c callback.c
callback.c: In function `Java_org_eclipse_swt_internal_Callback_bind':
callback.c:211: warning: cast from pointer to integer of different size
callback.c: In function `Java_org_eclipse_swt_internal_Callback_unbind':
callback.c:229: warning: cast from pointer to integer of different size

The problem is that it still segfaults, but now the stack trace is different:

Stack: [0x00007fffffe00000,0x0000800000000000),  sp=0x00007fffffffc8d0,  free space=2034k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x36347f]
V  [libjvm.so+0x37edc5]
C  [libswt-gtk-3106.so+0x2d365]  Java_org_eclipse_swt_internal_Callback_bind+0x1ff
j  org.eclipse.swt.internal.Callback.<init>(Ljava/lang/Object;Ljava/lang/String;IZ)V+144
j  org.eclipse.swt.internal.Callback.<init>(Ljava/lang/Object;Ljava/lang/String;I)V+5
j  org.eclipse.swt.widgets.Display.createDisplay(Lorg/eclipse/swt/graphics/DeviceData;)V+191
j  org.eclipse.swt.widgets.Display.create(Lorg/eclipse/swt/graphics/DeviceData;)V+17
j  org.eclipse.swt.graphics.Device.<init>(Lorg/eclipse/swt/graphics/DeviceData;)V+135
j  org.eclipse.swt.widgets.Display.<init>(Lorg/eclipse/swt/graphics/DeviceData;)V+2
j  org.eclipse.swt.widgets.Display.<init>()V+2
j  SWTHello.main([Ljava/lang/String;)V+4
v  ~StubRoutines::call_stub
V  [libjvm.so+0x362835]
V  [libjvm.so+0x4faca9]
V  [libjvm.so+0x362645]
V  [libjvm.so+0x3854e5]
V  [libjvm.so+0x37a81e]
C  [java+0x1f41]  strcmp+0x779

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.eclipse.swt.internal.Callback.bind(Lorg/eclipse/swt/internal/Callback;)J+0
j  org.eclipse.swt.internal.Callback.<init>(Ljava/lang/Object;Ljava/lang/String;IZ)V+144
j  org.eclipse.swt.internal.Callback.<init>(Ljava/lang/Object;Ljava/lang/String;I)V+5
j  org.eclipse.swt.widgets.Display.createDisplay(Lorg/eclipse/swt/graphics/DeviceData;)V+191
j  org.eclipse.swt.widgets.Display.create(Lorg/eclipse/swt/graphics/DeviceData;)V+17
j  org.eclipse.swt.graphics.Device.<init>(Lorg/eclipse/swt/graphics/DeviceData;)V+135
j  org.eclipse.swt.widgets.Display.<init>(Lorg/eclipse/swt/graphics/DeviceData;)V+2
j  org.eclipse.swt.widgets.Display.<init>()V+2
j  SWTHello.main([Ljava/lang/String;)V+4
v  ~StubRoutines::call_stub

Notice that the warnings were in callback.c, in function `Java_org_eclipse_swt_internal_Callback_bind', and that this function also appears in the stack trace.

Maybe it's related?
Comment 4 Ricardo Correia 2005-05-03 13:35:08 UTC
Ok, I found the problems:

1. The download link was incorrect - it must be swt-xxx-linux-gtk-x86_64.zip (or -gtk-amd64.zip for older versions) for amd64.
2. SWT must be compiled with -DSWT_PTR_SIZE_64

I've created an ebuild based on swt-3.1_pre2.ebuild for the latest SWT (3.1M5a) which incorporates both fixes.

It finally works now, so please update it in portage :)
Comment 5 Ricardo Correia 2005-05-03 13:36:07 UTC
Created attachment 57959 [details]
swt-3.1_pre5.ebuild

Fixed ebuild, now works on amd64.
Comment 6 Jan Brinkmann (RETIRED) gentoo-dev 2005-05-04 04:53:31 UTC
thanks a lot for reporting and for solving the problem on your own. i've backported the fixes also to the 3.1_pre2 ebuild. fixed in cvs