I believe I've found a partial cause/solution. Re:bugs.debian.org/98939 I have LIBRARY_PATH set in my environment: echo $LIBRARY_PATH /usr/local/kde2.2/lib:/usr/local/qt2.3/lib:/usr/local/lib
This to to work-around something I think is broken with the linker. According to the gcc info pages: The value of `LIBRARY_PATH' is a colon-separated list of directories, much like `PATH'. When configured as a native compiler, GCC tries the directories thus specified when searching for special linker files, if it can't find them using `GCC_EXEC_PREFIX'. Linking using GCC also uses these directories when searching for ordinary libraries for the `-l' option (but directories specified with `-L' come first). Note below the order of the -L args. /usr/lib/gcc-lib/i386-linux/2.95.4 comes last... Shouldn't it be first? Maybe a change to the specs? It so happens I have gcc-3 and libstdc++-v3 installed in /usr/local, so I can compile this on a few ways: 1. unset LIBRARY_PATH (no good if using other /usr/local/...) 2. use -L/usr/lib on commandline (highly discouraged) 3. get ld fixed (see above for bug report re:) 4. get -L/usr/lib/gcc-lib/i386-linux/2.95.4 listed first (as that is the location of libstdc++.so symlink) Suggestions? On Sun, Jun 17, 2001 at 11:24:41PM +0200, Matthias Klose wrote: > I am unable to reproduce this in unstable with 2.95.4-0.010604. > > Gordon Sadler writes: > > Package: g++-2.95 > > Version: 1:2.95.4-0.010604 > > Severity: important > > > > I have no idea when this started. Perhaps a packaging bug? > > > > If you compile the attached 'hello' program: > > g++ -v bar.cpp > > Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs > > gcc version 2.95.4 20010604 (Debian prerelease) > > /usr/lib/gcc-lib/i386-linux/2.95.4/cpp0 -lang-c++ -v -D__GNUC__=2 > -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ > -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux > -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) > > -Amachine(i386) -Di386 -D__i386 -D__i386__ bar.cpp /tmp/ccf6bars.ii > > GNU CPP version 2.95.4 20010604 (Debian prerelease) (i386 Linux/ELF) > > #include "..." search starts here: > > #include <...> search starts here: > > /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3 > > /usr/lib/gcc-lib/i386-linux/2.95.4/include > > /usr/include > > End of search list. > > The following default directories have been omitted from the search path: > > /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../i386-linux/include > > End of omitted list. > > /usr/lib/gcc-lib/i386-linux/2.95.4/cc1plus /tmp/ccf6bars.ii -quiet > -dumpbase bar.cc -version -o /tmp/ccqPnv88.s > > GNU C++ version 2.95.4 20010604 (Debian prerelease) (i386-linux) compiled > by GNU C version 2.95.4 20010604 (Debian prerelease). > > as -V -Qy -o /tmp/ccBAeHI5.o /tmp/ccqPnv88.s > > GNU assembler version 2.11.90.0.7 (i386-linux) using BFD version > 2.11.90.0.7 > > /usr/lib/gcc-lib/i386-linux/2.95.4/collect2 -m elf_i386 -dynamic-linker > /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o > /usr/lib/gcc-lib/i386-linux/2.95.4/crtbegin.o -L/usr/local/kde2.2/lib > -L/usr/local/qt2.3/lib -L/usr/local/lib -L/usr/lib/gcc-lib/i386-linux/2.95.4 > /tmp/ccBAeHI5.o -lstdc++ -lm -lgcc -lc -lgcc > /usr/lib/gcc-lib/i386-linux/2.95.4/crtend.o /usr/lib/crtn.o > > /tmp/ccBAeHI5.o: In function `main': > > /tmp/ccBAeHI5.o(.text+0xf): undefined reference to `cout' > > /tmp/ccBAeHI5.o(.text+0x14): undefined reference to > `ostream::operator<<(char const *)' > > collect2: ld returned 1 exit status > > > > I've tried different versions (using namespace std, std::cout, cout) > > None of them will link here, same error for all. When compiled with > > g++-3.0 I have no problems. > > > > *** bar.cpp > > #include <iostream> > > > > int main () > > { > > std::cout << "hello ...\n"; > > return 0; > > } -- Gordon Sadler