簡體   English   中英

gstreamer 鏈接錯誤(使用 gstglfilter 時)

[英]gstreamer linking error (when using gstglfilter)

當我使用 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 安裝並驗證了存在一個使用以下代碼段定義這些符號的共享庫(星號表示強調):

% 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)

現在我收到以下 linker 錯誤:

/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}" 但是,這不會更改錯誤。

有任何想法嗎?

target_link_libraries(
  someproject
  PUBLIC
    "${OTHER_FIND_PACKAGE_LIBS}"
    gstopenglextras
    "${GST_LIBRARIES}"
    -lGL
    -lepoxy
    gstgl-1.0
    glib-2.0
    gmodule-2.0
)

是解決此問題所需的電話。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM