Shared object "libdl.so.2" not found, required by "libnvidia-encode.so.1" : where to find the correct version of libdl.so.2 ?

Hello.

When I try to run obs I get this error message :

Code:
error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): 
Shared object "libdl.so.2" not found, required by "libnvidia-encode.so.1"

Is there a method to know where should be stored and which version should be the library that libdl.so.2 hyperlink should point to as asked by "libnvidia-encode.so.1" ?

libdl.so.2 is a pointer that should point to a library like one of these :

Code:
libdl-2.17.so
libdl-2.31.so
libdl-2.32.so

For example if it points to : libdl-2.31.so I get the following error :

Code:
error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): /usr/local/lib/libc.so.6: 
version GLIBC_ABI_DT_RELR required by /usr/local/lib/libdl.so.2 not found

If it points to : libdl-2.17.so I get the following error :

Code:
error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): /usr/local/lib/libdl.so.2: 
unsupported file layout

If it points to : libdl-2.32.so I get the following error :

Code:
error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): /usr/local/lib/libc.so.6: 
version GLIBC_ABI_DT_RELR required by /usr/local/lib/libm.so.6 not found

Creating an hyperlink called "libm.so.6" which points to library libm-2.32.so :

Code:
ln -s libm-2.32.so libm.so.6

I get the following error :

Code:
error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): /usr/local/lib/libc.so.6: 
No space available for static Thread Local Storage

unfortunately none of those works. So now I'm very curios to understand what it really wants.
 
1. there's no libdl in FreeBSD, dlopen(3) and friends are part of FreeBSD's libc.
2. FreeBSD's libc is at ABI version 7 (libc.so.7) and certainly doesn't have any GLIBC_* symbol versions.
3. The Linuxulator's glibc (libc.so.6) certainly isn't installed in /usr/local/lib.

So, all in all, WTF is this all about?
 
Its obs (installed from the packages) which wants to load the Linux libraries to take advantage of the nvidia driver and of the CUDA libraries :

Code:
[marietto@marietto /usr/local/lib]$ obs

debug: Attempted path: share/obs/obs-studio/locale/en-US.ini
debug: Attempted path: /usr/local/share/obs/obs-studio/locale/en-US.ini
debug: Attempted path: share/obs/obs-studio/locale.ini
debug: Attempted path: /usr/local/share/obs/obs-studio/locale.ini
debug: Attempted path: share/obs/obs-studio/themes/Yami.qss
debug: Attempted path: /usr/local/share/obs/obs-studio/themes/Yami.qss
info: Using EGL/X11
info: CPU Name: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
info: CPU Speed: 3600.00MHz
info: Physical Cores: 8, Logical Cores: 16
info: Physical Memory: 31734MB Total, 3619MB Free
info: Kernel Version: FreeBSD 14.0-RELEASE-p3
info: Distribution: FreeBSD "14.0"
info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.21.1
info: Qt Version: 6.6.1 (runtime), 6.6.1 (compiled)
info: Portable mode: false
info: OBS 30.0.2 (freebsd)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
        samples per sec: 48000
        speakers:        2
        max buffering:   960 milliseconds
        buffering type:  dynamically increasing
info: ---------------------------------
info: Initializing OpenGL...
info: Loading up OpenGL on adapter NVIDIA Corporation NVIDIA GeForce GTX 1060 3GB/PCIe/SSE2
info: OpenGL loaded successfully, version 3.3.0 NVIDIA 535.104.05, shading language 3.30 NVIDIA via Cg compiler
info: ---------------------------------
info: video settings reset:
        base resolution:   1920x1080
        output resolution: 1280x720
        downscale filter:  Bicubic
        fps:               30/1
        format:            NV12
        YUV mode:          Rec. 709/Partial
info: NV12 texture support not available
info: P010 texture support not available
info: Audio monitoring device:
        name: Default
        id: default
info: ---------------------------------
info: [pipewire] No captures available
warning: v4l2loopback not installed, virtual camera disabled

error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): /usr/local/lib/libc.so.6: 
No space available for static Thread Local Storage

