samedi 27 juin 2015

How to configure shared library search path after building GCC on my own?

I just built GCC 5.1 on Ubuntu 14.04, which has gcc 4.8 as default. When I try to build things with it, I find that ld will use the default libstdc++ instead of the newly build one. Here is the output:

drizzlex@dx ~/test
$ g++ hello.cpp 

drizzlex@dx ~/test
$ ldd a.out 
    linux-vdso.so.1 =>  (0x00007ffde0d25000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6     (0x00007fa181ad2000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa1817cc000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa1815b5000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa1811f0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fa181dfd000)

And if I use $ export LD_LIBRARY_PATH=/usr/local/lib64/, it will find the right one.

drizzlex@dx ~/test
$ ldd a.out 
    linux-vdso.so.1 =>  (0x00007fffeeaf5000)
    libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 (0x00007f4583d92000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4583a67000)
    libgcc_s.so.1 => /usr/local/lib64/libgcc_s.so.1 (0x00007f4583850000)    
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f458348b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f458410e000)

I would like to know what should I do to make it correct? Since I know set LD_LIBRARY_PATH is not the best choice.

Aucun commentaire:

Enregistrer un commentaire