srt: Crash when buliding OBS Studio with ffmpeg linked against libsrt

I rebuilt the OBS studio flatpak using the flathub project from https://github.com/flathub/com.obsproject.Studio and adding srt to the build and building ffmpeg with “–enable-libsrt”, then when I try to run it, I get a crash with the following backtrace with git master of srt as of today:

#0  std::operator+<char, std::char_traits<char>, std::allocator<char> > (__lhs=0x7ffff4785099 ": ", __rhs=...)
   at /usr/include/c++/8.2.0/bits/basic_string.tcc:1164
#1  0x00007ffff4765cca in logging::Logger::Logger (this=0x7ffff604ab10 <blog>, functional_area=1, config=..., globprefix=...)
   at /usr/include/c++/8.2.0/bits/basic_string.h:390
#2  0x00007ffff4738fb4 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535)
   at /usr/include/c++/8.2.0/ext/new_allocator.h:79
#3  _GLOBAL__sub_I_core.cpp(void) () at /run/build/libsrt/srtcore/core.cpp:8704
 ``

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 55 (3 by maintainers)

Most upvoted comments

Global variables are evil indeed, although C++ has means to avoid problems like this. Simply global variables shall either be a static field in a class, or put under some namespace. Even if there happens to be a namespace collision, these will be already C++ symbols and shall undergo strong linkage, so the linkers shall usually find this problem. If this is a symbol in a global namespace and only one such symbol undergoes strong linkage, the linker won’t be able to detect the problem.

Ok, now you may also try to run nm on the whole bundle after building and linking and see, which library provides the blog symbol. You can use an “nm on steroids”, nma.tcl from my repo: gitlab.com/posix-tools/posix-tools.

Just to confirm that this was the root cause.

@ethouris will do