This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Error resolution
"Rajaya, Kiran" <Kiran.Rajaya@STJUDE.ORG> writes:
> Can anyone please tell me the cause of this error when I'm trying to
> execute the simple hello world program in C++ on gcc.
>
> /sbin/loader: Fatal Error: Cannot map library libstdc++.so.5
libstdc++.so.5 is normally installed in <prefix>/lib . <prefix> is
/usr/local by default, so libstdc++.so.5 is by default iinstalled in
/usr/local/lib .
Now you know this, but your dynamic linker doesn't. You need to tell
your dynamic linker where to find libstdc++.so.5 . The only
portable way I know of to do this is to add the directory
libstdc++.so.5 is in to LD_LIBRARY_PATH :
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
(for sh, bash, etc)
> setenv LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
(for csh, tcsh, etc)
Beyond that, you should read the man page for your dynamic linker,
which unfortunately, is named differently on every system. Try
'man loader' (because that's the program reporting the error on
your machine), 'man ld.so' (ld.so is the linux dynamic linker),
'man rtld' (freebsd), 'man dyld' (darwin/MacOSX) and man
'ld.so.1' (solaris) . Each of the preceeding is a guess that works
right on at least one unix that I know of, but you didn't say
which platform you are on, so I don't know which one is good for
you.