Discussion:
What is the best/recommended technique for referencing development libraries?
Patrick Doyle
2014-12-11 03:20:02 UTC
Permalink
I am playing with the Gstreamer zbar plugin, which is an
autoconfiscated library.

It relies upon another autoconfiscated library, libzbar.

I have a custom application which loads gstzbar, which, in turn, loads
libzbar from /usr/lib/wherever. Everything works quite nicely, thank
you all very much.

But now I would like to compile a custom version of libzbar, and tell
my custom gstzbar plugin to reference that library instead of the one
install in /usr/lib.

What's the best/recommended way to do this?

One way I could do this is via brute force. I could uninstal the
precompiledl libzbar, compile the new version, install it in
/usr/local, and recognize that pkg-config will find the new one in
/usr/local/lib.

I feel like there should be a better way to do this sort of thing.
Any suggestions?

--wpd
Mike Frysinger
2015-02-16 05:21:09 UTC
Permalink
Post by Patrick Doyle
I am playing with the Gstreamer zbar plugin, which is an
autoconfiscated library.
It relies upon another autoconfiscated library, libzbar.
I have a custom application which loads gstzbar, which, in turn, loads
libzbar from /usr/lib/wherever. Everything works quite nicely, thank
you all very much.
But now I would like to compile a custom version of libzbar, and tell
my custom gstzbar plugin to reference that library instead of the one
install in /usr/lib.
What's the best/recommended way to do this?
One way I could do this is via brute force. I could uninstal the
precompiledl libzbar, compile the new version, install it in
/usr/local, and recognize that pkg-config will find the new one in
/usr/local/lib.
I feel like there should be a better way to do this sort of thing.
Any suggestions?
assuming it's for local testing only, you can use -Wl,-rpath,/path/to/libs/ when
linking your programs/libs.

you could also set LD_LIBRARY_PATH when running the main program.
-mike
Thomas Jahns
2015-02-16 09:52:53 UTC
Permalink
Post by Patrick Doyle
But now I would like to compile a custom version of libzbar, and tell
my custom gstzbar plugin to reference that library instead of the one
install in /usr/lib.
What's the best/recommended way to do this?
So you want to link something in /usr/local instead of /usr/lib and use run-time
loading. That means you want to use dynamic linking, which is outside the scope
of autoconf itself but addressed much more reliably with libtool. I recommend
you use that.

Regards, Thomas
--
Thomas Jahns
HD(CP)^2
Abteilung Anwendungssoftware

Deutsches Klimarechenzentrum GmbH
Bundesstraße 45a • D-20146 Hamburg • Germany

Phone: +49 40 460094-151
Fax: +49 40 460094-270
Email: Thomas Jahns <***@dkrz.de>
URL: www.dkrz.de

Geschäftsführer: Prof. Dr. Thomas Ludwig
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg HRB 39784
Patrick Doyle
2015-02-16 21:26:47 UTC
Permalink
Post by Thomas Jahns
Post by Patrick Doyle
But now I would like to compile a custom version of libzbar, and tell
my custom gstzbar plugin to reference that library instead of the one
install in /usr/lib.
What's the best/recommended way to do this?
So you want to link something in /usr/local instead of /usr/lib and use
run-time loading. That means you want to use dynamic linking, which is
outside the scope of autoconf itself but addressed much more reliably with
libtool. I recommend you use that.
Wow! That took a _long_ time to percolate through the system. Thanks
for the answers folks. Please keep them coming. In the mean time, I
learned that if I just added path/to/library.la to my _LDADD
definition, and put an LT_INIT in my configure.ac file, I could test
my application and pull in the new library the way I wanted.

--wpd

Loading...