A cleaned up version of my compile command looks like gcc -o semantic_seg -Wl,-rpath,... -l:libnvrtc-5e8a26c9.so.10.1 ...
and I have a dynamic library file named exactly libnvrtc-5e8a26c9.so.10.1
in the directory specified by the -rpath
flag. The command succeeds.
When I go to run my program, it says semantic_seg: error while loading shared libraries: libnvrtc.so.10.1: cannot open shared object file: No such file or directory
and when I do ldd
it shows libnvrtc.so.10.1 => not found
.
So the problem looks like the name of the shared library in the executable is not the same as the filename. Could that be true? Did the 5e8a26c9
part of the name somehow get stripped off?
Update: Creating a symbolic link libnvrtc-5e8a26c9.so.10.1 -> libnvrtc.so.10.1
allows the executable to run. But I'm still not sure the mechanism that causes this name modification to happen. It seems a bit magic.