Best practices for setting -rpath in .pc files?

Enrico Weigelt weigelt at
Tue Aug 24 18:21:26 PDT 2010

* Abdoulaye Walsimou GAYE <awg at> schrieb:

> >I maintain a library which (for testing and various other reasons)
> >people often want to install into directories not on their usual
> >library search path.
> And when they cross compile, they also want to install them else where!

In this case you want to use a sysroot'ed toolchain and properly pass 
the $SYSROOT variable. Everything else is nothing but dirty hacks with 
great change of (sometimes even unnoticed) breaks - dont do that.

> >When they do this, is there any sense of whether it's reasonable to
> >include an -rpath flag (or a -Wl,-R flag, or a -R flag, or a
> >-Wl,-rpath flag as appropriate) in the .pc file?  Or is this a bad
> >idea for some reason?
> rpath is bad in case of cross compile, and other reasons explained here [1]

A very bad. Unfortunately that's one of the things where libtool
tends to really phrack up things.

Dont use rpath, unless you're absolutely knowing what you're doing ;-p

 Enrico Weigelt, metux IT service --

 phone:  +49 36207 519931  email: weigelt at
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme

More information about the pkg-config mailing list