linking against libbfd without modify LD_LIBRARY_PATH

Mike Frysinger vapier@gentoo.org
Mon Dec 5 15:32:00 GMT 2011


On Monday 05 December 2011 08:05:36 Baojun Wang wrote:
> Many thanks for your help Mike.
> The distro is gentoo (~amd64, up-to-dated) ;)
> 
> RPATH is /usr/lib64/binutils/x86_64-pc-linux-gnu/2.22

binutils-config in Gentoo takes care of setting up an ldpath that is full of 
links to all the binutils libraries.  seems to be working for me:
$ cat /etc/ld.so.conf.d/05binutils.conf
/usr/x86_64-pc-linux-gnu/lib
$ echo 'main(){}' > test.c
$ gcc test.c -lbfd
$ ldd a.out  | grep bfd
        libbfd-2.22.so => /usr/x86_64-pc-linux-gnu/lib/libbfd-2.22.so 
(0x00007f92d450c000)

> The problem is there is no such tool like pkg-config which can output
> the lib path automatically, IE:
> 
> pkg-config --cflags --libs glib-2.0
> -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -lglib-2.0

the binutils project doesn't provide .pc files, so i'm not going to generate 
one for Gentoo as it'd encourage forking

also, please don't top post
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/binutils/attachments/20111205/6e5dce78/attachment.sig>


More information about the Binutils mailing list