RTLD_GLOBAL causes symbol conflicts with other libraries
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
Decord uses `ctypes.RTLD_GLOBAL` when loading `libdecord.so`, which exports all symbols (including FFmpeg/libav) into the global namespace. This causes symbol conflicts with other libraries that use similar dependencies, leading to crashes.
## Minimal Reproduction
```python
import decord
import wgpu
adapter = wgpu.gpu.request_adapter_sync()
```
```
Segmentation fault (core dumped)
```
**Expected behavior:**
Both libraries work together without crashes.
## Root Cause
The issue is in `python/decord/_ffi/base.py:39`:
```python
def _load_lib():
"""Load libary by searching possible path."""
lib_path = libinfo.find_lib_path()
os.environ['PATH'] += os.pathsep + os.path.dirname(lib_path[0])
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL) # <---
# DMatrix functions
lib.DECORDGetLastError.restype = ctypes.c_char_p
return lib, os.path.basename(lib_path[0])
```
## Additional Context
- **Platform:** Linux
- **Python:** 3.13
- **Decord:** Latest from pip
- **Other library tested:** wgpu
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.