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.
Describe the bug
cpp/build/libcuopt.sorecords the conda prefix before its own CPM_depsdirectories inDT_RPATH:When CPM fetches its own
rmm— which it does whenever the conda prefix has a different version —libcuoptis compiled against the fetched headers but resolveslibrmm.sofrom conda at load time.rmmencodes its version in an inline namespace, so the link succeeds anddlopenthen fails:DT_RPATHis searched beforeLD_LIBRARY_PATH, so no path variable fixes it. The only workarounds areLD_PRELOADor relinking.Steps/Code to reproduce bug
In a conda environment whose
rmmdiffers from the versioncpp/CMakeLists.txtpins:Expected behavior
A build-tree consumer should resolve the
rmmthatlibcuoptwas compiled against. The_depsdirectories should precede the conda prefix inRPATH, or the build should useRUNPATHsoLD_LIBRARY_PATHcan 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 ownC_API_TEST. It surfaced while adding the./build.sh javatarget in #1524, where it had to be worked around with aCUOPT_PRELOAD_LIBSescape hatch injava/cuopt/scripts/test.sh. That workaround can be removed once the ordering is fixed.The same reasoning applies to
librapids_logger.so.