Dynamic linker is unable to find GCC libraries

Benoit Hudson bhudson@ptolemy.arc.nasa.gov
Wed Jul 5 14:45:00 GMT 2000


My particular problem is with libstdc++.  If my LD_LIBRARY_PATH isn't set
to include $(libdir), I can compile and link, but not run.

Now, I know that law@cygnus.com has a response to this very question in the
FAQ.  But his answer:
        we don't pass -R to the linker because your program might hang even
        if it isn't using the library.
Is easily refuted by:
        every C++ program uses libstdc++.

I've fixed the problem in my personal installation by making g++ be a
script (and c++ is a symlink to g++)
        #! /bin/sh
        exec real-g++ "$@" -R $(libdir)

I'd have to write about the same, but -rpath, on my linux box.

So it's easy to fix, but it shouldn't be the user's responsibility.

        -- Benoit


More information about the Gcc-bugs mailing list