简体   繁体   English

使用autotools链接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 ). 我在gstreamer插件编写指南( http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-boiler.html )中使用了样板模板refrenced编写了一个gstreamer插件。 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). 我首先构建了插件而没有完全实现链函数(基本上是一个空插件,它将数据从源传递到接收器而没有任何更改)。

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). 过滤使用外部锐化库(我已经在gstreamer之外成功使用)。 When building using autotools I get no errors, but when creating a pipeline using the new plugin, I get an undefined symbol error 当使用autotools构建时我没有错误,但是当使用新插件创建管道时,我得到一个未定义的符号错误

(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. 我无疑是autotools的新手,我相信我的问题在于那个过程中的某个地方,但我无法弄清楚在哪里。 The external sharpening library being used can be found here 可以在此处找到正在使用的外部锐化库

/public/gstreamer_pipeline/lib/libsharpening.so

I edited the plugin Makefile.am found in the src directory for my plugin 我在我的插件的src目录中编辑了插件Makefile.am

/public/gstreamer_pipeline/src/gst-sharpening/src

The contents of the edited Makefile.am are 编辑的Makefile.am的内容是

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

The output of running ldd on the new created plugin library (without modifying LD_LIBRARY_PATH) is 在新创建的插件库上运行ldd的输出(不修改LD_LIBRARY_PATH)是

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)

The configure.log output http://pastie.org/10450341 configure.log输出http://pastie.org/10450341

The output of make and make install http://pastie.org/10450352 make和make的输出安装http://pastie.org/10450352

Most likely the runtime linker/loader cannot find the auxiliary libraries ( libsharpening.so ) in the non-standard paths ( /public/gstreamer_pipeline/lib/ ). 很可能运行时链接程序/加载程序无法在非标准路径( /public/gstreamer_pipeline/lib/ )中找到辅助库( libsharpening.so )。

(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). (您告诉automake在构建过程中为链接步骤查找该库的位置;这并不意味着运行时链接程序将查看相同的位置)。

There are various ways to fix that: 有多种方法可以解决这个问题:

  • install the library in a place where the runtime linker will look for it, eg /usr/local/lib/ (that's the good way ) 将库安装在运行时链接器将查找的位置,例如/usr/local/lib/ (这是好方法

    • 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 ) 配置运行时链接程序以永久查找非标准路径中的库,方法是将其添加到/etc/ld.so.config (或者 - 如果您的系统支持它 - 通过将其添加到新文件/etc/ld.so.conf.d/gstreamer_pipeline.conf
  • tell the runtime linker to use an additional path for library resolving, via the LD_LIBRARY_PATH environmental variable. 通过LD_LIBRARY_PATH环境变量告诉运行时链接程序使用其他路径进行库解析。

eg 例如

LD_LIBRARY_PATH=/public/gstreamer_pipeline/lib/ gst-launch-1.0 \
          fakesrc ! sharpening ! fakesink

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM