Search code examples
cmakegstreamercross-compilingarm64pkg-config

Gstreamer -l flag error with cmake and pkg-config when cross compiling for arm64


I am using g-streamer with pkg-config on ubuntu 18. I am cross compiling for aarch64 and facing a following error.

/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so when searching for **-lgstreamer-1.0**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: cannot find -**lgstreamer-1.0**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libgobject-2.0.so when searching for **-lgobject-2.0**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libgobject-2.0.a when searching for **-lgobject-2.0**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libglib-2.0.so when searching for **-lglib-2.0**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libglib-2.0.a when searching for **-lglib-2.0**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so when searching for **-lm**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.a when searching for **-lm**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for **-lc**
/usr/lib/gcc-cross/aarch64-linux-gnu/7/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for **-lc**

I have installed pkg-config-aarch64 also and followed this thread but still I can't resolve the error. Following is my gst version: GStreamer Core Library version 1.14.5

Moreover, I have checked the .pc files and they are not available in aarch64 directory. I think I have to install gst for aarch64 but I don't know how can I do it on Ubuntu. The problem only happens when I am cross compiling with pkg-config.

I have installed pkg-config-aarch64 also and followed this thread but still i can't resolve the error.

CMake file chunk

find_package(PkgConfig REQUIRED)
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)

# Include directories
include_directories(
    ${GLIB_INCLUDE_DIRS}
    ${GSTREAMER_INCLUDE_DIRS}
)

#linking GStreamer library directory
link_directories(
        ${GLIB_LIBRARY_DIRS}
        ${GSTREAMER_LIBRARY_DIRS}
)

add_executable(yo_gst tutorial_2.cpp)

target_include_directories(yo_gst PUBLIC ${GSTREAMER_INCLUDE_DIRS})
target_link_libraries(yo_gst PUBLIC ${GSTREAMER_LIBRARIES})

.sh file chunk for cross compilation

export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH=/usr/bin/pkg-config:$PKG_CONFIG_PATH

Pkg-config

pkg-config --list-all |grep gstreamer
gstreamer-video-1.0            GStreamer Video Library - Video base classes and helper functions
gstreamer-riff-1.0             GStreamer RIFF Library - RIFF helper functions
gstreamer-1.0                  GStreamer - Streaming media framework
gstreamer-net-1.0              GStreamer networking library - Network-enabled GStreamer plug-ins and clocking
gstreamer-pbutils-1.0          GStreamer Base Utils Library - General utility functions
gstreamer-app-1.0              GStreamer Application Library - Helper functions and base classes for application integration
gstreamer-audio-1.0            GStreamer Audio library - Audio helper functions and base classes
gstreamer-tag-1.0              GStreamer Tag Library - Tag base classes and helper functions
gstreamer-plugins-base-1.0     GStreamer Base Plugins Libraries - Streaming media framework, base plugins libraries
gstreamer-allocators-1.0       GStreamer Allocators Library - Allocators implementation
gstreamer-rtsp-1.0             GStreamer RTSP Library - RTSP base classes and helper functions
gstreamer-check-1.0            GStreamer check unit testing - Unit testing helper library for GStreamer modules
gstreamer-base-1.0             GStreamer base classes - Base classes for GStreamer elements
gstreamer-fft-1.0              GStreamer FFT Library - FFT implementation
gstreamer-sdp-1.0              GStreamer SDP Library - SDP helper functions
gstreamer-rtp-1.0              GStreamer RTP Library - RTP base classes and helper functions
gstreamer-controller-1.0       GStreamer controller - Dynamic parameter control for GStreamer elements
gstreamer-gl-1.0               GStreamer OpenGL Plugins Libraries - Streaming media framework, OpenGL plugins libraries

Solution

  • Add arm64 architecture by following the link.

    1. Install following packages. sudo apt-get install libgstreamer1.0-dev:arm64 libgstreamer-plugins-base1.0-dev:arm64 libgstreamer-plugins-bad1.0-dev:arm64 gstreamer1.0-plugins-base:arm64 gstreamer1.0-plugins-good:arm64 gstreamer1.0-plugins-bad:arm64 gstreamer1.0-plugins-ugly:arm64 gstreamer1.0-libav:arm64 gstreamer1.0-tools:arm64 gstreamer1.0-x:arm64 gstreamer1.0-alsa:arm64 gstreamer1.0-gl:arm64 gstreamer1.0-gtk3:arm64 gstreamer1.0-qt5:arm64 gstreamer1.0-pulseaudio:arm64