Date: Fri, 31 Jan 1997 13:08:01 -0500 From: Bakul Shah <bakul@torrentnet.com> To: hackers@freebsd.org Subject: g++, STL and -frepo on FreeBSD-2.2-Beta Message-ID: <199701311808.NAA14384@chai.plexuscom.com>
next in thread | raw e-mail | index | archive | help
I'd appreciate some help from g++/STL experts on this list to solve a problem with the above combination. If this problem can be solved, a copylefted Verilog behavioral simuluator just may show up in the ports collection! Assuming it works. For the uninitiated, the -frepo patch from cygnus to the stock gcc-2.7.2 is essential for a hassle free use of the standard template library (STL). As I understand it, somehow the linker calls the compiler as many times as needed to instantiate specific classes built from templates and used in the program being linked. The trouble is, this doesn't work for me. This is what I did: tar -zxf gcc-2.7.2.tar.gz cd gcc-2.7.2 gzcat ../gcc-2.7.2-2.7.2.1.diff.gz | patch -p1 -s gzcat ../gcc-2.7.2-repo.gz | patch -s ./configure make bootstrap make install # this step as root rm /usr/local/lib/gcc-lib/i386-unknown-freebsd2.2/2.7.2.1/include/stdarg.h # gcc installed stdarg.h clashes with the standard freebsd includes. Next I built and installed libg++-2.7.1 because that is what the program I am trying to compile wants. Then I tried the following test program: cat >x.cc <<EOF #include <stl.h> // include everything for simplicity. #include <iostream.h> #include <stdlib.h> int main(int, char*[]) { list<int> list1; for(int i = 0; i < 10; ++i) { list1.push_back(rand()); } return 0; } EOF g++ -frepo -c x.cc g++ -o x x.o The last step above should call the compiler to instantiate the list<int> class and everything should just work. No such luck. I get: x.o: Undefined symbol `list<int>::list(void)' referenced from text segment x.o: Undefined symbol `list<int>::push_back(int const &)' referenced from text segment x.o: Undefined symbol `list<int>::~list(void)' referenced from text segment collect2: ld returned 1 exit status g++ -v -o x x.o reveals /usr/local/lib/gcc-lib/i386-unknown-freebsd2.2/2.7.2.1/ld -e start -dc -dp -o x /usr/lib/crt0.o -L/usr/local/lib/gcc-lib/i386-unknown-freebsd2.2/2.7.2.1 -L/usr/local/lib x.o -lg++ -lstdc++ -lm -lgcc -lc -lgcc Which seems right to me. Any ideas for figuring this out will be gratefully accepted. -- bakul
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701311808.NAA14384>