locaal-ai/obs-backgroundremoval

[ISSUE] Building on Debian 10.10 works, but links against non existant glibc symbol `__libc_single_threaded`?

Closed this issue · 2 comments

The problem

Building on Debian 10.10, either with gcc-8.3.0 or clang-13.0.1 ends up with successful build, but OBS itself will not load the plugin saying it tries to use an undefined symbol __libc_single_threaded.

To Reproduce

With GCC (native way):

  1. Clone the repository
  2. Edit cmake/linux/compilerconfig.cmake
  3. Add -fPIC on top of set(_obs_gcc_c_options list
  4. Remove -Wenum-conversion from the same list
  5. Run cmake -S . -B "build"
  6. Run cmake --build build
  7. Run cmake --install build --prefix "/usr/local"
  8. Run obs via terminal

With clang (more tricky):

  1. Clone the repository
  2. Edit cmake/linux/compilerconfig.cmake
  3. Add -fPIC on top of set(_obs_gcc_c_options list
  4. Remove the entire codeblock starting with if(CMAKE_COMPILE_WARNING_AS_ERROR) upto endif()
  5. Run export CC=/usr/bin/clang
  6. Run export CXX=/usr/bin/clang++
  7. Run cmake -S . -B "build"
  8. Edit build/src/update-checker/CurlClient/CMakeFiles/CurlClient.dir/flags.make
  9. Add -fPIC at the beginning of CXX_FLAGS
  10. Edit build/CMakeFiles/plugin-support.dir/flags.make
  11. Add -fPIC at the beginning of C_FLAGS
  12. Run cmake --build build
  13. Run cmake --install build --prefix "/usr/local"
  14. Run obs via terminal

When trying to run OBS, you will notice:

 error: os_dlopen(/usr/local//lib/obs-plugins/obs-backgroundremoval.so->/usr/local//lib/obs-plugins/obs-backgroundremoval.so): /usr/local//lib/obs-plugins/obs-backgroundremoval.so: undefined symbol: __libc_single_threaded

warning: Module '/usr/local//lib/obs-plugins/obs-backgroundremoval.so' not loaded

If you check for existence of that symbol in this file, indeed it is there:

nm -a /usr/local/lib/obs-plugins/obs-backgroundremoval.so|c++filt|grep single
                 U __libc_single_threaded

...which makes it even more strange, as according to https://gcc.gnu.org/pipermail/libstdc++-cvs/2020q3/034683.html
that symbol was introduced in glibc-2.32. Debian 10.10 (Deepin) sports glibc-2.28:

# ldd --version ldd|head -1
ldd (Debian GLIBC 2.28.21-1+deepin-1) 2.28

...so how the heck did it manage to link against it while using this symbol in the first place?

Also I noticed the official binary release of the plugin links against glibc-2.29 making it again useless in Debian 10.10.

(edit) Also, if this could be of any help:

$ cmake --version
cmake version 3.22.1

$ obs --version
OBS Studio - 29.1.3-modified

(OBS is self compiled, fully working)

Big question is

How do I build this plugin while making sure it WILL NOT USE the __libc_single_threaded symbol?

Thanks!

We don't support Debian and our plugin does not work with OBS 29 now. I'd like you to update your Debian and OBS to the latest release and try to build our plugin again!
Thank you for reporting!

We don't support Debian

That is a SHAME.

I'd like you to update your Debian and OBS to the latest release and try to build our plugin again!
Very sadly, that's not an option on this machine. Not anywhat soon anyway.

I will continue experimenting in that field and maybe write a custom Debian build tutorial once I manage to get it working.

Thanks!