------- Comment #1 from pinskia at gmail dot com 2009-03-12 04:42 ------- Subject: Re: New: The Driver hides "undefined reference" messages from shared libs (but not object files) in linker phase
Sent from my iPhone On Mar 11, 2009, at 9:27 PM, "rob1weld at aol dot com" <gcc-bugzi...@gcc.gnu.org > wrote: > The Driver hides "undefined reference" messages from shared libs but > not from object files. This seems inconsistent and is not helpful. > Why do you think the driver is doing instead of the linker? > When compiling 'ppl' using the Trunk I'm getting a terse message > about "undefined reference to `typeinfo for int'". This is not > particularly useful since the words are common (can't grep for > them) and there is no line number info explaining the location of > the code that causes this issue. > > This page may suggest a reason this error occurs: > http://stackoverflow.com/questions/307352/g-undefined-reference-to-typeinfo > > > I'm calling this an RFE since I desire an increase in verbosity > but there are no doubt arguments favoring this being a Bug. > > > # gcc -v > Using built-in specs. > Target: i386-pc-solaris2.11 > Configured with: ../gcc_trunk/configure --prefix=/usr/local/gcc4 > --enable-languages=ada,c,c++,fortran,java,objc,obj-c++ --enable-shared > --disable-static --enable-multilib --enable-decimal-float > --with-long-double-128 --with-included-gettext --disable-stage1- > checking > --enable-checking=release --with-tune=k8 --with-cpu=k8 --with-arch=k8 > --with-gnu-as --with-as=/usr/local/bin/as --with-gnu-ld > --with-ld=/usr/local/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/ > local > --without-ppl > Thread model: posix > gcc version 4.4.0 20090309 (experimental) [trunk revision 144720] > (GCC) > > > # gmake > ... > gmake[4]: Entering directory `/usr/share/src/ppl-build/demos/ > ppl_lpsol' > gcc -DHAVE_CONFIG_H -I. -I../../../ppl/demos/ppl_lpsol -I../.. > -I../../interfaces/C -I/usr/local/include -pedantic -std=gnu89 - > Werror -g -O3 > -fomit-frame-pointer -march=k8 -frounding-math -W -Wall -MT > ppl_lpsol.o -MD > -MP -MF .deps/ppl_lpsol.Tpo -c -o ppl_lpsol.o > ../../../ppl/demos/ppl_lpsol/ppl_lpsol.c > mv -f .deps/ppl_lpsol.Tpo .deps/ppl_lpsol.Po > /bin/sh ../../libtool --tag=CXX --mode=link g++ -g -O3 -fomit- > frame-pointer > -march=k8 -frounding-math -W -Wall -o ppl_lpsol ppl_lpsol.o > dummy.o -lglpk > ../../interfaces/C/libppl_c.la -lm -L/usr/local/lib -lgmpxx -L/usr/ > local/lib > -lgmp -R/usr/local/lib -R/usr/local/lib > libtool: link: g++ -g -O3 -fomit-frame-pointer -march=k8 -frounding- > math -W > -Wall -o .libs/ppl_lpsol ppl_lpsol.o dummy.o /usr/local/lib/ > libglpk.so -lz > ../../interfaces/C/.libs/libppl_c.so -L/usr/local/lib > /usr/share/src/ppl-build/src/.libs/libppl.so /usr/local/lib/libstdc+ > +.so > /usr/local/lib/libgmpxx.so /usr/local/gcc4/lib/libstdc++.so -lm > /usr/local/lib/libgmp.so -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath > -Wl,/usr/local/gcc4/lib > ../../interfaces/C/.libs/libppl_c.so: undefined reference to > `typeinfo for int' > collect2: ld returned 1 exit status > gmake[4]: *** [ppl_lpsol] Error 1 > gmake[4]: Leaving directory `/usr/share/src/ppl-build/demos/ppl_lpsol' > > > If I run that using "-v" I get this collect command: > > /usr/local/gcc4/libexec/gcc/i386-pc-solaris2.11/4.4.0/collect2 -V -m > elf_i386 > -Y P,/usr/ccs/lib:/usr/lib -Qy -o .libs/ppl_lpsol /usr/lib/crt1.o > /usr/lib/crti.o /usr/lib/values-Xa.o > /usr/local/gcc4/lib/gcc/i386-pc-solaris2.11/4.4.0/crtbegin.o -L/usr/ > local/lib > -L/usr/local/gcc4/lib/gcc/i386-pc-solaris2.11/4.4.0 > -L/usr/local/gcc4/lib/gcc/i386-pc-solaris2.11/4.4.0/../../.. > ppl_lpsol.o > dummy.o --verbose /usr/local/lib/libglpk.so -lz > ../../interfaces/C/.libs/libppl_c.so > /usr/share/src/ppl-build/src/.libs/libppl.so /usr/local/lib/libstdc+ > +.so > /usr/local/lib/libgmpxx.so /usr/local/gcc4/lib/libstdc++.so > /usr/local/lib/libgmp.so -rpath /usr/local/lib -rpath /usr/local/ > gcc4/lib > -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc > /usr/local/gcc4/lib/gcc/i386-pc-solaris2.11/4.4.0/crtend.o /usr/lib/ > crtn.o > > > If I run that then I get this simple and useless output: > > ../../interfaces/C/.libs/libppl_c.so: undefined reference to > `typeinfo for int' > collect2: ld returned 1 exit status > > > If I run that exact same command but make a simple alteration: > - ... -lz ../../interfaces/C/.libs/libppl_c.so > + ... -lz ../../interfaces/C/.libs/*.o > > I can use the Object files that were used to create the Shared Library > instead of using the Shared Library. This is useful (due to this > Bug or needed RFE) since the error messages printed are by _far_ more > useful, see: > > # /usr/local/gcc4/libexec/gcc/i386-pc-solaris2.11/4.4.0/collect2 -V - > m elf_i386 > -Y P,/usr/ccs/lib:/usr/lib -Qy -o .libs/ppl_lpsol /usr/lib/crt1.o > /usr/lib/crti.o /usr/lib/values-Xa.o > /usr/local/gcc4/lib/gcc/i386-pc-solaris2.11/4.4.0/crtbegin.o -L/usr/ > local/lib > -L/usr/local/gcc4/lib/gcc/i386-pc-solaris2.11/4.4.0 > -L/usr/local/gcc4/lib/gcc/i386-pc-solaris2.11/4.4.0/../../.. > ppl_lpsol.o > dummy.o /usr/local/lib/libglpk.so -lz ../../interfaces/C/.libs/*.o > /usr/share/src/ppl-build/src/.libs/libppl.so /usr/local/lib/libstdc+ > +.so > /usr/local/lib/libgmpxx.so /usr/local/gcc4/lib/libstdc++.so > /usr/local/lib/libgmp.so -rpath /usr/local/lib -rpath /usr/local/ > gcc4/lib > -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc > /usr/local/gcc4/lib/gcc/i386-pc-solaris2.11/4.4.0/crtend.o /usr/lib/ > crtn.o > GNU ld (GNU Binutils) 2.19.1 > Supported emulations: > elf_i386_ldso > elf_i386 > elf_x86_64 > ../../interfaces/C/.libs/ppl_c__BD_Shape_mpq_class.o: In function > `sgn<Parma_Polyhedra_Library::Checked_Number<__gmp_expr<__mpz_struct > [1], > __mpz_struct [1]>, Parma_Polyhedra_Library::Extended_Number_Policy> > >': > /usr/share/src/ppl-build/interfaces/C/../../src/ppl.hh:11187: > undefined > reference to `typeinfo for int' > ../../interfaces/C/.libs/ppl_c__BD_Shape_mpq_class.o: In function > `sgn<Parma_Polyhedra_Library::Checked_Number<__gmp_expr<__mpq_struct > [1], > __mpq_struct [1]>, > Parma_Polyhedra_Library::WRD_Extended_Number_Policy> >': > /usr/share/src/ppl-build/interfaces/C/../../src/ppl.hh:11187: > undefined > reference to `typeinfo for int' > ../../interfaces/C/.libs/ppl_c__BD_Shape_mpq_class.o: In function > `sgn<Parma_Polyhedra_Library::Checked_Number<__gmp_expr<__mpz_struct > [1], > __mpz_struct [1]>, > Parma_Polyhedra_Library::WRD_Extended_Number_Policy> >': > /usr/share/src/ppl-build/interfaces/C/../../src/ppl.hh:11187: > undefined > reference to `typeinfo for int' > ../../interfaces/C/.libs/ppl_c__BD_Shape_mpq_class.o: In function > `sgn<Parma_Polyhedra_Library::Checked_Number<__gmp_expr<__mpq_struct > [1], > __mpq_struct [1]>, Parma_Polyhedra_Library::Extended_Number_Policy> > >': > /usr/share/src/ppl-build/interfaces/C/../../src/ppl.hh:11187: > undefined > reference to `typeinfo for int' > /usr/share/src/ppl-build/interfaces/C/../../src/ppl.hh:11187: > undefined > reference to `typeinfo for int' > ../../interfaces/C/.libs/ppl_c__BD_Shape_mpq_class.o:/usr/share/src/ > ppl-build/interfaces/C/../../src/ppl.hh:11187: > more undefined references to `typeinfo for int' follow > collect2: ld returned 1 exit status > > See how gcc now gives line numbers that show exactly were the > undefined > references may be located instead of just complaining that there are > some, > somewhere. > > Rob > > > -- > Summary: The Driver hides "undefined reference" messages > from > shared libs (but not object files) in linker phase > Product: gcc > Version: 4.4.0 > Status: UNCONFIRMED > Severity: enhancement > Priority: P3 > Component: driver > AssignedTo: unassigned at gcc dot gnu dot org > ReportedBy: rob1weld at aol dot com > GCC build triplet: * > GCC host triplet: * > GCC target triplet: * > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39439 > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39439