Adding linker flags in .pc files

Matt Hoosier mwhoosier at gmail.com
Fri Apr 28 12:34:19 PDT 2006


(Apologies for leaving the body of my first message unrelated to its
subject line. See the note below.)

On 4/28/06, Matt Hoosier <mwhoosier at gmail.com> wrote:
> I'm using CodeSourcery's EABI ARM cross-toolchain (their 2005q3
> release, based on gcc 3.4.4 and binutils 2.16.91) to compile a set of
> Debian packages for embedded deployment.
>
> The stock 0.61 release of D-BUS compiles and installs cleanly, but ld
> consistently fails to find libdbus-1.so.2 (installed in /usr/lib) when
> I attempt to link client programs against it. The error message
> contains the usual suggestion to add "-rpath /usr/lib" into one's
> LDFLAGS. It typically looks like this:
>
> /scratchbox/compilers/arm-xscale-linux-cs344-2.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.4/../../../../arm-none-linux-gnueabi/bin/ld:
> warning: libdbus-1.so.2, needed by ../gconf/.libs/libgconf-2.so, not
> found (try using -rpath or -rpath-link)
>
> A couple of programs which both exhibit this linkage failure and are
> available to anybody reading this message would be Imendio's
> GConf-over-dbus port and Raphaël Slinckx's little tutorial on how to
> do activation:
>
>     http://raphael.slinckx.net/dbustutorial.php
>
> In both cases (gconf-dbus and the activation example), adding
> "-Wl,-rpath,/usr/lib" to the LDFLAGS environment variable allows these
> (autotools-based) programs which link against D-BUS to finish
> building. I can hack this into every dependent package's
> specification, but would rather figure out what's causing the library
> not to be found.
>
> Has anybody else run into similar linker failures?
>

I meant to add here that one workaround would be to insert
"-Wl,-rpath,/usr/lib" into the default linker flags inside dbus-1.pc.
I'm curious whether anybody counsels this to be a reasonable solution,
or just masking a bigger problem.


More information about the dbus mailing list