fltk-rs / demos

Repo containing demo apps using the fltk crate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libvlc demo segfaults

jlgerber opened this issue · comments

First, than yous for the tutorials and the rust crate.

I am quite happy to see how well FLTK works with Rust in general. I thought that FLTK was dead after the Foundry ported Nuke to Qt. I haven't used it since the early 2000s...

I was particularly excited to take a look at combining Fltk and Vlc. Unfortuantely, I have run into some trouble. (not sure how this is working for anyone)

Running this on pop os 20.10 (basically latest version of ubuntu) I get the following error after pushing play:

 Compiling vlc-fltk v0.1.0 (/home/jgerber/src/3ps/fltk/demos/fltk-rs-demos/libvlc)
    Finished dev [unoptimized + debuginfo] target(s) in 0.70s
     Running `/home/jgerber/src/3ps/fltk/demos/fltk-rs-demos/target/debug/vlc-fltk`
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f447c004740] egl_x11 gl error: Xlib not initialized for threads
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f447c004740] glx gl error: Xlib not initialized for threads
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f447c004740] egl_x11 gl error: Xlib not initialized for threads
[00007f447c011700] main filter error: Failed to create video converter
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f447c004740] glx gl error: Xlib not initialized for threads
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f447c004740] egl_x11 gl error: Xlib not initialized for threads
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f448c079c90] vdpau_avcodec generic error: Xlib not initialized for threads
[00007f448c079c90] vdpau_avcodec generic error: Xlib is required for VDPAU
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f447c004740] egl_x11 gl error: Xlib not initialized for threads
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f447c004740] glx gl error: Xlib not initialized for threads
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.
[00007f447c004740] egl_x11 gl error: Xlib not initialized for threads
Segmentation fault (core dumped)
``

when i build the app, here is what is getting linked against:

linux-vdso.so.1 (0x00007ffdae4dc000)
libvlc.so.5 => /lib/x86_64-linux-gnu/libvlc.so.5 (0x00007f8433b92000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f84339b1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f843398f000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f8433851000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f843383c000)
libXinerama.so.1 => /lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007f8433837000)
libXcursor.so.1 => /lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007f8433828000)
libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f843361e000)
libXfixes.so.3 => /lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f8433616000)
libXft.so.2 => /lib/x86_64-linux-gnu/libXft.so.2 (0x00007f84335fd000)
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f84335b6000)
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f843352e000)
libGLU.so.1 => /lib/x86_64-linux-gnu/libGLU.so.1 (0x00007f84334ba000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f84334b4000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8433499000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f84332af000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8433d34000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8433160000)
libvlccore.so.9 => /lib/x86_64-linux-gnu/libvlccore.so.9 (0x00007f8433050000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f8433024000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f8432f61000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f8432f33000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f8432f2a000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f8432e72000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f8432e3c000)
libidn.so.11 => /lib/x86_64-linux-gnu/libidn.so.11 (0x00007f8432e07000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f8432db5000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f8432daf000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f8432da7000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f8432d6c000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8432d4f000)
libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007f8432d41000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f8432c8d000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f8432c73000)
libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007f8432c4e000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8432c43000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8432c1a000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f8432b4a000)
liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f8432b29000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f8432a0b000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f84329e2000)

Any ideas?

Fixed it by adding x11 dependency and calling

use x11::xlib;
...
fn main() {
unsafe { xlib::XinitThreads();};
let app = ...
}

Hi
Thank you for your nice words.
I'm glad it's fixed.

Could it be the version of libvlc-dev?
The version I have libvlc-dev is 3.0.8. Or some incompatibility with an xlib version.

I had this same issue, but I added args.push("--no-xlib".to_string()); in my code.
here is my cargo:

fltk = "1.1.2"
vlc-rs = { git = "https://github.com/garkimasera/vlc-rs.git" }

I get whatever version git pulls in, which should be the same as you (last update was 2 years ago)