Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 177506 - sci-libs/vtk-5.0.3 ebuild fails on amd64 with java.lang.OutOfMemoryError
Summary: sci-libs/vtk-5.0.3 ebuild fails on amd64 with java.lang.OutOfMemoryError
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: AMD64 Linux
: High normal
Assignee: Markus Dittrich (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-07 14:59 UTC by Rolf S. Arvidson
Modified: 2007-05-09 09:59 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf S. Arvidson 2007-05-07 14:59:57 UTC
A java.lang.OutOfMemoryError appears in vtk-5.0.3. Inserting provision for 'javac -J-Xmx256m' (see bug #123178) as in vtk-5.0.2 ebuild fixes problem and allows build to finish

Reproducible: Always

Steps to Reproduce:
emerge sci-libs/vtk-5.0.3

Actual Results:  
Compiling /var/tmp/portage/sci-libs/vtk-5.0.3/work/VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py ...
...
[ 74%] Built target vtkpython_pyc
[ 74%] Generating ../../java/vtk/vtkBuildAllDriver.class


The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
make[2]: *** [java/vtk/vtkBuildAllDriver.class] Error 3
make[1]: *** [Wrapping/Java/CMakeFiles/VTKBuildAll.dir/all] Error 2
make: *** [all] Error 2

!!! ERROR: sci-libs/vtk-5.0.3 failed.
Call stack:
  ebuild.sh, line 1614:   Called dyn_compile
  ebuild.sh, line 971:   Called qa_call 'src_compile'
  environment, line 5172:   Called src_compile
  vtk-5.0.3.ebuild, line 161:   Called die

!!! emake failed
!!! If you need support, post the topmost build error, and the call stack if relevant.
!!! A complete build log is located at '/var/tmp/portage/sci-libs/vtk-5.0.3/temp/build.log'.

!!! When you file a bug report, please include the following information:
GENTOO_VM=sun-jdk-1.5  CLASSPATH="" JAVA_HOME="/opt/sun-jdk-1.5.0.11"
JAVACFLAGS="-source 1.5 -target 1.5" COMPILER=""
and of course, the output of emerge --info


Expected Results:  
See note in Additional Information

The flags I used for the emerge:
[ebuild  N    ] sci-libs/vtk-5.0.3  USE="java python qt4 tk -doc -examples -mpi -patented -qt3 -tcl -threads" 0 kB

I amended the ebuild with the correction from vtk-5.0.2, i.e.
$ diff -c /usr/portage/sci-libs/vtk/vtk-5.0.3.ebuild /usr/local/portage/sci-libs/vtk/vtk-5.0.3.ebuild
*** /usr/portage/sci-libs/vtk/vtk-5.0.3.ebuild  2007-05-03 21:06:10.000000000 -0500
--- /usr/local/portage/sci-libs/vtk/vtk-5.0.3.ebuild    2007-05-07 08:07:42.000000000 -0500
***************
*** 1,7 ****
- # Copyright 1999-2007 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
- # $Header: /var/cvsroot/gentoo-x86/sci-libs/vtk/vtk-5.0.3.ebuild,v 1.3 2007/05/04 01:49:31 markusle Exp $
-
  inherit distutils eutils flag-o-matic toolchain-funcs versionator java-pkg-opt-2 python qt3

  # Short package version
--- 1,3 ----
***************
*** 158,163 ****
--- 154,166 ----
        cmake ${CMAKE_VARIABLES} . && cmake ${CMAKE_VARIABLES} . \
                || die "cmake configuration failed"

+       # fix java.lang.OutOfMemoryError on amd64 (see bug #123178)
+       if use java && [ "${ARCH}" == "amd64" ]; then
+               sed -e "s/javac/javac -J-Xmx256m/" \
+               -i "${S}"/Wrapping/Java/CMakeFiles/VTKBuildAll.dir/build.make \
+               || die "Failed to patch javac"
+       fi
+
        emake -j1 || die "emake failed"
  }

This results in a successful build.

emerge --info follows:
# emerge --info
Portage 2.1.2.2 (default-linux/amd64/2006.1, gcc-4.1.1, glibc-2.5-r0, 2.6.21-gentoo x86_64)
=================================================================
System uname: 2.6.21-gentoo x86_64 Dual Core AMD Opteron(tm) Processor 265
Gentoo Base System release 1.12.9
Timestamp of tree: Sat, 05 May 2007 03:34:01 +0000
ccache version 2.4 [disabled]
dev-java/java-config: 1.3.7, 2.0.31-r5
dev-lang/python:     2.4.3-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-march=k8 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LC_ALL="en_US.utf8"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/sci /usr/portage/local/layman/xeffects"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acpi alsa amd64 arts artworkextra asf audiofile automount bash-completion berkdb bitmap-fonts blas branding cairo cdda cdparanoia cdr cli cpudetection cracklib crypt css cups curl dbus directfb dri dts dvd dvdr dvdread encode fbcon ffmpeg firefox flac foomaticdb fortran gdbm gif gimp glitz gpm hal hdf iconv imagemagick imap ipv6 isdnlog java jpeg kde kdeenablefinal kqemu lapack latex libg++ lm_sensors logitech-mouse midi mono mp3 mp4 ncurses netcdf nforce2 nls nptl nptlonly nsplugin nvidia oav ogg opengl pam paste64 pcre pdf perl plotutils pmu png ppds pppd python qt3 qt4 quicktime rdesktop readline reflection reiserfs samba scanner session slp smp sndfile spl ssl svg tcpd tetex tiff tk truetype truetype-fonts type1-fonts unicode usb vim vorbis winbind wmf x264 xcomposite xorg xscreensaver xvid yahoo zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nv vesa nvidia fbdev"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Markus Dittrich (RETIRED) gentoo-dev 2007-05-07 15:52:59 UTC
Hi Rolf,

Thanks for pointing this out and for testing.
I'll merge this fix back into vtk-5.0.3. then.

Best,
Markus
Comment 2 Petteri Räty (RETIRED) gentoo-dev 2007-05-07 16:09:25 UTC
(In reply to comment #0)
> 
> +       # fix java.lang.OutOfMemoryError on amd64 (see bug #123178)
> +       if use java && [ "${ARCH}" == "amd64" ]; then
> +               sed -e "s/javac/javac -J-Xmx256m/" \
> +               -i "${S}"/Wrapping/Java/CMakeFiles/VTKBuildAll.dir/build.make \
> +               || die "Failed to patch javac"
> +       fi
> +
>         emake -j1 || die "emake failed"
>   }
> 

A better solution would be to make the build system respect JAVACFLAGS and submit that patch upstream. Currently the ebuild seems to restrict to =virtual/jdk-1.5*, but it's quite likely that it works just fine with 1.6 too if the build uses JAVACFLAGS properly. JAVACFLAGS is defined in java eclasses so you should append to it. Please use attachments for patches in the future instead of inlining them. Does it really require javac etc at runtime? Most like you should have just >=virtual/jre-1.5 in RDEPEND.
Comment 3 Markus Dittrich (RETIRED) gentoo-dev 2007-05-08 01:20:20 UTC
Hi  Petteri,

Thanks much for your comments.

> A better solution would be to make the build system respect JAVACFLAGS and
> submit that patch upstream. 

Upstream is aware of it but has not merged it into their current release
branch and I am not sure if they will.

> Currently the ebuild seems to restrict to
> =virtual/jdk-1.5*, but it's quite likely that it works just fine with 1.6 too
> if the build uses JAVACFLAGS properly. JAVACFLAGS is defined in java eclasses
> so you should append to it. 

jdk-1.6 likely works but I haven't tested it (yet). VTK uses cmake and as far as
I know cmake does not know about JAVACFLAGS hence appending to it won't work.
Please correct me if I am wrong.

> Does it really require javac etc at runtime? Most
> like you should have just >=virtual/jre-1.5 in RDEPEND.

I assume you meant DEPEND here? You bring up a very good point
here, thanks. Since vtk is a library, in principle all of RDEPEND could 
go to DEPEND. What would you suggest?

Thanks,
Markus

Comment 4 Markus Dittrich (RETIRED) gentoo-dev 2007-05-08 02:23:47 UTC
(In reply to comment #3)
> I assume you meant DEPEND here? You bring up a very good point
> here, thanks. Since vtk is a library, in principle all of RDEPEND could 
> go to DEPEND. What would you suggest?
> 

Ok, I was clearly too fast here; in addition to its libs vtk also provides
a bunch of wrappers that need most of the stuff in RDEPEND. However,
>=virtual/jre-1.5 can go ito DEPEND. I'll fix this tomorrow and will also
give jre-1.6 a spin.

Thanks,
Markus

Comment 5 Petteri Räty (RETIRED) gentoo-dev 2007-05-08 06:16:58 UTC
(In reply to comment #4)
> 
> Ok, I was clearly too fast here; in addition to its libs vtk also provides
> a bunch of wrappers that need most of the stuff in RDEPEND. However,
> >=virtual/jre-1.5 can go ito DEPEND. I'll fix this tomorrow and will also
> give jre-1.6 a spin.
> 
> Thanks,
> Markus
> 

virtual/jdk provides a virtual/jre

>
> jdk-1.6 likely works but I haven't tested it (yet). VTK uses cmake and as far
> as
> I know cmake does not know about JAVACFLAGS hence appending to it won't work.
> Please correct me if I am wrong.
> 

Yes the build tool needs to know about it the same way as Makefiles know how to use CFLAGS. gcc doesn't use CFLAGS and neither does javac use JAVACFLAGS.
Comment 6 Markus Dittrich (RETIRED) gentoo-dev 2007-05-09 09:59:40 UTC
I've just committed the patched ebuild to cvs and also changed the
dependency to  >=virtual/jdk-1.5.
Please ping me if you find any other issues with the java stuff currently
implemented in the ebuild. I'll see if I can contact the vtk folks about fixing
this in their next release.

Thanks,
Markus