VLC does not build on Ubuntu 17.04. VLC builds successfully on Ubuntu 16.10.
$ make[...] GEN ../modules/plugins.dat/bin/bash: line 4: 18276 Segmentation fault (core dumped) ./vlc-cache-gen `realpath ../modules`Makefile:1631: recipe for target '../modules/plugins.dat' failed
(gdb) bt[#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0x00007eff447c6ba0 in ()[#1](https://code.videolan.org/videolan/vlc/-/issues/1) 0x00007eff64bd5fab in google::protobuf::ShutdownProtobufLibrary() () at /usr/lib/x86_64-linux-gnu/libprotobuf-lite.so.10[#2](https://code.videolan.org/videolan/vlc/-/issues/2) 0x00007eff654c4129 in () at /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3[#3](https://code.videolan.org/videolan/vlc/-/issues/3) 0x00007eff826534d9 in _dl_close_worker (map=map@entry=0x560394765830, force=force@entry=false) at dl-close.c:286[#4](https://code.videolan.org/videolan/vlc/-/issues/4) 0x00007eff826542ca in _dl_close_worker (force=false, map=0x560394765830) at dl-close.c:125[#5](https://code.videolan.org/videolan/vlc/-/issues/5) 0x00007eff826542ca in _dl_close (_map=0x560394765830) at dl-close.c:840[#6](https://code.videolan.org/videolan/vlc/-/issues/6) 0x00007eff8264d6c4 in _dl_catch_error (objname=0x5603946c9070, errstring=0x5603946c9078, mallocedp=0x5603946c9068, operate=0x7eff816eefb0 <dlclose_doit>, args=0x560394765830) at dl-error.c:187[#7](https://code.videolan.org/videolan/vlc/-/issues/7) 0x00007eff816ef581 in _dlerror_run (operate=operate@entry=0x7eff816eefb0 <dlclose_doit>, args=0x560394765830) at dlerror.c:163[#8](https://code.videolan.org/videolan/vlc/-/issues/8) 0x00007eff816eefdf in __dlclose (handle=<optimized out>) at dlclose.c:46[#9](https://code.videolan.org/videolan/vlc/-/issues/9) 0x00007eff81df8ac5 in module_Unload (handle=<optimized out>) at posix/plugin.c:86[#10](https://code.videolan.org/videolan/vlc/-/issues/10) 0x00007eff81d75b34 in module_Unmap (plugin=0x56039476f860) at modules/bank.c:464[#11](https://code.videolan.org/videolan/vlc/-/issues/11) 0x00007eff81d75b34 in module_EndBank (b_plugins=b_plugins@entry=true) at modules/bank.c:545[#12](https://code.videolan.org/videolan/vlc/-/issues/12) 0x00007eff81d5c991 in libvlc_InternalCleanup (p_libvlc=0x5603946c02d8) at libvlc.c:551[#13](https://code.videolan.org/videolan/vlc/-/issues/13) 0x00007eff82420ed7 in libvlc_release (p_instance=0x5603946c0180) at core.c:104[#14](https://code.videolan.org/videolan/vlc/-/issues/14) 0x0000560393b21ab1 in main (argc=<optimized out>, argv=0x7ffe70018a38) at cachegen.c:98
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
This is due to the mesa driver linking with libmir (or libmir-client, don't remember precisely), which in turns links to protobuf. mesa depending on libmir isn't the case on debian.
The crash can be reproduced with this sample https://hastebin.com/letonoxero.cpp (running it with full path to libmirclient.so as 1st parameter)
It's also what keeps our snapcraft build red.
That being said, I have no idea how to fix it properly. To my knowledge, it's not an issue of incompatible ABIs (for instance using protobuf-lite & protobuf in the same binary), but one might want to double check that statement.
Not a VLC bug per-se, but definitely an impediment. And since I can't really figure out the precise root cause, I'm not so keen on closing and leaving ubuntu users to their misery.
It might be worth it to contact the ubuntu packagers
(gdb) back[#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0x00007fff9377ebb0 in ()[#1](https://code.videolan.org/videolan/vlc/-/issues/1) 0x00007fffdf7bffab in google::protobuf::ShutdownProtobufLibrary() () at /usr/lib/x86_64-linux-gnu/libprotobuf-lite.so.10[#2](https://code.videolan.org/videolan/vlc/-/issues/2) 0x00007fffe00ae129 in () at /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3[#3](https://code.videolan.org/videolan/vlc/-/issues/3) 0x00007ffff7ded689 in _dl_close_worker (map=map@entry=0x5555557d14a0, force=force@entry=false) at dl-close.c:286[#4](https://code.videolan.org/videolan/vlc/-/issues/4) 0x00007ffff7dee47a in _dl_close_worker (force=false, map=0x5555557d14a0) at dl-close.c:125[#5](https://code.videolan.org/videolan/vlc/-/issues/5) 0x00007ffff7dee47a in _dl_close (_map=0x5555557d14a0) at dl-close.c:840[#6](https://code.videolan.org/videolan/vlc/-/issues/6) 0x00007ffff7de7874 in _dl_catch_error (objname=0x55555575fa70, errstring=0x55555575fa78, mallocedp=0x55555575fa68, operate=0x7ffff6e85fb0 <dlclose_doit>, args=0x5555557d14a0) at dl-error.c:187[#7](https://code.videolan.org/videolan/vlc/-/issues/7) 0x00007ffff6e86581 in _dlerror_run (operate=operate@entry=0x7ffff6e85fb0 <dlclose_doit>, args=0x5555557d14a0) at dlerror.c:163[#8](https://code.videolan.org/videolan/vlc/-/issues/8) 0x00007ffff6e85fdf in __dlclose (handle=<optimized out>) at dlclose.c:46[#9](https://code.videolan.org/videolan/vlc/-/issues/9) 0x00007ffff758f775 in module_Unload (handle=<optimized out>) at posix/plugin.c:86[#10](https://code.videolan.org/videolan/vlc/-/issues/10) 0x00007ffff750c854 in module_Unmap (plugin=0x5555557dc590) at modules/bank.c:557[#11](https://code.videolan.org/videolan/vlc/-/issues/11) 0x00007ffff750c854 in module_EndBank (b_plugins=b_plugins@entry=true) at modules/bank.c:643[#12](https://code.videolan.org/videolan/vlc/-/issues/12) 0x00007ffff74f37d1 in libvlc_InternalCleanup (p_libvlc=0x5555557572c0) at libvlc.c:427[#13](https://code.videolan.org/videolan/vlc/-/issues/13) 0x00007ffff7bb9ee7 in libvlc_release (p_instance=0x555555757160) at core.c:104[#14](https://code.videolan.org/videolan/vlc/-/issues/14) 0x0000555555554ab1 in main (argc=<optimized out>, argv=0x7fffffffe568) at cachegen.c:98(gdb) [#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0x00007fff9377ebb0 in ()[#1](https://code.videolan.org/videolan/vlc/-/issues/1) 0x00007fffdf7bffab in google::protobuf::ShutdownProtobufLibrary() () at /usr/lib/x86_64-linux-gnu/libprotobuf-lite.so.10[#2](https://code.videolan.org/videolan/vlc/-/issues/2) 0x00007fffe00ae129 in () at /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3[#3](https://code.videolan.org/videolan/vlc/-/issues/3) 0x00007ffff7ded689 in _dl_close_worker (map=map@entry=0x5555557d14a0, force=force@entry=false) at dl-close.c:286[#4](https://code.videolan.org/videolan/vlc/-/issues/4) 0x00007ffff7dee47a in _dl_close_worker (force=false, map=0x5555557d14a0) at dl-close.c:125[#5](https://code.videolan.org/videolan/vlc/-/issues/5) 0x00007ffff7dee47a in _dl_close (_map=0x5555557d14a0) at dl-close.c:840[#6](https://code.videolan.org/videolan/vlc/-/issues/6) 0x00007ffff7de7874 in _dl_catch_error (objname=0x55555575fa70, errstring=0x55555575fa78, mallocedp=0x55555575fa68, operate=0x7ffff6e85fb0 <dlclose_doit>, args=0x5555557d14a0) at dl-error.c:187[#7](https://code.videolan.org/videolan/vlc/-/issues/7) 0x00007ffff6e86581 in _dlerror_run (operate=operate@entry=0x7ffff6e85fb0 <dlclose_doit>, args=0x5555557d14a0) at dlerror.c:163[#8](https://code.videolan.org/videolan/vlc/-/issues/8) 0x00007ffff6e85fdf in __dlclose (handle=<optimized out>) at dlclose.c:46[#9](https://code.videolan.org/videolan/vlc/-/issues/9) 0x00007ffff758f775 in module_Unload (handle=<optimized out>) at posix/plugin.c:86[#10](https://code.videolan.org/videolan/vlc/-/issues/10) 0x00007ffff750c854 in module_Unmap (plugin=0x5555557dc590) at modules/bank.c:557[#11](https://code.videolan.org/videolan/vlc/-/issues/11) 0x00007ffff750c854 in module_EndBank (b_plugins=b_plugins@entry=true) at modules/bank.c:643[#12](https://code.videolan.org/videolan/vlc/-/issues/12) 0x00007ffff74f37d1 in libvlc_InternalCleanup (p_libvlc=0x5555557572c0) at libvlc.c:427[#13](https://code.videolan.org/videolan/vlc/-/issues/13) 0x00007ffff7bb9ee7 in libvlc_release (p_instance=0x555555757160) at core.c:104[#14](https://code.videolan.org/videolan/vlc/-/issues/14) 0x0000555555554ab1 in main (argc=<optimized out>, argv=0x7fffffffe568) at cachegen.c:98
At least one other module is depending on libmirclient: libegl_x11_plugin.so
As noted by LocutusOfBorg on IRC, disabling chromecast is enough.
Indeed, providing --disable-chromecast does the trick.
For the time being, a patch has been proposed to prevent the chromecast, and therefor the protobuf library, to be unloaded.
I was worried that we would be required to do so for all module implicitely (or not) linking to libmirclient would need to do so, but this isn't the case since libmir has a workaround applied that voluntarily leaks a handle to their shared object, preventing it to be unloaded:
http://bazaar.launchpad.net/~mir-team/mir/development-branch/revision/2701
I found the resolution for this segfault/crash - by using latest
protobuf v3.5.1(I built it from source using clang/LLVM and installed on my system)
instead of the default
protobuf v3.0.0
that's in Ubuntu 17.10 x86_64 repo. With that, I was able to build VLC 3.0.1 using clang/LLVM on my Ubuntu 17.10 x86_64.
I got the same reported stack-trace via gdb from the segfault via script setup only and not in isolation(this took time to figure out).
== Call stack during segfault/crash
(Stack trace when the above segfault/crash was happening - obtained via gdb session during the make-command itself as the crash happened only via make-command run but not in isolated run of exec...)
Program received signal SIGSEGV, Segmentation fault.0x00007fffc6887630 in ?? ()(gdb) bt[#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0x00007fffc6887630 in ()[#1](https://code.videolan.org/videolan/vlc/-/issues/1) 0x00007fffd1006dc3 in google::protobuf::ShutdownProtobufLibrary() () at /usr/lib/x86_64-linux-gnu/libprotobuf-lite.so.10[#2](https://code.videolan.org/videolan/vlc/-/issues/2) 0x00007fffd18fc0a9 in () at /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3[#3](https://code.videolan.org/videolan/vlc/-/issues/3) 0x00007ffff7deb7b9 in _dl_close_worker (map=map@entry=0x6df150, force=force@entry=false) at dl-close.c:286[#4](https://code.videolan.org/videolan/vlc/-/issues/4) 0x00007ffff7dec5aa in _dl_close_worker (force=false, map=0x6df150) at dl-close.c:125[#5](https://code.videolan.org/videolan/vlc/-/issues/5) 0x00007ffff7dec5aa in _dl_close (_map=0x6df150) at dl-close.c:840[#6](https://code.videolan.org/videolan/vlc/-/issues/6) 0x00007ffff792edb4 in _dl_catch_error () at /lib/x86_64-linux-gnu/libc.so.6[#7](https://code.videolan.org/videolan/vlc/-/issues/7) 0x00007ffff6b44759 in _dlerror_run (operate=operate@entry=0x7ffff6b440d0 <dlclose_doit>, args=0x6df150) at dlerror.c:163[#8](https://code.videolan.org/videolan/vlc/-/issues/8) 0x00007ffff6b440ff in __dlclose (handle=<optimized out>) at dlclose.c:46[#9](https://code.videolan.org/videolan/vlc/-/issues/9) 0x00007ffff751d7db in module_Unmap (plugin=<optimized out>) at modules/bank.c:557[#10](https://code.videolan.org/videolan/vlc/-/issues/10) 0x00007ffff751d7db in module_EndBank (b_plugins=<optimized out>) at modules/bank.c:643[#11](https://code.videolan.org/videolan/vlc/-/issues/11) 0x00007ffff7508667 in libvlc_InternalCleanup (p_libvlc=0x602db0) at libvlc.c:427[#12](https://code.videolan.org/videolan/vlc/-/issues/12) 0x00007ffff7bbed8f in libvlc_release (p_instance=0x602c50) at core.c:104[#13](https://code.videolan.org/videolan/vlc/-/issues/13) 0x00000000004009dd in main (argc=<optimized out>, argv=0x7fffffffdad8) at cachegen.c:98(gdb)
As the crashing code appeared to be within libprotobuf-lite library, I took the source code of protobuf to debug further and within it, from its github repo. This didn't change but instead there were some missing symbols(undefined references..) when linking the VLC. Then I went to the main github google protobuf repo/releases : https://github.com/google/protobuf/releases. From there took protobuf v3.5.1 source and built it using clang(itself and not gcc) and installed it to replace the earlier protobuf(from Ubuntu repo) and rebuilt VLC - I didn't see the segfault. In fact, the specific segfault issue was with dlclose() of libstream_out_chromecast_plugin.so - there appears to be race between the dlclose()/unloading and the destructors/cleanup code within libstream_out_chromecast_plugin.so which didn't work out with older version of protobuf but with protobuf v3.5.1. In fact, google::protobuf::ShutdownProtobufLibrary() mentions in its documentation that the caller should get a lock and guard the operation, etc. Anyway, either one can skip/disable chromecast plugin code before building VLC build or get the latest protobuf(v3.5.1 in my case) for the possible fixes therein. To arrive at the dlclose() point of crash within src/posix/plugin.c, I disabled all of the dlclose() to see if crash doesn't happen. There was no segfault. So, I started narrowing to down to the actual library for which dlclose() causes a crash - there I saw libstream_out_chromecast_plugin.so, disabled dlclose() only for that and debugged also within it. But, later on I decided to see if I upgrade protobuf to its latest available version, does the segfault vanish, and it worked. clang/VLC build completed successfully
along with the lib dependencies fixed(mesa, SDL, xcb, Xau, Xdmcp) mentioned in the configure command's environment variable list. So, this was one case of annoying crash whose root cause was hard to find for quite a long period of time, and finally I figured out the way to fix it.
Next, I am on the way to bring this clang-built VLC up on the Ubuntu 17.10 x86_64 to see its proper working as it would be the case with gcc-built VLC. Will share the details soon.
== Crash case when using protobuf 3.0.0
(from default/Ubuntu-repo, specifically, libprotobuf-lite.so.10.0.0)
#### proto(c|buf) version #####exp@exp:~$ exp@exp:~$ protoc --versionlibprotoc 3.0.0exp@exp:~$ exp@exp:~$ #### VLC make(with clang/LLVM) o/p -- last few lines showing crash happening around "vlc-cache-gen" #### CC vlc_static-override.o1 warning generated. CC cachegen.o CCLD vlc-wrapper CCLD vlc CCLD vlc-cache-gen CCLD vlc-static GEN ../modules/plugins.dat/bin/sh: line 4: 8775 Segmentation fault (core dumped) ./vlc-cache-gen `realpath ../modules`Makefile:1786: recipe for target '../modules/plugins.dat' failedmake[2]: *** [../modules/plugins.dat] Error 139make[2]: Leaving directory '.../vlc-clang/vlc-3.0.1/bin'Makefile:1530: recipe for target 'all-recursive' failedmake[1]: *** [all-recursive] Error 1make[1]: Leaving directory '.../vlc-clang/vlc-3.0.1'Makefile:1415: recipe for target 'all' failedmake: *** [all] Error 2
== Final successful clang/VLC build
(when using protobuf 3.5.1(specifically, libprotobuf-lite.so.15.0.1))
#### proto(c|buf) version #####exp@exp:~$ exp@exp:~$ protoc --versionlibprotoc 3.5.1exp@exp:~$ #### google::protobuf::ShutdownProtobufLibrary() within libprotobuf-lite.so was the place of crash ####exp@exp:~$ exp@exp:~$ nm /usr/local/lib/libprotobuf-lite.so.15.0.1 | grep ShutdownProtobufLibrary000000000001cb00 T _ZN6google8protobuf23ShutdownProtobufLibraryEvexp@exp:~$ #### VLC make(with clang/LLVM) o/p -- last few lines where crash used to happen around "vlc-cache-gen" #### . . . . setuid (uid); ^~~~~~ ~~~ CCLD vlc-cache-gen1 warning generated. CCLD vlc-wrapper CCLD vlc CCLD vlc-static GEN ../modules/plugins.datmake[2]: Leaving directory '.../vlc-clang/vlc-3.0.1/bin'Making all in testmake[2]: Entering directory '.../vlc-clang/vlc-3.0.1/test'make[2]: Nothing to be done for 'all'.make[2]: Leaving directory '.../vlc-clang/vlc-3.0.1/test'make[2]: Entering directory '.../vlc-clang/vlc-3.0.1' GEN cvlc GEN qvlc GEN rvlc GEN svlc GEN nvlc GEN vlcmake[2]: Leaving directory '.../vlc-clang/vlc-3.0.1'make[1]: Leaving directory '.../vlc-clang/vlc-3.0.1' . . . .
== Successful clang/VLC v3.0.1 build on Ubuntu 17.10 x86_64
exp@exp:~$ exp@exp:~$ lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 17.10Release: 17.10Codename: artfulexp@exp:~$ exp@exp:~$ exp@exp:~$ exp@exp:~$ eclang /usr/local/bin/vlc-clang | head -1++ strings -a /usr/local/bin/vlc-clang++ grep 'clang version'clang version 5.0.0-3 (tags/RELEASE_500/final)exp@exp:~$ exp@exp:~$exp@exp:~$ exp@exp:~$ /usr/local/bin/vlc-clang --versionVLC media player 3.0.1 Vetinari - Built from source using Clang/LLVM by Raghavan Santhanam on Ubuntu 17.10 x86_64 - With Qt5.10.1 (revision 3.0.1-0-gec0f700fcc)VLC version 3.0.1 Vetinari - Built from source using Clang/LLVM by Raghavan Santhanam on Ubuntu 17.10 x86_64 - With Qt5.10.1 (3.0.1-0-gec0f700fcc)
there was in artful, a bug in gnutls-bin, preventing it from working correctly (during the build the binary was segfaulting).
I fixed this in bionic, by re-enabling chromecast, even if I can't know if it works or not, because I lack the hardware.
Since with bionic we will have chromecast enabled, can you please do the testing with that upcoming release and see if it is still an issue?
In case it is, we can backport a fix from new protobuf if we can isolate it, because I don't think updating protobuf at this point is possible due to regressions risk (and Debian didn't update yet too)
If I have time for that, I will get it a try and see if the issue still persists in the Debian repo and/or next Ubuntu release's repo. This project of mine was more of an independent research for me to see how clang/LLVM and VLC get along - it took quite a lot of time and effort to get this far.