Adding default RUNPATH to compiled binaries

Ian Lance Taylor iant@google.com
Mon Dec 12 06:29:00 GMT 2011


"Maciej (Matchek) Bliziński" <maciej@opencsw.org> writes:

> I've seen this topic discussed many times. The problem seems to come
> up every time gcc is compiled with prefix != /usr/bin. The way to
> reproduce it is simple:
>
> echo "int main() {}" > t.c; g++ -o t t.c ; ./t
>
> The result:
>
> ld.so.1: t: fatal: libstdc++.so.6: open failed: No such file or directory
> Killed
>
> I just had a bug filed against my gcc packages[1].  I did some
> research, and I found information about a number of approaches, which
> aren't really consistent and none of them is explained or
> self-explanatory.
>
> In some instances GCC sources were patched[2], in other the spec
> information was dumped, modified and placed where it would be taken as
> the default[3].
>
> What's the recommended way of doing it?


It depends.  One good approach is to add the appropriate directory to
/etc/ld.so.conf and run ldconfig.

Ian



More information about the Gcc-help mailing list