【问题标题】:gstreamer linking error (when using gstglfilter)gstreamer 链接错误(使用 gstglfilter 时)
【发布时间】:2021-10-11 08:49:29
【问题描述】:

当我使用 CMake 构建我的 gstreamer 项目时,我使用以下 CmakeLists.txt:

cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 20)
include(FetchContent)

project(someproject)

find_package(PkgConfig REQUIRED)

pkg_check_modules(GST REQUIRED gstreamer-1.0>=1.4
        gstreamer-sdp-1.0>=1.4
        gstreamer-video-1.0>=1.4
        gstreamer-plugins-base-1.0>=1.4
        gstreamer-app-1.0>=1.4
        gstreamer-gl-1.0>=1.4)

#some other calls to find_package

add_library(someproject "")

#add source directories

target_include_directories(GUI_lib PUBLIC include "${OTHER_FIND_PACKAGE_INCLUDE_DIRS}"
        "${GST_INCLUDE_DIRS}")

target_link_libraries(someproject PUBLIC "${OTHER_FIND_PACKAGE_LIBS}" "${GST_LIBRARIES}"  -lGL -lepoxy)

这会导致以下错误:

in function `drawCallback(_GstElement*, unsigned int, unsigned int, unsigned int, void*)':
  undefined reference to `gst_gl_filter_get_type'
  undefined reference to `gst_gl_filter_draw_fullscreen_quad'

我搜索了我的 gstreamer 安装并验证存在一个使用以下 sn-p(星号表示强调)定义这些符号的共享库:

% readelf -s --wide /usr/lib/gstreamer-1.0/libgstopengl.so | rg gl_filter           
    121: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND gst_gl_filter_render_to_target_with_shader
*   242: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND gst_gl_filter_draw_fullscreen_quad
    305: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND gst_gl_filter_add_rgba_pad_templates
    421: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND gst_gl_filter_render_to_target
*   447: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND gst_gl_filter_get_type
    470: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND gst_gl_filter_filter_texture

所以,我在我的 CMake 文件中添加了以下内容:

add_library(gstopenglextras SHARED IMPORTED)
set_target_properties(gstopenglextras PROPERTIES
        IMPORTED_LOCATION "/usr/lib/gstreamer-1.0/libgstopengl.so")

我还将target_link_libraries 调用更改为:

target_link_libraries(someproject PUBLIC "${OTHER_FIND_PACKAGE_LIBS}" gstopenglextras "${GST_LIBRARIES}" -lGL -lepoxy)

现在我收到以下链接器错误:

/usr/bin/ld: undefined reference to symbol 'gst_gl_filter_get_type'
/usr/bin/ld: /usr/lib/libgstgl-1.0.so.0: error adding symbols: DSO missing from command line

我已经阅读了一些关于循环依赖的内容,并尝试在 gstopenglextras 之前添加 "${GST_LIBRARIES}"。但是,这不会改变错误。

有什么想法吗?

【问题讨论】:

    标签: cmake linker gstreamer linker-errors gstreamer-1.0


    【解决方案1】:
    target_link_libraries(
      someproject
      PUBLIC
        "${OTHER_FIND_PACKAGE_LIBS}"
        gstopenglextras
        "${GST_LIBRARIES}"
        -lGL
        -lepoxy
        gstgl-1.0
        glib-2.0
        gmodule-2.0
    )
    

    是您需要解决此问题的电话。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多