improper inclusion of LDFLAGS in topcomp.c

Jean-François Mertens <[email protected]> Tue, 21 Apr 2009 18:27:09 +0200
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Hi,

I have a build of ppl that fails with

> gplc --c-compiler g++-4 -o ppl_gprolog \
>                 ppl_gprolog.pl .libs/libppl_gprolog.a \
>                 -L ' -g -O3 -fomit-frame-pointer -frounding-math  - 
> W -Wall -L../../../src/.libs -lppl -L../../../Watchdog/src/.libs - 
> lpwl -lgmpxx -lgmp -lstdc++ -L/sw/lib/gcc4.4/lib -lgcc_s.1'
> g++-4: unrecognized option '-no-cpp-precomp'
> /usr/bin/ld: Undefined symbols:
> Parma_Polyhedra_Library::c_streambuf::sync()
> Parma_Polyhedra_Library::c_streambuf::uflow()
> Parma_Polyhedra_Library::c_streambuf::xsgetn(char*, int)
> Parma_Polyhedra_Library::c_streambuf::xsputn(char const*, int)
> Parma_Polyhedra_Library::c_streambuf::overflow(int)
> Parma_Polyhedra_Library::c_streambuf::pbackfail(int)
> Parma_Polyhedra_Library::c_streambuf::underflow()
> Parma_Polyhedra_Library::Linear_Expression::Linear_Expression 
> (Parma_Polyhedra_Library::Variable, Parma_Polyhedra_Library::Variable)
> Parma_Polyhedra_Library::operator- 
> (Parma_Polyhedra_Library::Linear_Expression const&,  
> Parma_Polyhedra_Library::Variable)
> Parma_Polyhedra_Library::operator+ 
> (Parma_Polyhedra_Library::Variable, Parma_Polyhedra_Library::Variable)
> collect2: ld returned 1 exit status

This could not have failed : "-L../../../src/.libs -lppl" is first
among the link flags, and that library contains those symbols.

Re-running the same command manually, with -v added, gives the
explanation (there is an older version of libppl, not containing  
those symbols, in /sw/lib) :
> /sw/bld/ppl-0.10.2-1/ppl-0.10.2/interfaces/Prolog/GNU# gplc --c- 
> compiler g++-4 -o ppl_gprolog \
> >                 ppl_gprolog.pl .libs/libppl_gprolog.a \
> >                 -L ' -g -O3 -fomit-frame-pointer -frounding-math   
> -W -Wall -L../../../src/.libs -lppl -L../../../Watchdog/src/.libs - 
> lpwl -lgmpxx -lgmp -lstdc++ -L/sw/lib/gcc4.4/lib -lgcc_s.1 -v'
> Using built-in specs.
> g++-4: unrecognized option '-no-cpp-precomp'
> Target: powerpc-apple-darwin8
> Configured with: ../gcc-4.4-20090407/configure --prefix=/sw -- 
> prefix=/sw/lib/gcc4.4 --mandir=/sw/share/man --infodir=/sw/share/ 
> info --enable-languages=c,c++,fortran,objc,java,obj-c++ --with-gmp=/ 
> sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw -- 
> with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/ 
> X11R6/lib --disable-libjava-multilib --build=powerpc-apple-darwin8  
> --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
> Thread model: posix
> gcc version 4.4.0 20090407 (prerelease) (GCC)
> COMPILER_PATH=/Volumes/EXT_UFS/sw/lib/gcc4.4/bin/../libexec/gcc/ 
> powerpc-apple-darwin8/4.4.0/:/Volumes/EXT_UFS/sw/lib/gcc4.4/bin/../ 
> libexec/gcc/:/usr/libexec/gcc/powerpc-apple-darwin8/:/usr/lib/gcc/ 
> powerpc-apple-darwin8/
> LIBRARY_PATH=/Volumes/EXT_UFS/sw/lib/gcc4.4/bin/../lib/gcc/powerpc- 
> apple-darwin8/4.4.0/:/Volumes/EXT_UFS/sw/lib/gcc4.4/bin/../lib/ 
> gcc/:/Volumes/EXT_UFS/sw/lib/gcc4.4/bin/../lib/gcc/powerpc-apple- 
> darwin8/4.4.0/../../../:/usr/lib/
> COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.4' '-mpowerpc' '-no- 
> cpp-precomp' '-L/sw/lib' '-o' 'ppl_gprolog' '-g' '-O3' '-fomit- 
> frame-pointer' '-frounding-math' '-W' '-Wall' '-L../../../ 
> src/.libs' '-L../../../Watchdog/src/.libs' '-L/sw/lib/gcc4.4/lib' '- 
> v' '-shared-libgcc'
>  /Volumes/EXT_UFS/sw/lib/gcc4.4/bin/../libexec/gcc/powerpc-apple- 
> darwin8/4.4.0/collect2 -dynamic -arch ppc -macosx_version_min 10.4 - 
> multiply_defined suppress -weak_reference_mismatches non-weak -o  
> ppl_gprolog -lcrt1.o /Volumes/EXT_UFS/sw/lib/gcc4.4/bin/../lib/gcc/ 
> powerpc-apple-darwin8/4.4.0/crt3.o -L/sw/lib -L../../../src/.libs - 
> L../../../Watchdog/src/.libs -L/sw/lib/gcc4.4/lib -L/Volumes/ 
> EXT_UFS/sw/lib/gcc4.4/bin/../lib/gcc/powerpc-apple-darwin8/4.4.0 -L/ 
> Volumes/EXT_UFS/sw/lib/gcc4.4/bin/../lib/gcc -L/Volumes/EXT_UFS/sw/ 
> lib/gcc4.4/bin/../lib/gcc/powerpc-apple-darwin8/4.4.0/../../.. /var/ 
> tmp/gplcd1XfTa.o .libs/libppl_gprolog.a -lppl -lpwl -lgmpxx -lgmp - 
> lstdc++ -lgcc_s.1 /Volumes/EXT_UFS/sw/lib/all_pl_bips.o /Volumes/ 
> EXT_UFS/sw/lib/all_fd_bips.o /Volumes/EXT_UFS/sw/lib/top_level.o / 
> Volumes/EXT_UFS/sw/lib/debugger.o /Volumes/EXT_UFS/sw/lib/ 
> libbips_fd.a /Volumes/EXT_UFS/sw/lib/libengine_fd.a /Volumes/ 
> EXT_UFS/sw/lib/libbips_pl.a /Volumes/EXT_UFS/sw/lib/libengine_pl.a / 
> Volumes/EXT_UFS/sw/lib/liblinedit.a -lm -lstdc++ -lgcc_s.10.4 -lgcc  
> -lSystemStubs -lSystem
> /usr/bin/ld: Undefined symbols:
> Parma_Polyhedra_Library::c_streambuf::sync()
> Parma_Polyhedra_Library::c_streambuf::uflow()
> Parma_Polyhedra_Library::c_streambuf::xsgetn(char*, int)
> Parma_Polyhedra_Library::c_streambuf::xsputn(char const*, int)
> Parma_Polyhedra_Library::c_streambuf::overflow(int)
> Parma_Polyhedra_Library::c_streambuf::pbackfail(int)
> Parma_Polyhedra_Library::c_streambuf::underflow()
> Parma_Polyhedra_Library::Linear_Expression::Linear_Expression 
> (Parma_Polyhedra_Library::Variable, Parma_Polyhedra_Library::Variable)
> Parma_Polyhedra_Library::operator- 
> (Parma_Polyhedra_Library::Linear_Expression const&,  
> Parma_Polyhedra_Library::Variable)
> Parma_Polyhedra_Library::operator+ 
> (Parma_Polyhedra_Library::Variable, Parma_Polyhedra_Library::Variable)


: a flag  '-L/sw/lib' is inserted, and right at the beginning in  
addition!
This is clearly done by the gplc command, and looking in its builddir
seems to point to line 311 in topcomp.c ..

If gplc needs to put some of gprolog's libraries on its compile  
commands,
I would suggest it does so explicitly, with their full path,
and don't put any '-L' flag.

Jean-Francois Mertens