Question about static build GStreamer library still uses GLib2 dynamically

Bo-Kai Huang lightbulb01 at gmail.com
Sat May 7 07:15:19 UTC 2022


Hi all,

I want to have my application run on different hosts, and these hosts may
not have GStreamer packages installed. My idea is to build a static
GStreamer library, and load the static library when my application starts.

I use the source code of 1.20.2 from GitLab, and the following are my
build commands:
> meson --buildtype=release \
            --strip \
             --wrap-mode=forcefallback \
             -Dauto_features=disabled \
              -Dbad=enabled \
              -Dgst-plugins-base:videotestsrc=enabled \
              -Dgst-plugins-good:autodetect=enabled \
              --default-library=static \
              -Dintrospection=disabled \
              build
> ninja -C build

I can get the static library libgstreamer-full-1.0.so in the build folder,
and I create a symbolic link of libgstreamer-1.0.so to it.
Then I update $LD_LIBRARY_PATH on my Linux environment and run a Java
example to load the GStreamer library.
This is the Java example I used:
https://github.com/gstreamer-java/gst1-java-examples/blob/master/BasicPipeline/src/main/java/org/freedesktop/gstreamer/examples/BasicPipeline.java

I expect that the library has its dependencies linked statically, but the
application fails and I find the following messages:
INFO: Trying libgstreamer-1.0.so
May 07, 2022 6:30:45 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Found library 'gstreamer-1.0' at libgstreamer-1.0.so
May 07, 2022 6:30:45 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying /usr/lib64/libglib-2.0.so.0.5600.1
May 07, 2022 6:30:45 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Found library 'glib-2.0' at /usr/lib64/libglib-2.0.so.0.5600.1
May 07, 2022 6:30:45 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying /usr/lib64/libgobject-2.0.so.0.5600.1
May 07, 2022 6:30:45 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Found library 'gobject-2.0' at /usr/lib64/libgobject-2.0.so.0.5600.1

(gst1-java-core:31071): GLib-CRITICAL **: 06:30:45.770:
g_datalist_id_set_data_full: assertion 'key_id > 0' failed
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f1bd8d8abdb, pid=31071, tid=0x00007f1c38bee700

The application still uses the GLib and GObject on the System.
Would anyone help to guide me on the correct way to build and use the
static GStreamer library for the Java example?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220507/a543ce62/attachment.htm>


More information about the gstreamer-devel mailing list