This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Fix to successfully build libjava as a shared library

Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit

Hi there,

I was configuring and building gcc to create shared libs for libstdc++
and libjava for quite some time now using


This worked up  to gcc-3.0.1. I recently  tried this on the MAIN line,
but it fails  miserably  for Java  now. Further investigations  showed
that libjava seems to depend on  the GC, FFI,  ZLIB and probably other
libs  to be built as  shared libs, too.   I then looked at the various
configure   scripts  and   found  out    that  the   order in    which
AM_INIT_AUTOMAKE  and A{C,M}_PROG_LIBTOOL  are   called is not  OK for
libffi and libobjc.

As a result,  the shell variable PACKAGE  is used before it's actually
initialized, hence disabling the  chance to enable/disable building it
as a shared  lib.  In libobjc I saw   further, that while  it's  using
libtool's  features  (ie. ../libtool.m4), it   doesn't initialize  the
required variables PACKAGE and VERSION. This  should be done by a call
to AM_INIT_AUTOMAKE,  but  as libobjc is  not (yet)  using automake at
all, I  simply added a simple  init of those variables to

With the attached patch applied I have been able to bootstrap on
i686-redhat7-linux-gnu configured as

  env CC=gcc 'CFLAGS=-O2 -march=i686 -fomit-frame-pointer'	\
      'CXXFLAGS=-O2 -march=i686 -fomit-frame-pointer -g'	\
      'GCJFLAGS=-O2 -march=i686 -fomit-frame-pointer -g'	\
      LDFLAGS=-s 'LINGUAS=de es fr it'				\
      'INSTALL=/usr/bin/install -c'				\
      'INSTALL_DATA=/usr/bin/install -c -m 644'			\
      'INSTALL_PROGRAM=/usr/bin/install -c -m 755'		\
  /bin/sh ../gcc-20010915/configure --host=i686-redhat7-linux-gnu	\
      --target=i686-redhat7-linux-gnu					\
      --build=i686-redhat7-linux-gnu					\
      --srcdir=../gcc-20010915 --prefix=/opt/gnu			\
      --exec-prefix=/opt/gnu/H-ia32-linux --with-gnu-as --with-gnu-ld	\
      --disable-checking						\
      --enable-shared=gcc,libstdc++,gc,libffi,libjava,libltdl,zlib	\
      --enable-threads=posix --with-system-zlib				\
      --with-local-prefix=/opt/gnu --enable-nls --verbose

I'm not sure if we shouldn't express the dependencies of libgcj on the
other (helper-)libraries  in  some of the  top-level configure/libtool
scripts, though.

But even if we would, the attached patch will still be required.

OK to check in?



PS: Even though boehm-gc/acinclude.m4 and boehm-gc/aclocal.m4 are
    including ../libtool.m4, there exists still a local (and
    different) copy of libtool.m4 in the boehm-gc sub-directory.
    Shouldn't that be removed from CVS?

Content-Type: text/plain
Content-Description: Patches for successfully building libjava as a shared lib
Content-Disposition: inline;
Content-Transfer-Encoding: 7bit


2001-09-18  Manfred Hollstein  <>

	* configure: Re-generate.
	* Move call of AM_INIT_AUTOMAKE before AM_PROG_LIBTOOL;
	remove redundant call of AC_INIT_AUTOMAKE.


2001-09-18  Manfred Hollstein  <>

	definition from
	* (PACKAGE): Add definition.
	(VERSION): Add definition; substitute it in output files.
	* configure: Re-generate.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el gcc-20010915.orig/libffi/ gcc-20010915/libffi/
--- gcc-20010915.orig/libffi/	Sat Jul  7 15:32:32 2001
+++ gcc-20010915/libffi/	Tue Sep 18 11:14:14 2001
@@ -27,15 +27,14 @@ AC_SUBST(libffi_basedir)
 case "$host" in
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el gcc-20010915.orig/libobjc/ gcc-20010915/libobjc/
--- gcc-20010915.orig/libobjc/	Mon May 14 11:06:23 2001
+++ gcc-20010915/libobjc/	Tue Sep 18 11:28:49 2001
@@ -69,8 +69,8 @@ ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS)
 # begin compiled and compatibility issues.
 # Please refer to Libtool documentation about how to manage these 
 # numbers.
 # @LIBTOOL@ does not get it right, so we hack it in - FIXME
 LIBTOOL = ./libtool
 LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el gcc-20010915.orig/libobjc/ gcc-20010915/libobjc/
--- gcc-20010915.orig/libobjc/	Mon Jun 11 12:09:39 2001
+++ gcc-20010915/libobjc/	Tue Sep 18 11:36:49 2001
@@ -83,6 +83,12 @@ else
+dnl we need the following definitions because AC_PROG_LIBTOOL relies on them
+dnl version is pulled out to make it a bit easier to change using sed.
 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
 # at least currently, we never actually build a program, so we never
 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]