[gst-devel] Compiling Plugin with additional Libraries

Stefan Kost ensonic at hora-obscura.de
Fri Feb 3 09:51:05 CET 2006

Hi Sameer,

this is going offtopic ...

Sameer Naik wrote:
> Hi
>     ok i tried quite some stuff from what u suggested...heres it
> since the libs im using aren't having the lib prefix, meaning they are 
> not like libalgorithm.a instead they are algorithm.a, so i guess i cant 
> use -lalgorithm,
> since i read on some webpage that -lalgorithm would mean that the linker 
> would look for libalgorithm.a... so heres what i did to include the libs
> */*command seq 01*/*
> ./configure --prefix=/opt/gstreamer CFLAGS=-I/opt/include 
> LDFLAGS="-L/opt/lib/algorithm.a  -L/opt/lib/memory.a -L/opt/lib/math.lib"
> make
> make install
Totally wrong:
-L<path> adds to the linker path
-l<name> links against lib<name>.a or .so

> i figured that ldd on the plugins.so file won't show me any of the libs 
> i've included, since my libs are static libs
> so heres a small check i carried out
> first i compiled the plugin without including any of my libs with the 
> following commands
> */*command seq 02*/*
> ./configure --prefix=/opt/gstreamer CFLAGS=-I/opt/include
> make
> make install
> then i checked the properties of the libraries (only */size of interest 
> here/*)...heres the output
> -rw-r--r--    1 root root 16816 Feb  3 01:36 libgstgdec.a
> -rwxr-xr-x  1 root root  1148 Feb  3 01:36 libgstgdec.la
> -rwxr-xr-x  1 root root 39723 Feb  3 01:36 libgstgdec.so
> and then i compiled again including the libraries using *command 
> sequence 01* (/above/)... heres the output
> -rw-r--r--    1 root root 16816 Feb  3 15:16 libgstgdec.a
> -rwxr-xr-x  1 root root  1483 Feb  3 15:16 libgstgdec.la
> -rwxr-xr-x  1 root root 39723 Feb  3 15:16 libgstgdec.so
> so looking carefully at the sizes. they change for libgstgdec.la ... a 
> diiference in size of 335...
> next i checked the total size of the libs im including (ie. the .a and 
> .lib files), which comes out to be 336.8 Kb...
> does this mean that my libs are getting included?? i mean is it that 
> including static libs (.a, .lib files) would affect the size of 
> libgstgdec.la file.
> also does changing the lib name from algorithm.a to libalgorithm.a have 
> any side affect on the library? (hope u get what i mean.)
> -----thats it for the compile
> next.. on the research i did.. i found that .a means nothing but an 
> archive of .o files...so i could extract the .o files from the archive
> so are there any options that i could give the ./configure script or the 
> makefile to include these .o files while linking...
> u must have noticed by now, that these libs are not created/compiled by 
> me. ;).
> anyways plz help me some more :) .

why don't just just list the additional dependencies in you Makefile.am ?

libgstfoo_la_LIBADD="algorithm.a memory.a math.lib"


> awaiting ur replies.
> bye
> take care
> sameer
> On Thu, 2006-02-02 at 13:53 +0100, Stefan Kost wrote:
>>Hi Sameer,
>>so the libs are your own. In this case forget the pkg-config stuff for now (that 
>>is used for third party stuff).
>>All you need is to add something lib '-lalgorithm -lmemory' to your LDFLAGS.
>>Sameer Naik wrote:
>>> thanks man...
>>> i really appreciate the help
>>> but, i really need some guidance here... i dont wanna screw stuff up.
>>> let me explain my scenario...
>>> my libraries are in
>>> /opt/lib/
>>> the files inside this folder are like
>>> algorithm.a
>>> memory.a
>>> math.lib
>>> and so on
>>> the includes are in
>>> /opt/include
>>> (no problem with these getting included,...since i dont get compilation 
>>> errors)
>>> dunno much about pkg-config...so u gotta help me here too
>>> my pkg-config path is PKG_CONFIG_PATH=/opt/gstreamer/lib/pkgconfig
>>> so plz lemme know how to locate the lib using pkg-config
>>> and also about LDADD, LDFLAGS (actually i know a bit about this....just 
>>> wanna make sure)
>>> plz help
>>> awaiting ur reply
>>> thanks
>>> take care
>>> Sameer
>>> On Wed, 2006-02-01 at 21:37 +0100, Stefan Kost wrote:
>>>>if ldd does not show the lib, its not linked against it. You should
>>>>locate the lib using pkg-config or the like and add the lib to the
>>>>variables in Makefile.am (LDADD, LDFLAGS, ..).
>>>>If ldd shows the lib, but can't resolv it, check that /opt/lib is in you
>>>>Sameer Naik wrote:
>>>>> Hello everyone...
>>>>> i have developed a plugin that need additional libraries to get working
>>>>> the include file for my library are  in
>>>>> */opt/include*
>>>>> and the library files are in
>>>>> */opt/lib*
>>>>> i have developed my plugin using the plugin template available in the
>>>>> gstreamer cvs.
>>>>> heres what i do to compile my plugin
>>>>> ./configure CFLAGS=-I/opt/include LDFLAGS=-L/opt/lib
>>>>> make
>>>>> make install
>>>>> (i do nothing more than this to tell the compiler about the libraries
>>>>> i wanna use.)
>>>>> my plugin gets compiled well
>>>>> when i do a gst-inspect on my plugin it says "plugin or element not found"
>>>>> i did an ldd on the .so file of my plugin to check what libraries its
>>>>> compiled against, and none of
>>>>> my libraries (the libs i wanna use) are shown, only the gstreamer,
>>>>> glibc,and so on are shown...
>>>>> im quite sure that the external libraries i want to use are not
>>>>> getting linked to my plugin...probably im missing something..
>>>>> looks like im missing something really minor, something im not aware
>>>>> of :)...
>>>>> plz help
>>>>> thanks in advance
>>>>> take care
>>>>> Sameer 

More information about the gstreamer-devel mailing list