I am having trouble with the dlopen function in C++/Linux.
void * hsiftgpu = dlopen("/full/path/libsiftgpu.so", RTLD_LAZY);
I would assume that any errors that come out of dlerror() would tell me about not being able to find/open libsiftgpu.so. Here is the code where I check for errors:
if(hsiftgpu == NULL){
std::cout << "Could not load libsiftgpu.so" << '\n';
fprintf(stderr, "dlopen failed: %s\n", dlerror());
return 0;
}
Instead, it tells me this:
dlopen failed: libcudart.so.6.5: cannot open shared object file: No such file or directory
I'm not super familiar with file handling in Linux, so I could be missing something obvious. I'm wondering if I need to reset something before calling dlopen, or perhaps libsiftgpu.so is calling libcudart.so.6.5? Either way, this error message doesn't make much sense to me.
I have tried adding the path to the LD_LIBRARY_PATH (even though it's not recommend for security, I just wanted to see if it would work) and /etc/lib.conf.so/ I also checked to make sure that both the executable and the .so library are compiled in the same ELF-64 format.
I have run out of ideas of things to check, and I can't explain the error message. Any guidance or possible explanations are appreciated.
This turned out to be a case of the executable pointing to the 32-bit library when it should have pointed to the 64-bit library. I gave points to everyone who commented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With