3.1.1--/usr/bin/ld: cannot find -lstdc++

Peter Kurpis pkurpis@keck.hawaii.edu
Thu May 30 17:05:00 GMT 2002


> After I tried to complie id3lib 3.8.0 but:
> checking for c++... c++
> checking whether the C++ compiler (c++  ) works... no
> configure: error: installation or configuration problem: C++ compiler
> cannot create executables.
> 
> In configure.log:
> 
> configure:1838: checking for c++
> configure:1870: checking whether the C++ compiler (c++  ) works
> configure:1886: c++ -o conftest    conftest.C  1>&5
> /usr/bin/ld: cannot find -lstdc++

Although gcc finds libc okay by default, g++ doen't necessarily
find libstdc++ by default.  This is because the directory libc
is usually in (e.g. /usr/lib) is in the ld search path, but the
directory libstdc++ is installed into (e.g. /usr/local/lib) is not.

You need to tell g++ where to look explicitly.  This depends on
your system.  On Solaris, a "quick and dirty" way is to set
the environment variable  LD_LIBRARY_PATH  to  /usr/local/bin
(or wherever libstdc++ is located).  In some builds, you could
try adding the makefile macro

	LDFLAGS += -Wl,-R/usr/local/lib

or 

	LDFLAGS += -Wl,-rpath/usr/local/lib

depending on which ld you're using (in this case Solaris /usr/ccs/bin/ld
or GNU ld).  This would hardwire the path to libstdc++.so into the 
executable.



More information about the Gcc-help mailing list