NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.28k stars 14.26k forks source link

gst-launch-1.0 needs glib-networking for SSL/TLS support #72579

Open nschoe opened 5 years ago

nschoe commented 5 years ago

Describe the bug Gstreamer cannot support SSL/TLS URIs.

To Reproduce Steps to reproduce the behavior:

  1. Enter a nix-shell environment with the gstreamer plugins: nix-shell -p nix-shell -p gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good
  2. Try using a basic pipeline from gstreamer basic tutorial: gst-launch-1.0 playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm

Expected behavior It should open the video and play it.

Error reported I get this error:

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Got context from element 'source': gst.soup.session=context, session=(SoupSession)NULL, force=(boolean)false;
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source: Secure connection setup failed.
Additional debug info:
../ext/soup/gstsouphttpsrc.c(1379): gst_soup_http_src_parse_status (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstSoupHTTPSrc:source:
TLS/SSL support not available; install glib-networking (6), URL: https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm, Redirect to: (NULL)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

What I tried

  1. So I tried getting in a new shell with glib-networking and gnutls added, it doesn't change anything.
  2. I asked around on #gstreamer (IRC), but all I got was "you need a gnutls enabled glib-networking". So I took a look at glib-networking/default.nix, it already has gnutls as a dependency. By looking at the meson options on the github for glib-networking, I saw that the feature gnutls was set to auto, so I added -Dgnutls=enabled in the mesonFlags array, in glib-networking/default.nix and tried entering the shell again, but I keep getting the same error.
  3. Somebody on #nixos (IRC) told me about wrapGAppsHook, which I did not understand, but from a quick look at the nixos manual, I tried adding it to glib-networking's dependencies and added wrapGAppsHook in its nativeBuildInputs list but again, it did not make the slight difference.

So I don't understand what is going one nor what should be done.

Please note that I then tried to use the uninstalled version of gstreamer, build with gst-build. Everything builds okay and all, but I have the same problem. So I don't know what is wrong :/

For information, here is my shell.nix's buildInputs (for building and using the uninstalled gst-build):

buildInputs = [
                glib
                pkg-config
                flex
                cmake
                bison
                libsoup
                libnice
                gnutls
                openssl
                meson
                python35
                ninja
                openh264
                json-glib
                glib-networking
    ];

Not sure if this helps.

Metadata Please run nix run nixpkgs.nix-info -c nix-info -m and paste the result.

- system: `"x86_64-linux"`
 - host os: `Linux 4.19.79, NixOS, 19.03.173592.e758436f986 (Koi)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.2.2`
 - channels(nschoe): `""`
 - channels(root): `"nixos-19.03.173592.e758436f986, unstable-20.03pre196725.94500c93dc2"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

I don't know how much this is related, but I tried running centricular's gstreamer-based, webrtc example, it compiled okay, but when run, I get:

 ./webrtc-sendrecv --peer-id=2134
Connecting to server...
< HTTP/1.1 6 TLS/SSL support not available; install glib-networking
< Soup-Debug-Timestamp: 1572699994
< Soup-Debug: SoupMessage 0 (0x1add0c0)

The server did not accept the WebSocket handshake.

(webrtc-sendrecv:13589): GLib-CRITICAL **: 14:06:34.305: g_main_loop_unref: assertion 'loop != NULL' failed

So it seems to be that this is a problem with the networking part of the glib? Something like that?

Thanks for your time.

nschoe commented 5 years ago

Okay so I finally managed to make it work. I first looked for the glib-networking install dir with echo $buildInputs | grep --color=auto glib-networking. It gave me /nix/store/6r6b6p3c7hyvgidlnlyqa1zrvh9ajm9d-glib-networking-2.62.1.

Then I ran exported: export GIO_MODULE_DIR=/nix/store/6r6b6p3c7hyvgidlnlyqa1zrvh9ajm9d-glib-networking-2.62.1/lib/gio/modules/. From there everything works as it is supposed to be.

So... I have no idea how to port this to glib-networking/default.nix, but something must be done with GIO_MODULE_DIR.

worldofpeace commented 5 years ago

They mentioned wrapGAppsHook because if glib-networking was added to buildInputs it would have produced a script to export

GIO_EXTRA_MODULES=/nix/store/q96w3zn26siwl9nz9hq9nvhva6sp78q4-glib-networking-2.62.1/lib/gio/modules

So your issue would have been solved if gst-launch-1.0 was wrapped and that entry was added for glib-networking's gio module.

What we do in nixos, for applications that need glib-networking functionality but aren't wrapped, is set it in the global nixos environment https://github.com/NixOS/nixpkgs/blob/5f5bfce078257ba9a882aaccf0bd8ac3d0232e78/nixos/modules/services/desktops/gnome3/glib-networking.nix#L29

I'm not sure if we should add glib-networking into gstreamer and wrap the example programs, but that would be the solution to this issue. For any application that uses gstreamer and gilb-networking, they'll use wrapGAppsHook and the environment for which the program should run will be ensured correctly.

bb010g commented 5 years ago

This also is showing up for me on gnome3.gnome-boxes.

(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.627: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/ubuntu.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.627: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/ubuntu.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.754: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/debian.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.754: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/debian.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.755: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/opensuse.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.755: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/opensuse.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.958: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/silverblue.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.958: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/silverblue.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.960: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/fedora.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:18.960: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/fedora.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:19.040: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/redhat.svg': TLS/SSL support not available; install glib-networking
(gnome-boxes:10211): Boxes-WARNING **: 19:05:19.040: downloader.vala:212: Error loading logo file 'https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/redhat.svg': TLS/SSL support not available; install glib-networking
worldofpeace commented 5 years ago

@bb010g I will add glib-networking to gnome-boxes.

stale[bot] commented 4 years ago

Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on irc.freenode.net.
marius851000 commented 4 years ago

I'm trying to make a patch for libsoup to solve this. First, it seem that the compile time need of glib-networking is here only to check that it is present, and isn't used for compiling. It's GIO that depend on glib-networking. Will try to see if I can make a default path for it in gio.

marius851000 commented 4 years ago

A call to g_io_modules_scan_all_in_directory somewhere should allow to dynamically load glib-networking.

marius851000 commented 4 years ago

Well, too hard. will just add the wrapGApps and glib-networking to the necessery software.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info