[BUG] Build-tree libcuopt.so resolves librmm from the conda prefix instead of its own _deps, failing at dlopen
@hlinsen is already working on this.
Since Aug 12, 2026.
- Dominant language
- Cuda
- Stars
- 1k
- Forks
- 233
- Avg merge
- 4d 4h
- Merged PRs (30d)
- 95
Description
Describe the bug
cpp/build/libcuopt.so records the conda prefix before its own CPM _deps directories in DT_RPATH:
RPATH /path/to/conda/envs/cuopt/lib:$ORIGIN:/path/to/cpp/build/_deps/rmm-build:/path/to/cpp/build/_deps/rapids_logger-build:
When CPM fetches its own rmm — which it does whenever the conda prefix has a different version — libcuopt is compiled against the fetched headers but resolves librmm.so from conda at load time. rmm encodes its version in an inline namespace, so the link succeeds and dlopen then fails:
undefined symbol: _ZTIN3rmm10_RMM_26_109bad_allocE
DT_RPATH is searched before LD_LIBRARY_PATH, so no path variable fixes it. The only workarounds are LD_PRELOAD or relinking.
Steps/Code to reproduce bug
In a conda environment whose rmm differs from the version cpp/CMakeLists.txt pins:
./build.sh libcuopt
./cpp/build/tests/linear_programming/C_API_TEST
# -> symbol lookup error: .../libcuopt.so: undefined symbol: _ZTIN3rmm10_RMM_26_109bad_allocE
# works only with an explicit preload:
LD_PRELOAD=$PWD/cpp/build/_deps/rmm-build/librmm.so ./cpp/build/tests/linear_programming/C_API_TEST
Expected behavior
A build-tree consumer should resolve the rmm that libcuopt was compiled against. The _deps directories should precede the conda prefix in RPATH, or the build should use RUNPATH so LD_LIBRARY_PATH can win.
Environment overview
Local source build from main, conda environment, Linux x86_64.
Additional context
This is not Java-specific — it affects anything loading the build-tree libcuopt.so, including cuOpt's own C_API_TEST. It surfaced while adding the ./build.sh java target in #1524, where it had to be worked around with a CUOPT_PRELOAD_LIBS escape hatch in java/cuopt/scripts/test.sh. That workaround can be removed once the ordering is fixed.
The same reasoning applies to librapids_logger.so.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.