使用自动工具在gstreamer插件中链接外部库 [英] Linking against external libraries in gstreamer plugin using autotools
问题描述
I have written a gstreamer plugin using the boilerplate template refrenced in the gstreamer plugin writers guide (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-boiler.html). I first built the plugin without full implementation of the chain function (basically an empty plugin that passed data from the source to sink with no changes).
我现在正在实现链功能,以对缓冲区中的数据执行基本过滤.过滤使用外部锐化库(我已经在gstreamer外部成功使用了该库).使用自动工具进行构建时,没有任何错误,但是使用新插件创建管道时,却出现了未定义的符号错误
I am now implementing the chain function to perform a basic filtering on the data in the buffer. The filtering uses an external sharpening library (which I have successfully used outside of gstreamer). When building using autotools I get no errors, but when creating a pipeline using the new plugin, I get an undefined symbol error
(gst-plugin-scanner:6512): GStreamer-WARNING **: Failed to load plugin '/usr/local/lib/gstreamer-1.0/libgstsharpening.so': /usr/local/lib/gstreamer-1.0/libgstsharpening.so: undefined symbol: InitializeSharpeningModule
我对自动工具非常陌生,我相信我的问题出在该过程的某个地方,但我不知道在哪里.可以在此处找到正在使用的外部锐化库
I am admittedly very new to autotools, and I believe my problem lies somewhere in that process, but I can't figure out where. The external sharpening library being used can be found here
/public/gstreamer_pipeline/lib/libsharpening.so
我为我的插件在src目录中编辑了插件Makefile.am
I edited the plugin Makefile.am found in the src directory for my plugin
/public/gstreamer_pipeline/src/gst-sharpening/src
编辑后的Makefile.am的内容是
The contents of the edited Makefile.am are
plugin_LTLIBRARIES = libgstsharpening.la
libgstsharpening_la_SOURCES = gstsharpening.c gstsharpening.h
libgstsharpening_la_CFLAGS = $(GST_CFLAGS) -I/public/gstreamer_pipeline/include
libgstsharpening_la_LIBADD = $(GST_LIBS) -lsharpening
libgstsharpening_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -L/public/gstreamer_pipeline/lib
libgstsharpening_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
noinst_HEADERS = gstsharpening.h
从主程序创建管道或使用命令行从命令行创建管道时,发生未定义的符号错误
The undefined symbol error is occuring in the case of creating the pipeline from a main program, or creating the pipeline from the command line using
gst-launch-1.0 fakesrc ! sharpening ! fakesink
在新创建的插件库上运行ldd的输出(不修改LD_LIBRARY_PATH)为
The output of running ldd on the new created plugin library (without modifying LD_LIBRARY_PATH) is
ldd /usr/local/lib/gstreamer-1.0/libgstsharpening.so
linux-vdso.so.1 => (0x00007fff17bc0000)
libgstbase-1.0.so.0 => /usr/local/lib/libgstbase-1.0.so.0 (0x00007f3c51778000)
libgstcontroller-1.0.so.0 => /usr/local/lib/libgstcontroller-1.0.so.0 (0x00007f3c51568000)
libgstreamer-1.0.so.0 => /usr/local/lib/libgstreamer-1.0.so.0 (0x00007f3c51250000)
libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x00007f3c5104d000)
libm.so.6 => /lib64/libm.so.6 (0x00007f3c50db0000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f3c50bac000)
libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x00007f3c5095f000)
libffi.so.6 => /usr/local/lib/../lib64/libffi.so.6 (0x00007f3c50755000)
libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x00007f3c50420000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f3c50203000)
librt.so.1 => /lib64/librt.so.1 (0x00007f3c4fffa000)
libc.so.6 => /lib64/libc.so.6 (0x00007f3c4fc67000)
/lib64/ld-linux-x86-64.so.2 (0x0000003406c00000)
configure.log输出 http://pastie.org/10450341
The configure.log output http://pastie.org/10450341
make and make install的输出 http://pastie.org/10450352
The output of make and make install http://pastie.org/10450352
推荐答案
运行时链接程序/加载器很可能无法在非标准路径(>/public/gstreamer_pipeline/lib/
).
Most likely the runtime linker/loader cannot find the auxiliary libraries (libsharpening.so
) in the non-standard paths (/public/gstreamer_pipeline/lib/
).
(您告诉automake在构建过程中的 linking 步骤中在哪里寻找该库;这并不意味着 runtime链接器将具有相同的外观位置).
(You tell automake where to look for that library for the linking step in the build-process; this does not mean that the runtime linker will look at the same place).
有多种解决方法:
-
将库安装在运行时链接程序将查找它的位置,例如
/usr/local/lib/
(这是好方法)
- 通过将运行时链接程序添加到
/etc/ld.so.config
(或-如果您的系统支持-通过添加),将运行时链接程序配置为在非标准路径中永久查找库.到新文件/etc/ld.so.conf.d/gstreamer_pipeline.conf
)
- configure the runtime linker to permanently look for libraries in your non-standard paths, by adding it to
/etc/ld.so.config
(or - if your sytem supports it - by adding it to the new file/etc/ld.so.conf.d/gstreamer_pipeline.conf
)
通过 LD_LIBRARY_PATH
环境变量告诉运行时链接程序使用其他路径来解析库.
tell the runtime linker to use an additional path for library resolving, via the LD_LIBRARY_PATH
environmental variable.
例如
LD_LIBRARY_PATH=/public/gstreamer_pipeline/lib/ gst-launch-1.0 \
fakesrc ! sharpening ! fakesink
这篇关于使用自动工具在gstreamer插件中链接外部库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!