>Number: 3729 >Category: c++ >Synopsis: With a simple testprogram -frepo does not work as expected. >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Wed Jul 18 10:46:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Michael Harbeck >Release: 3.0 >Organization: >Environment: System: Linux harbeck2 2.4.5 #1 Sun Jun 10 13:51:26 CEST 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc-3.0/configure --enable-shared --enable-threads --prefix=/usr/local --verbose --with-system-zlib --enable-nls --enable-version-specific-runtime-libs >Description: The environment variable ``COMPILER_PATH´´ influences the order in which header files are searched for. This breaks a simple program compiled with the -frepo - option, because collect2 sets this variable. >How-To-Repeat: Assume the following file frepo_error.cc < int main() { std::map theMap; return 0; } END Try to compile this with the following commands: <frepo_error.log 2>&1 rm -f frepo_error.rpo frepo_error.o frepo_error echo ============== Compiling cc file ===================================== >Fix: Workaround: Undefine the environment variable ``COMPILER_PATH´´ before recompiling with collect2. I am not sure, that this is really a fix, but it works for me. The shell that is used need of cause a ability to undef ``COMPILER_PATH´´ to work. Here is the patch: <root.key); + /* + The next line seems to be necessary, because else we get an + error linking simple c++-Programs with -frepo + */ + obstack_grow (&temporary_obstack, "unset COMPILER_PATH; ", 21); + obstack_grow (&temporary_obstack, "cd ", 3); obstack_grow (&temporary_obstack, f->dir, strlen (f->dir)); obstack_grow (&temporary_obstack, "; ", 2); EOF Real Fix: Even better, I think, is to prevent the environment variable ``COMPILER_PATH´´ influence the search path of include files. I am sorry, that I had not the time to find the correct place where to fix this. >Release-Note: >Audit-Trail: >Unformatted: >&2 g++-3.0buggy --verbose -frepo -O2 -c frepo_error.cc echo ============== Linking binary ======================================== >&2 g++-3.0buggy --verbose -o frepo_error frepo_error.o echo ============== Finishing work ======================================== >&2 END Here is the result: < search starts here: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++ /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ i686-pc-linux-gnu /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ backward /usr/local/include /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include /usr/include End of search list. as -V -Qy -o frepo_error.o /tmp/cc6gwJdW.s GNU assembler version 2.11.2 (i686-pc-linux) using BFD version 2.11.2 + echo ============== Linking binary ======================================== ============== Linking binary ======================================== + g++-3.0buggy --verbose -o frepo_error frepo_error.o Reading specs from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs Configured with: ../gcc-3.0/configure --enable-shared --enable-threads --prefix=/usr/local/home/harbeck/local --verbose --with-system-zlib --enable-nls --enable-version-specific-runtime-libs --program-suffix=-3.0buggy Thread model: posix gcc version 3.0 /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o frepo_error /usr/lib/crt1.o /usr/lib/crti.o /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/crtbegin.o -L/usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0 -L/usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/../../.. frepo_error.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/crtend.o /usr/lib/crtn.o collect: recompiling frepo_error.cc Reading specs from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs Configured with: ../gcc-3.0/configure --enable-shared --enable-threads --prefix=/usr/local/home/harbeck/local --verbose --with-system-zlib --enable-nls --enable-version-specific-runtime-libs --program-suffix=-3.0buggy Thread model: posix gcc version 3.0 /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/cc1plus -v -isystem /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include -isystem /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include -isystem /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/include -isystem /usr/lib/gcc/i686-pc-linux-gnu/3.0/include -isystem /usr/lib/gcc/i686-pc-linux-gnu/include -isystem /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/../../../../ i686-pc-linux-gnu/bin/i686-pc-linux-gnu/3.0/include -isystem /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/../../../../ i686-pc-linux-gnu/bin/include -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ frepo_error.cc -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase frepo_error.cc -O2 -version -frepo -o /tmp/ccK9Lx3d.s ignoring nonexistent directory "/usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/include" ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/3.0/include" ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/include" ignoring nonexistent directory "/usr/local/home/harbeck/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu/3.0/i nclude" ignoring nonexistent directory "/usr/local/home/harbeck/local/i686-pc-linux-gnu/bin/include" GNU CPP version 3.0 (cpplib) (i386 Linux/ELF) GNU C++ version 3.0 (i686-pc-linux-gnu) compiled by GNU C version 3.0. ignoring nonexistent directory "/usr/local/home/harbeck/local/i686-pc-linux-gnu/include" ignoring duplicate directory "/usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include" ignoring duplicate directory "/usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include" #include "..." search starts here: #include <...> search starts here: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++ /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ i686-pc-linux-gnu /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ backward /usr/local/include /usr/include End of search list. In file included from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_cstring.h:37, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_algobase.h:42, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_tree.h:56, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_map.h:33, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ map:31, from frepo_error.cc:1: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_cstddef.h:38:25: stddef.h: Datei oder Verzeichnis nicht gefunden In file included from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_cstring.h:37, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_algobase.h:42, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_tree.h:56, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_map.h:33, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ map:31, from frepo_error.cc:1: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_cstddef.h:42: `ptrdiff_t' not declared /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_cstddef.h:43: `size_t' not declared In file included from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_climits.h:38, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_algobase.h:43, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_tree.h:56, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_map.h:33, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ map:31, from frepo_error.cc:1: /usr/include/limits.h:124:26: No include path in which to find limits.h In file included from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_algobase.h:46, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_tree.h:56, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_map.h:33, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ map:31, from frepo_error.cc:1: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:55: `size_t' undeclared in namespace `std' /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:55: declaration of `operator new' as non-function /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:55: invalid declarator /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:56: `size_t' undeclared in namespace `std' /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:56: declaration of `operator new []' as non-function /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:56: invalid declarator /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:59: `size_t' undeclared in namespace `std' /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:59: parse error before `::' token /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:59: `operator new' takes type `size_t' (`unsigned int') as first parameter /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:60: `size_t' undeclared in namespace `std' /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:60: parse error before `::' token /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:60: `operator new' takes type `size_t' (`unsigned int') as first parameter /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:65: `size_t' undeclared in namespace `std' /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:65: parse error before `*' token /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:65: `operator new' takes type `size_t' (`unsigned int') as first parameter /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new: In function `void* operator new(unsigned int, ...)': /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:65: `place' undeclared (first use this function) /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:65: (Each undeclared identifier is reported only once for each function it appears in.) /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new: At global scope: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:66: `size_t' undeclared in namespace `std' /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:66: parse error before `*' token /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ new:66: `operator new' takes type `size_t' (`unsigned int') as first parameter In file included from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/fpos.h:39, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_iosfwd.h:41, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_algobase.h:48, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_tree.h:56, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_map.h:33, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ map:31, from frepo_error.cc:1: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ i686-pc-linux-gnu/bits/c++io.h:43: syntax error before `;' token /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ i686-pc-linux-gnu/bits/c++io.h:45: syntax error before `;' token In file included from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_algobase.h:49, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_tree.h:56, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_map.h:33, from /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ map:31, from frepo_error.cc:1: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_iterator_base_types.h:96: parse error before `,' token /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_iterator_base_types.h:100: template declaration of `typedef _Tp std::value_type' /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/stl_iterator_base_types.h:100: confused by earlier errors, bailing out frepo_error.o: In function `main': frepo_error.o(.text+0xa9): undefined reference to `std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_erase(std::_Rb_tree_node >*)' collect2: ld returned 1 exit status + echo ============== Finishing work ======================================== ============== Finishing work ======================================== END You can see that the search paths for include files differ between the compiling run: #include "..." search starts here: #include <...> search starts here: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++ /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ i686-pc-linux-gnu /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ backward /usr/local/include /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include /usr/include End of search list. and the linking run: #include "..." search starts here: #include <...> search starts here: /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++ /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ i686-pc-linux-gnu /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ backward /usr/local/include /usr/include End of search list. In the linking case at line 38 of file /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include/g++/ bits/std_cstddef.h you can find the line: #include_next which is not part of /usr/include or /usr/local/include but only of /usr/local/home/harbeck/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/include Because of this the compile run must fail!