xgcc: installation problem, cannot exec `../stage1/collect2': Arg list too long: PATCH

John David Anglin dave@hiauly1.hia.nrc.ca
Wed Oct 18 14:39:00 GMT 2000


> > ../stage1/xgcc -B../stage1/ -B/usr/local/vax-dec-ultrix4.3/bin/  -DIN_GCC    -W -Wall  -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes  -Wno-long-long -g -O3  -W -Wall  -o ../cc1plus `cat ../stamp-objlist` ../c-common.o ../c-pragma.o call.o decl.o errfn.o expr.o pt.o typeck2.o class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o except.o friend.o init.o method.o search.o semantics.o tree.o xref.o repo.o dump.o optimize.o mangle.o  ../intl/libintl.a ../../libiberty/libiberty.a
> > xgcc: installation problem, cannot exec `../stage1/collect2': Arg list too long

Here is a patch.  I added declarations checks for putenv, setenv and unsetenv
because they are not declared under vax ultrix.  Replacements are available
except under VMS if the system doesn't have them.  This reduces the size
of the exec argument and environment by about 1/3 which gets me well under
the vax ultrix ARG_MAX limit.  However, we are still over the POSIX limit
of 4096.

Dave

2000-10-16  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* configure.in (gcc_AC_CHECK_DECLS): Check for declaration of putenv,
	setenv and unsetenv.
	* configure: Rebuilt.
	* config.in: Likewise.
	* system.h: Declare putenv, setenv and unsetenv if needed.
	* gcc.c (main): Clean up junk in the environment.

--- configure.in.orig	Mon Oct  9 21:15:38 2000
+++ configure.in	Mon Oct 16 20:23:39 2000
@@ -548,7 +548,7 @@
 # We will need to find libiberty.h and ansidecl.h
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
-gcc_AC_CHECK_DECLS(bcopy bzero bcmp \
+gcc_AC_CHECK_DECLS(bcopy bzero bcmp putenv setenv unsetenv \
 	index rindex getenv atol sbrk abort atof getcwd getwd \
 	strsignal putc_unlocked fputs_unlocked strstr environ \
 	malloc realloc calloc free basename getopt, , ,[
--- system.h.orig	Tue Sep 26 23:59:18 2000
+++ system.h	Tue Oct 17 01:57:45 2000
@@ -396,6 +396,18 @@
 extern char *getenv PARAMS ((const char *));
 #endif
 
+#if defined (HAVE_DECL_PUTENV) && !HAVE_DECL_PUTENV
+extern int putenv PARAMS ((const char *));
+#endif
+
+#if defined (HAVE_DECL_SETENV) && !HAVE_DECL_SETENV
+extern int setenv PARAMS ((const char *, const char *, int));
+#endif
+
+#if defined (HAVE_DECL_UNSETENV) && !HAVE_DECL_UNSETENV
+extern void unsetenv PARAMS ((const char *));
+#endif
+
 #if defined (HAVE_DECL_GETWD) && !HAVE_DECL_GETWD
 extern char *getwd PARAMS ((char *));
 #endif
--- gcc.c.orig	Fri Oct  6 13:16:10 2000
+++ gcc.c	Wed Oct 18 14:35:37 2000
@@ -5178,6 +5178,20 @@
     --p;
   programname = p;
 
+#ifndef VMS
+  /* Clean up a few large environment variables that may be present. */
+  (void) unsetenv("MAKEFLAGS");
+  (void) unsetenv("CXX_FOR_TARGET");
+  (void) unsetenv("NM_FOR_TARGET");
+  (void) unsetenv("CHILL_FOR_TARGET");
+  (void) unsetenv("CC_FOR_TARGET");
+  (void) unsetenv("GCC_FOR_TARGET");
+  (void) unsetenv("RANLIB_TEST_FOR_TARGET");
+  (void) unsetenv("WARN_CFLAGS");
+  (void) unsetenv("EXPECT");
+  (void) unsetenv("RUNTEST");
+#endif
+
 #ifdef GCC_DRIVER_HOST_INITIALIZATION
   /* Perform host dependant initialization when needed.  */
   GCC_DRIVER_HOST_INITIALIZATION;


More information about the Gcc-patches mailing list