Bootstrapping gcc-4.2.2 with binutils-2.18

Vin Shelton acs@alumni.princeton.edu
Thu Dec 20 21:16:00 GMT 2007


Greetings!

It has been a long time since I've posted to a gcc list of any kind,
so if I've chosen the wrong list or if I commit some kind of faux pas,
please bear with me.

I recently tried to bootstrap gcc-4.2.2 including binutils-2.18 and
ran into problems, so I thought I would share my experiences in case
others find this documentation useful.

Here are the steps I took:

    cd /usr/local/src
    tar xf gcc-core-4.2.2.tar.bz2
    tar xf gcc-g++-4.2.2.tar.bz2
    tar xf gcc-testsuite-4.2.2.tar.bz2
    tar xf binutils-2.18.tar.bz2
    cd ./gcc-4.2.2
    for f in bfd binutils gas gprof ld opcodes; do
      ln -s ../binutils-2.18/$f .
    done
    mkdir /usr/local/build/gcc-4.2.2
    cd /usr/local/build/gcc-4.2.2
    ../../src/gcc-4.2.2/configure
    make bootstrap

This yielded the following error:

libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes
-Werror -g -fkeep-inline-functions -o ar arparse.o arlex.o ar.o
not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o
version.o filemode.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a
-lfl
ar.o: In function `map_over_members':
/home/vshelton/test/build/gcc-4.2.2/binutils/../../../src/gcc-4.2.2/binutils/ar.c:187:
undefined reference to `filename_cmp'
ar.o: In function `main':
/home/vshelton/test/build/gcc-4.2.2/binutils/../../../src/gcc-4.2.2/binutils/ar.c:388:
undefined reference to `filename_cmp'
ar.o: In function `get_pos_bfd':
/home/vshelton/test/build/gcc-4.2.2/binutils/../../../src/gcc-4.2.2/binutils/ar.c:1004:
undefined reference to `filename_cmp'
ar.o: In function `delete_members':
/home/vshelton/test/build/gcc-4.2.2/binutils/../../../src/gcc-4.2.2/binutils/ar.c:1042:
undefined reference to `filename_cmp'
ar.o: In function `move_members':
/home/vshelton/test/build/gcc-4.2.2/binutils/../../../src/gcc-4.2.2/binutils/ar.c:1097:
undefined reference to `filename_cmp'
ar.o:/home/vshelton/test/build/gcc-4.2.2/binutils/../../../src/gcc-4.2.2/binutils/ar.c:1149:
more undefined references to `filename_cmp' follow
collect2: ld returned 1 exit status
make[5]: *** [ar] Error 1
make[5]: Leaving directory `/home/vshelton/test/build/gcc-4.2.2/binutils'

The following commands enabled me to supply the unresolved external:

    cd /usr/local/src/gcc-4.2.2/libiberty
    ln -s ../../binutils-2.18/libiberty/filename_cmp.c
patch <<EOF
--- Makefile.in.orig	2007-12-20 15:11:39.000000000 -0500
+++ Makefile.in	2007-12-20 15:14:58.000000000 -0500
@@ -131,7 +131,7 @@
 	calloc.c choose-temp.c clock.c concat.c cp-demangle.c		\
 	 cp-demint.c cplus-dem.c					\
 	dyn-string.c							\
-	fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c		\
+	fdmatch.c ffs.c fibheap.c floatformat.c filename_cmp.c fnmatch.c		\
 	 fopen_unlocked.c						\
 	getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c	\
          gettimeofday.c                                                 \
@@ -165,7 +165,7 @@
 	./alloca.o ./argv.o						\
 	./choose-temp.o ./concat.o ./cp-demint.o			\
 	./dyn-string.o							\
-	./fdmatch.o ./fibheap.o ./floatformat.o ./fnmatch.o		\
+	./fdmatch.o ./fibheap.o ./filename_cmp.o ./floatformat.o ./fnmatch.o		\
 	 ./fopen_unlocked.o						\
 	./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o		\
 	./hashtab.o ./hex.o						\
@@ -634,6 +634,13 @@
 	else true; fi
 	$(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION)

+./filename_cmp.o: $(srcdir)/filename_cmp.c stamp-h $(INCDIR)/filenames.h \
+	$(INCDIR)/safe-ctype.h
+	if [ x"$(PICFLAG)" != x ]; then \
+	  $(COMPILE.c) $(PICFLAG) $(srcdir)/filename_cmp.c -o pic/$@; \
+	else true; fi
+	$(COMPILE.c) $(srcdir)/filename_cmp.c $(OUTPUT_OPTION)
+
 ./floatformat.o: $(srcdir)/floatformat.c config.h $(INCDIR)/ansidecl.h \
 	$(INCDIR)/floatformat.h $(INCDIR)/libiberty.h
 	if [ x"$(PICFLAG)" != x ]; then \
EOF


With this patch installed, I could re-run configure and 'make
bootstrap' ran to completion.

Regards,
  Vin Shelton



More information about the Gcc-help mailing list