Static build fails to load libnice elements

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Static build fails to load libnice elements

Aaron Clauson
I'm experimenting with non-static and static gstreamer builds using the gst-build on an Ubuntu docker image. In both cases I'm able to successfully build gstreamer and compile my basic application that's using a webrtcbin pipeline.

Note that static in this case is referring to the "Static build" description from the gst-build readme (https://gitlab.freedesktop.org/gstreamer/gst-build#static-build) rather than attempting to link my executable with actual static libraries.

For the non-static build my application is able to run the webrtcbin pipeline as expected. For static builds I get the warning below about libnice and the pipeline fails to launch (I definitely have libnice-dev installed and both docker images install an identical set of packages).

0:00:54.272738800    16 0x558ef5419c00 WARN               webrtcbin gstwebrtcbin.c:133:_have_nice_elements:<sendonly> error: libnice elements are not available

My understanding with the static build was that all the plugins are included in libgstreamer-full-1.0.so. The libnice symbols all seem to be in that library:

root@3600f52e3abd:/src/gst-webrtc-echo/builddir# nm /usr/local/lib/x86_64-linux-gnu/libgstreamer-full-1.0.so | grep nice
0000000000caaf60 t _gst_nice_thread
0000000000c95700 t _have_nice_elements
0000000000cb2310 t _nice_agent_stream_ids_get_type
0000000000cb22f0 t _nice_agent_stream_ids_get_type_once
...

The meson command I'm using to generate the static build is:

meson -Dgood=enabled -Dgst-plugins-good:vpx=enabled \
  -Dgst-plugins-good:rtpmanager=enabled \
  -Dbad=enabled -Dgst-plugins-bad:dtls=enabled \
  -Dbad=enabled -Dgst-plugins-bad:srtp=enabled \
  -Dbad=enabled -Dgst-plugins-bad:webrtc=enabled \
  --default-library=static \
  builddir

And the command I then use to build my application is:

gcc gst-webrtc-echo.c -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/local/include/gstreamer-1.0 -L/usr/local/lib -L/usr/local/lib/x86_64-linux-gnu -lgstreamer-full-1.0 -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgio-2.0 -lpthread -lm -ldl -lpcre -lffi -levent -lcjson

If anybody can spot anything I might be doing wrong any suggestions would be welcome.

Aaron








_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Static build fails to load libnice elements

Olivier Crête-3
Hi,

I'm pretty sure that the libnice elements don't get included in libgstreamer-full, you have to link them separately as they're not officially part of GStreamer.

Olivier

On Thu, 2021-03-04 at 22:42 +0000, Aaron Clauson wrote:
I'm experimenting with non-static and static gstreamer builds using the gst-build on an Ubuntu docker image. In both cases I'm able to successfully build gstreamer and compile my basic application that's using a webrtcbin pipeline.

Note that static in this case is referring to the "Static build" description from the gst-build readme (https://gitlab.freedesktop.org/gstreamer/gst-build#static-build) rather than attempting to link my executable with actual static libraries.

For the non-static build my application is able to run the webrtcbin pipeline as expected. For static builds I get the warning below about libnice and the pipeline fails to launch (I definitely have libnice-dev installed and both docker images install an identical set of packages).

0:00:54.272738800    16 0x558ef5419c00 WARN               webrtcbin gstwebrtcbin.c:133:_have_nice_elements:<sendonly> error: libnice elements are not available

My understanding with the static build was that all the plugins are included in libgstreamer-full-1.0.so. The libnice symbols all seem to be in that library:

root@3600f52e3abd:/src/gst-webrtc-echo/builddir# nm /usr/local/lib/x86_64-linux-gnu/libgstreamer-full-1.0.so | grep nice
0000000000caaf60 t _gst_nice_thread
0000000000c95700 t _have_nice_elements
0000000000cb2310 t _nice_agent_stream_ids_get_type
0000000000cb22f0 t _nice_agent_stream_ids_get_type_once
...

The meson command I'm using to generate the static build is:

meson -Dgood=enabled -Dgst-plugins-good:vpx=enabled \
  -Dgst-plugins-good:rtpmanager=enabled \
  -Dbad=enabled -Dgst-plugins-bad:dtls=enabled \
  -Dbad=enabled -Dgst-plugins-bad:srtp=enabled \
  -Dbad=enabled -Dgst-plugins-bad:webrtc=enabled \
  --default-library=static \
  builddir

And the command I then use to build my application is:

gcc gst-webrtc-echo.c -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/local/include/gstreamer-1.0 -L/usr/local/lib -L/usr/local/lib/x86_64-linux-gnu -lgstreamer-full-1.0 -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgio-2.0 -lpthread -lm -ldl -lpcre -lffi -levent -lcjson

If anybody can spot anything I might be doing wrong any suggestions would be welcome.

Aaron







_______________________________________________
gstreamer-devel mailing list

-- 
Olivier Crête


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Static build fails to load libnice elements

Aaron Clauson
In reply to this post by Aaron Clauson
> I'm pretty sure that the libnice elements don't get included in
libgstreamer-full, you have to link them separately as they're not
officially part of GStreamer.

Thanks,

But why would libnice be treated differently from any other plugin?

A quick comparison of the symbols in libnice.so and related symbols in libgstreamer-full-1.0.so does seem to show that at least some of the libnice symbols are being pulled in.

For example. From libnice.so:

000000000000b630 T nice_address_copy_to_sockaddr
000000000000b840 T nice_address_dup
000000000000b760 T nice_address_equal
000000000000b9f0 T nice_address_equal_no_port
...
0000000000037380 T stun_agent_build_unknown_attributes_error
00000000000360b0 T stun_agent_default_validater
0000000000036e90 T stun_agent_finish_message
0000000000036a80 T stun_agent_forget_transaction
0000000000036060 T stun_agent_init
...


0000000000cb1c40 t nice_address_copy_to_sockaddr
0000000000cb1e50 t nice_address_dup
0000000000cb1d70 t nice_address_equal
0000000000cb2010 t nice_address_equal_no_port
...
0000000000cde970 t stun_agent_build_unknown_attributes_error
0000000000cdd650 t stun_agent_default_validater
0000000000cdd4b0 t stun_agent_find_unknowns.isra.0
0000000000cde480 t stun_agent_finish_message
0000000000cde070 t stun_agent_forget_transaction
0000000000cdd600 t stun_agent_init
...


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Static build fails to load libnice elements

Olivier Crête-3
Hi,

Those symbols are from the library, not from the plugin. The simple reason the libnice plugin isn't included is that I think you need to do some meson magic inside the libnice build system to make it be included... and, with my libnice maintainer hat on, I have no idea what this is, so merge requests are welcome ;)

Olivier

On Thu, 2021-03-04 at 23:25 +0000, Aaron Clauson wrote:
> I'm pretty sure that the libnice elements don't get included in
libgstreamer-full, you have to link them separately as they're not
officially part of GStreamer.

Thanks,

But why would libnice be treated differently from any other plugin?

A quick comparison of the symbols in libnice.so and related symbols in libgstreamer-full-1.0.so does seem to show that at least some of the libnice symbols are being pulled in.

For example. From libnice.so:

000000000000b630 T nice_address_copy_to_sockaddr
000000000000b840 T nice_address_dup
000000000000b760 T nice_address_equal
000000000000b9f0 T nice_address_equal_no_port
...
0000000000037380 T stun_agent_build_unknown_attributes_error
00000000000360b0 T stun_agent_default_validater
0000000000036e90 T stun_agent_finish_message
0000000000036a80 T stun_agent_forget_transaction
0000000000036060 T stun_agent_init
...


0000000000cb1c40 t nice_address_copy_to_sockaddr
0000000000cb1e50 t nice_address_dup
0000000000cb1d70 t nice_address_equal
0000000000cb2010 t nice_address_equal_no_port
...
0000000000cde970 t stun_agent_build_unknown_attributes_error
0000000000cdd650 t stun_agent_default_validater
0000000000cdd4b0 t stun_agent_find_unknowns.isra.0
0000000000cde480 t stun_agent_finish_message
0000000000cde070 t stun_agent_forget_transaction
0000000000cdd600 t stun_agent_init
...

_______________________________________________
gstreamer-devel mailing list

-- 
Olivier Crête


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Static build fails to load libnice elements

Nicolas Dufresne-5
In reply to this post by Aaron Clauson
Le jeudi 04 mars 2021 à 23:25 +0000, Aaron Clauson a écrit :
> I'm pretty sure that the libnice elements don't get included in
libgstreamer-full, you have to link them separately as they're not
officially part of GStreamer.

Thanks,

But why would libnice be treated differently from any other plugin?

The creation of the gstreamer-full library is closely tied to GStreamer build system. The libnice plugin is not part of GStreamer project, but par of libnice project. I think there would be some values to try and figure-out a way, but for now, the build system is simply not aware of the existance of that plugin (nothing is hardcoded, it's all done through meson).


A quick comparison of the symbols in libnice.so and related symbols in libgstreamer-full-1.0.so does seem to show that at least some of the libnice symbols are being pulled in.

For example. From libnice.so:

000000000000b630 T nice_address_copy_to_sockaddr
000000000000b840 T nice_address_dup
000000000000b760 T nice_address_equal
000000000000b9f0 T nice_address_equal_no_port
...
0000000000037380 T stun_agent_build_unknown_attributes_error
00000000000360b0 T stun_agent_default_validater
0000000000036e90 T stun_agent_finish_message
0000000000036a80 T stun_agent_forget_transaction
0000000000036060 T stun_agent_init
...


0000000000cb1c40 t nice_address_copy_to_sockaddr
0000000000cb1e50 t nice_address_dup
0000000000cb1d70 t nice_address_equal
0000000000cb2010 t nice_address_equal_no_port
...
0000000000cde970 t stun_agent_build_unknown_attributes_error
0000000000cdd650 t stun_agent_default_validater
0000000000cdd4b0 t stun_agent_find_unknowns.isra.0
0000000000cde480 t stun_agent_finish_message
0000000000cde070 t stun_agent_forget_transaction
0000000000cdd600 t stun_agent_init
...

_______________________________________________
gstreamer-devel mailing list


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Static build fails to load libnice elements

Nicolas Dufresne-5
In reply to this post by Olivier Crête-3
Le jeudi 04 mars 2021 à 18:47 -0500, Olivier Crête a écrit :
Hi,

Those symbols are from the library, not from the plugin. The simple reason the libnice plugin isn't included is that I think you need to do some meson magic inside the libnice build system to make it be included... and, with my libnice maintainer hat on, I have no idea what this is, so merge requests are welcome ;)

Ah, it uses introspection, just like gst-env.py, just need to define a plugins array somewhere. Sent an MR.


commit c4c58f22917c2519f3d64ba67cb8fe993c31f9f3 (HEAD -> gst-env-fix, dev/gst-env-fix)
Author: Nicolas Dufresne <[hidden email]>
Date:   Thu Mar 4 21:18:47 2021 -0500

    gst: Fix gst-env and libgstreamer-full.so suppport
    
    gst-build uses meson introspection and reads the plugins array of each
    subproject in order to locate the plugins. Setting libnice plugins array allow
    enabling nice plugin in both gst-env.py and when building single library
    libgstreamer-full.so.

diff --git a/gst/meson.build b/gst/meson.build
index 091a37f..572c6ab 100644
--- a/gst/meson.build
+++ b/gst/meson.build
@@ -16,6 +16,7 @@ libgstnice = library('gstnice',
   link_with: libnice,
   install_dir: gst_plugins_install_dir,
   install: true)
+plugins = [libgstnice]
 
 # Generate pc files for static plugins if we build static plugins
 if get_option('default_library') != 'shared'
---

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Static build fails to load libnice elements

Aaron Clauson
In reply to this post by Aaron Clauson
> Ah, it uses introspection, just like gst-env.py, just need to define a plugins
> array somewhere. Sent an MR.
>
https://gitlab.freedesktop.org/libnice/libnice/-/merge_requests/190

Great, thanks a lot. That fixed my problem!

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel