This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: 3.1.1--/usr/bin/ld: cannot find -lstdc++
- From: pkurpis at keck dot hawaii dot edu (Peter Kurpis)
- To: boldi01 at freemail dot hu
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 30 May 2002 14:04:21 -1000 (HST)
- Subject: Re: 3.1.1--/usr/bin/ld: cannot find -lstdc++
> 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.