From owner-freebsd-hackers Fri Jan 31 10:07:26 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id KAA04103 for hackers-outgoing; Fri, 31 Jan 1997 10:07:26 -0800 (PST) Received: from chai.plexuscom.com (chai.plexuscom.com [207.87.46.100]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id KAA04093 for ; Fri, 31 Jan 1997 10:07:23 -0800 (PST) Received: from chai.plexuscom.com (localhost [127.0.0.1]) by chai.plexuscom.com (8.8.4/8.6.12) with ESMTP id NAA14384 for ; Fri, 31 Jan 1997 13:08:01 -0500 (EST) Message-Id: <199701311808.NAA14384@chai.plexuscom.com> To: hackers@freebsd.org Subject: g++, STL and -frepo on FreeBSD-2.2-Beta Date: Fri, 31 Jan 1997 13:08:01 -0500 From: Bakul Shah Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 < // include everything for simplicity. #include #include int main(int, char*[]) { list 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 class and everything should just work. No such luck. I get: x.o: Undefined symbol `list::list(void)' referenced from text segment x.o: Undefined symbol `list::push_back(int const &)' referenced from text segment x.o: Undefined symbol `list::~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