According to gcc-4_3-trunk/libgcc/configure's help we can set some environment
vars before we compile gcc.

"
Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
"

For what I am doing I have set CC and CPP.

In the text that follows I have deleted portions for brevity and then
substituted "..." where I am reasonably sure I am not cutting out something of
use.


Here is a few lines from the config.log files:

With CPP set in the environment - i686-pc-linux-gnu/libgcc/config.log:

configure:3015: checking how to run the C preprocessor
configure:3133: result: gcc -E
configure:3157: gcc -E  conftest.c
configure:3163: $? = 0
configure:3195: gcc -E  conftest.c


Without CPP set in the environment - i686-pc-linux-gnu/libgcc/config.log:

configure:3015: checking how to run the C preprocessor
configure:3050: /opt/gcc-4_3-build-6/./gcc/xgcc -B/opt/gcc-4_3-build-6/./gcc/
...
configure:3056: $? = 0
configure:3088: /opt/gcc-4_3-build-6/./gcc/xgcc -B/opt/gcc-4_3-build-6/./gcc/
...
conftest.c:9:28: error: ac_nonexistent.h: No such file or directory
configure:3094: $? = 1
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>
configure:3133: result: /opt/gcc-4_3-build-6/./gcc/xgcc
-B/opt/gcc-4_3-build-6/./gcc/ ...
configure:3157: /opt/gcc-4_3-build-6/./gcc/xgcc -B/opt/gcc-4_3-build-6/./gcc/
...
configure:3163: $? = 0
configure:3195: /opt/gcc-4_3-build-6/./gcc/xgcc -B/opt/gcc-4_3-build-6/./gcc/
...



The configure script is combining "how to run the C preprocessor" with the
CPPFLAGS or alternately, once it figures out "how to run the C preprocessor"
then it does not add the (internal) CPPFLAGS (the -B commands) so it can use
the "-B" stuff with the chosen "CPP". It is not using _my_ CPPFLAGS either
but I can get over that.

If your thinking that this has something to do with cross-targets then I would
mention that I also set "CC" and it is using 'gcc-4_3-build-6/gcc/xgcc' for
libgcc (which it likely should) - so when I have set "CPP" why doesn't it use 
'the xcpp' (gcc-4_3-build-6/gcc/cpp) - with or without "-B ... -isystem ..." ?

When the build thinks it is correct to switch from _my_ choice of "CC" to the
recently built gcc (xgcc) why doesn't it switch from _my_ choice of "CPP" to
the recently built xccp (simply called gcc/cpp) ?

It follows that when one switches the other should at the same time.


Here is some screen output that I logged:

With CPP set in the environment:

Line: 2077
/opt/gcc-4_3-build-5/make_26c_log.txt
Configuring stage 1 in i686-pc-linux-gnu/libgcc

checking whether we are using the GNU C compiler... yes
checking whether /opt/gcc-4_3-build-5/./gcc/xgcc -B/opt/gcc-4_3-build-5/./gcc/
...
checking for /opt/gcc-4_3-build-5/./gcc/xgcc -B/opt/gcc-4_3-build-5/./gcc/ ...
checking how to run the C preprocessor... gcc -E
checking whether decimal floating point is supported... yes


Without CPP set in the environment:

Line: 2883
/opt/gcc-4_3-build-6/make_27_log.txt
Configuring stage 1 in i686-pc-linux-gnu/libgcc

checking whether we are using the GNU C compiler... yes
checking whether /opt/gcc-4_3-build-6/./gcc/xgcc -B/opt/gcc-4_3-build-6/./gcc/
...
checking for /opt/gcc-4_3-build-6/./gcc/xgcc -B/opt/gcc-4_3-build-6/./gcc/ ...
checking how to run the C preprocessor... /opt/gcc-4_3-build-6/./gcc/xgcc -B
...
checking whether decimal floating point is supported... yes


Notice on the "checking how to run the C preprocessor" line that if CPP is set
then that is all you get, no "-B" - that could be OK if you wanted to use your
own choice of cpp throughout. Why does the script think we can run gcc/xgcc and
not gcc/cpp (is it worried about a cross).