info: FFmpeg VAAPI H264 encoding not supported
info: FFmpeg VAAPI HEVC encoding not supported
info: [obs-websocket] [obs_module_load] you can haz websockets (Version: 5.0.1 | RPC Version: 1)
info: [obs-websocket] [obs_module_load] Qt version (compile-time): 6.6.1 | Qt version (run-time): 6.6.1
info: [obs-websocket] [obs_module_load] Linked ASIO Version: 101201
info: [obs-websocket] [obs_module_load] Module loaded.
info: [vlc-video]: VLC 3.0.20 Vetinari found, VLC video source enabled
info: ---------------------------------
info:   Loaded Modules:
info:     vlc-video.so
info:     text-freetype2.so
info:     sndio.so
info:     rtmp-services.so
info:     oss-audio.so
info:     obs-x264.so
info:     obs-websocket.so
info:     obs-webrtc.so
info:     obs-transitions.so
info:     obs-outputs.so
info:     obs-filters.so
info:     obs-ffmpeg.so
info:     linux-v4l2.so
info:     linux-pulseaudio.so
info:     linux-pipewire.so
info:     linux-jack.so
info:     linux-capture.so
info:     image-source.so
info:     frontend-tools.so
info: ---------------------------------
info: ==== Startup complete ===============================================
info: All scene data cleared
info: ------------------------------------------------
info: pulse-input: Server name: 'pulseaudio 16.1'
info: pulse-input: Audio format: s16le, 44100 Hz, 2 channels
info: pulse-input: Started recording from 'oss_output.dsp7.monitor' (default)
info: [Loaded global audio device]: 'Desktop Audio'
info: pulse-input: Server name: 'pulseaudio 16.1'
info: pulse-input: Audio format: s16le, 44100 Hz, 2 channels
info: pulse-input: Started recording from 'oss_input.dsp7' (default)
info: [Loaded global audio device]: 'Mic/Aux'
info: Switched to scene 'Scene'
info: ------------------------------------------------
info: Loaded scenes:
info: - scene 'Scene':
info: ------------------------------------------------
info: adding 21 milliseconds of audio buffering, total audio buffering is now 21 milliseconds (source: Desktop Audio)

