Libjava craziness

Mark Mitchell
Thu May 17 20:36:00 GMT 2001

I was somewhat astonished to run out of space on my disk while
building GCC today.

I found that the libgcj build took up 7GB on my x86.  (Yes, that's GB,
not MB.)

The cause is the following wonderful N^2 algorithm used to produce the
  ld -r -o .libs/ .libs/prims.o 
  ld -r -o .libs/ .libs/posix.o .libs/
  ld -r -o .libs/ .libs/jni.o .libs/
  ld -r -o .libs/ .libs/exception.o .libs/
  ld -r -o .libs/ .libs/resolve.o .libs/
  ld -r -o .libs/ .libs/defineclass.o .libs/
  ld -r -o .libs/ .libs/interpret.o .libs/
  ld -r -o .libs/ .libs/name-finder.o .libs/
  ld -r -o .libs/ gnu/gcj/convert/.libs/JIS0208_to_Unicode.o .libs/

Hmm.  You do 735 times with 100K files, and you've got yourself a real
humdinger of a problem.

It looks like this is some wackiness in libtool, presumably to deal
with the fact that otherwise the command-line would be too long.  If
we do the `rm' after each link, we will still be N^2 in time, but at
least not in space.  It would be better if we could do more than once
file at time.

There are systems where running out of disk like this causes crashes
and corruption, and we shouldn't be putting our users at risk when
they start the day with 7GB of free space.  So, we need a fix for this
ASAP, or we're going to have to choose between violating the
no-hacking-libtool-in-the-gcc-tree rule and temporarily disabling Java
builds, neither of which is cool.


Mark Mitchell         
CodeSourcery, LLC     

More information about the Java mailing list