For _my_ purposes I will need to fix this. I don't know enough about all the
cross environments that others use to suggest how the trunk needs to be changed
in a compatable manner. 


Whatever the reasoning for keeping it we end up in trouble.

To top it off, further on in the build the makefiles and configure scripts get
confused and keep adding the library directory to the GCC command until the
line gets too long and blows up collect2.


It gets to here before it gets confused - first it is using "xgcc", then it
decides to use "gcc" with a short command line to link "./libgcc_s.so.1.tmp".

Next it keeps adding more and more iterations of command fragments ...


gcc -D_GNUCC -o ./libgcc_s.so.1.tmp /usr/lib/crti.o ...
/usr/lib/crtn.o -m elf_i386 -shared -L/opt/gcc-4_3-build-5/./gcc -L. -lc


gcc -D_GNUCC -o ./libgcc_s.so.1.tmp /usr/lib/crti.o ...
/usr/lib/crtn.o -m elf_i386 -shared -m elf_i386 -L/opt/gcc-4_3-build-5/./gcc
-L. -L/opt/gcc-4_3-build-5/./gcc -L. -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -lgcc_s -lgcc_s


gcc -D_GNUCC -o ./libgcc_s.so.1.tmp /usr/lib/crti.o ...
/usr/lib/crtn.o /usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../libc.a
/opt/gcc-4_3-build-5/./gcc/crtendS.o /usr/lib/crtn.o -m elf_i386 -shared -m
elf_i386 -m elf_i386 -L/opt/gcc-4_3-build-5/./gcc -L.
-L/opt/gcc-4_3-build-5/./gcc -L. -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -L/opt/gcc-4_3-build-5/./gcc
-L. -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../..
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -lgcc_s -lgcc_s -lgcc_s -lgcc_s


gcc -D_GNUCC -o ./libgcc_s.so.1.tmp /usr/lib/crti.o ...
/usr/lib/crtn.o /usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../libc.a
/opt/gcc-4_3-build-5/./gcc/crtendS.o /usr/lib/crtn.o -m elf_i386 -shared -m
elf_i386 -m elf_i386 -m elf_i386 -L/opt/gcc-4_3-build-5/./gcc -L.
-L/opt/gcc-4_3-build-5/./gcc -L. -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -L/opt/gcc-4_3-build-5/./gcc
-L. -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../..
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -L/opt/gcc-4_3-build-5/./gcc
-L. -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../..
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../..
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -lgcc_s -lgcc_s -lgcc_s -lgcc_s
-lgcc_s -lgcc_s



Many thousands of lines later:


gcc -D_GNUCC -o ./libgcc_s.so.1.tmp /usr/lib/crti.o
/opt/gcc-4_3-build-5/./gcc/crtbeginS.o /usr/lib/crti.o
/opt/gcc-4_3-build-5/./gcc/crtbeginS.o ...
/usr/lib/crtn.o -m elf_i386 -shared -m elf_i386 -m elf_i386 -m elf_i386 -m
elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m
elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m
elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m
elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m elf_i386 -m elf_i386
-L/opt/gcc-4_3-build-5/./gcc -L. -L/opt/gcc-4_3-build-5/./gcc -L.
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -L/opt/gcc-4_3-build-5/./gcc
...
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../..
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../..
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -lgcc_s -lgcc_s -lgcc_s -lgcc_s
-lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s
-lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s
-lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s
-lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s
-lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s -lgcc_s
gcc: error trying to exec '/opt/gcc-4_3-build-5/./gcc/collect2': execv:
Argument list too long
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
...
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/opt/gcc-4_3-build-5/i686-pc-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/opt/gcc-4_3-build-5'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/gcc-4_3-build-5'
make: *** [all] Error 2

Even if it is correct to use the environment CPP while using xgcc it is still
an error that the configure scripts and makefile keep adding those excessive
number of "-L/usr/lib/gcc/i686-pc-linux-gnu/4.2.0", "-lgcc_s" and "-shared -m
elf_i386"'s.


-- 
           Summary: The libgcc configuration file doesn't swap CPP when it
                    swaps CC - use of normal value breaks make
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rob1weld at aol dot com
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32556

Reply via email to