info: ==== Shutting down ==================================================
info: pulse-input: Stopped recording from 'oss_output.dsp7.monitor'
info: pulse-input: Got 116 packets with 118784 frames
info: pulse-input: Stopped recording from 'oss_input.dsp7'
info: pulse-input: Got 113 packets with 115712 frames
info: All scene data cleared
info: ------------------------------------------------
info: [obs-websocket] [obs_module_unload] Shutting down...
error: Tried to call obs_frontend_remove_event_callback with no callbacks!
error: Tried to call obs_frontend_get_global_config with no callbacks!
error: [obs-websocket] [Config::Save] Unable to fetch OBS config!
info: [obs-websocket] [obs_module_unload] Finished shutting down.
info: [Scripting] Total detached callbacks: 0
info: Freeing OBS context data
info: == Profiler Results =============================
info: run_program_init: 726.266 ms
info:  ┣OBSApp::AppInit: 3.285 ms
info:  ┃ ┗OBSApp::InitLocale: 0.843 ms
info:  ┗OBSApp::OBSInit: 683.695 ms
info:    ┣obs_startup: 1.395 ms
info:    ┗OBSBasic::OBSInit: 631.781 ms
info:      ┣OBSBasic::InitBasicConfig: 0.084 ms
info:      ┣OBSBasic::ResetAudio: 0.182 ms
info:      ┣OBSBasic::ResetVideo: 120.548 ms
info:      ┃ ┗obs_init_graphics: 120.282 ms
info:      ┃   ┗shader compilation: 23.107 ms
info:      ┣OBSBasic::InitOBSCallbacks: 0.006 ms
info:      ┣OBSBasic::InitHotkeys: 0.018 ms
info:      ┣obs_load_all_modules2: 407.658 ms
info:      ┃ ┣obs_init_module(frontend-tools.so): 30.045 ms
info:      ┃ ┣obs_init_module(image-source.so): 0.009 ms
info:      ┃ ┣obs_init_module(linux-capture.so): 0.372 ms
info:      ┃ ┣obs_init_module(linux-jack.so): 0.004 ms
info:      ┃ ┣obs_init_module(linux-pipewire.so): 4.305 ms
info:      ┃ ┣obs_init_module(linux-pulseaudio.so): 0.004 ms
info:      ┃ ┣obs_init_module(linux-v4l2.so): 0.882 ms
info:      ┃ ┣obs_init_module(obs-ffmpeg.so): 0.685 ms
info:      ┃ ┃ ┗nvenc_check: 0.45 ms
info:      ┃ ┣obs_init_module(obs-filters.so): 0.027 ms
info:      ┃ ┣obs_init_module(obs-outputs.so): 0.007 ms
info:      ┃ ┣obs_init_module(obs-transitions.so): 0.009 ms
info:      ┃ ┣obs_init_module(obs-webrtc.so): 0.033 ms
info:      ┃ ┣obs_init_module(obs-websocket.so): 4.909 ms
info:      ┃ ┣obs_init_module(obs-x264.so): 0.003 ms
info:      ┃ ┣obs_init_module(oss-audio.so): 0.01 ms
info:      ┃ ┣obs_init_module(rtmp-services.so): 0.976 ms
info:      ┃ ┣obs_init_module(sndio.so): 0.004 ms
info:      ┃ ┣obs_init_module(text-freetype2.so): 0.041 ms
info:      ┃ ┗obs_init_module(vlc-video.so): 0.69 ms
info:      ┣OBSBasic::InitService: 0.772 ms
info:      ┣OBSBasic::ResetOutputs: 0.521 ms
info:      ┣OBSBasic::CreateHotkeys: 0.028 ms
info:      ┣OBSBasic::InitPrimitives: 0.093 ms
info:      ┗OBSBasic::Load: 63.34 ms
info: obs_hotkey_thread(25 ms): min=0.03 ms, median=0.17 ms, max=13.691 ms, 99th percentile=10.004 m
s, 100% below 25 ms
info: audio_thread(Audio): min=0.005 ms, median=0.065 ms, max=0.156 ms, 99th percentile=0.153 ms
info: obs_graphics_thread(33.3333 ms): min=0.053 ms, median=0.961 ms, max=19.403 ms, 99th percentile
=19.403 ms, 100% below 33.333 ms
info:  ┣tick_sources: min=0 ms, median=0.009 ms, max=0.108 ms, 99th percentile=0.108 ms
info:  ┣output_frame: min=0.031 ms, median=0.194 ms, max=2.413 ms, 99th percentile=2.413 ms
info:  ┃ ┗gs_context(video->graphics): min=0.03 ms, median=0.193 ms, max=2.41 ms, 99th percentile=2.
41 ms
info:  ┃   ┣render_video: min=0.018 ms, median=0.118 ms, max=2.377 ms, 99th percentile=2.377 ms
info:  ┃   ┃ ┗render_main_texture: min=0.012 ms, median=0.092 ms, max=2.351 ms, 99th percentile=2.35
1 ms
info:  ┃   ┗gs_flush: min=0.003 ms, median=0.017 ms, max=1.992 ms, 99th percentile=1.992 ms
info:  ┗render_displays: min=0.008 ms, median=0.593 ms, max=19.184 ms, 99th percentile=19.184 ms
info: =================================================
info: == Profiler Time Between Calls ==================
info: obs_hotkey_thread(25 ms): min=25.036 ms, median=25.189 ms, max=56.548 ms, 90% within ±2% of 25
 ms (0% lower, 10% higher)
info: obs_graphics_thread(33.3333 ms): min=0.103 ms, median=33.374 ms, max=69.333 ms, 64.2105% withi
n ±2% of 33.333 ms (17.8947% lower, 17.8947% higher)
info: =================================================
info: Number of memory leaks: 0
 
follow the guide on this post first


obs command line

env LD_LIBMAP="`nv-sglrun printenv LD_LIBMAP | grep -v libGL`" obs

obs desktop entry

Code:
[Desktop Entry]
Version=1.0
Name=OBS
GenericName=Streaming/Recording Software
Comment=Free and Open Source Streaming/Recording Software
Exec=sh -c 'LD_LIBMAP="`nv-sglrun printenv LD_LIBMAP | grep -v libGL`" obs'
Icon=com.obsproject.Studio
Terminal=false
Type=Application
Categories=AudioVideo;Recorder;
StartupNotify=true
StartupWMClass=obs
 
Until now I wasn't aware such a hack exists.
Once upon a time there was a port named www/linuxpluginwrapper, which is still referenced in the examples section of libmap.conf(5). So, the idea is not all new, just the implementation is.

There are, of course, quite a few limitations. For example, I wanted to use the shim for Widevine, but the recent versions of libwidevinecdm.so were found to directly invoke Linux syscalls bypassing libc, so now there is a yet another wrapper specifically for it.
 
Back
Top