Dynamic CUDA support library name fixed. Additional error messages added.

pull/2049/head
Alexander Smorkalov 11 years ago
parent edce617a58
commit 4aa9f83100
  1. 13
      modules/core/src/gpumat.cpp

@ -93,6 +93,9 @@ static GpuFactoryType gpuFactory = NULL;
static DeviceInfoFactoryType deviceInfoFactory = NULL; static DeviceInfoFactoryType deviceInfoFactory = NULL;
# if defined(__linux__) || defined(__APPLE__) || defined (ANDROID) # if defined(__linux__) || defined(__APPLE__) || defined (ANDROID)
const std::string DYNAMIC_CUDA_LIB_NAME = "libopencv_dynamicuda.so";
# ifdef ANDROID # ifdef ANDROID
static const std::string getCudaSupportLibName() static const std::string getCudaSupportLibName()
{ {
@ -144,7 +147,7 @@ static const std::string getCudaSupportLibName()
LOGD("Libraries folder found: %s", pathBegin); LOGD("Libraries folder found: %s", pathBegin);
fclose(file); fclose(file);
return std::string(pathBegin) + "/libopencv_core_cuda.so"; return std::string(pathBegin) + DYNAMIC_CUDA_LIB_NAME;
} }
fclose(file); fclose(file);
LOGE("Could not find library path"); LOGE("Could not find library path");
@ -165,7 +168,7 @@ static const std::string getCudaSupportLibName()
# else # else
static const std::string getCudaSupportLibName() static const std::string getCudaSupportLibName()
{ {
return "libopencv_core_cuda.so"; return DYNAMIC_CUDA_LIB_NAME;
} }
# endif # endif
@ -173,13 +176,18 @@ static bool loadCudaSupportLib()
{ {
void* handle; void* handle;
const std::string name = getCudaSupportLibName(); const std::string name = getCudaSupportLibName();
dlerror();
handle = dlopen(name.c_str(), RTLD_LAZY); handle = dlopen(name.c_str(), RTLD_LAZY);
if (!handle) if (!handle)
{
LOGE("Cannot dlopen %s: %s", name.c_str(), dlerror());
return false; return false;
}
deviceInfoFactory = (DeviceInfoFactoryType)dlsym(handle, "deviceInfoFactory"); deviceInfoFactory = (DeviceInfoFactoryType)dlsym(handle, "deviceInfoFactory");
if (!deviceInfoFactory) if (!deviceInfoFactory)
{ {
LOGE("Cannot dlsym deviceInfoFactory: %s", dlerror());
dlclose(handle); dlclose(handle);
return false; return false;
} }
@ -187,6 +195,7 @@ static bool loadCudaSupportLib()
gpuFactory = (GpuFactoryType)dlsym(handle, "gpuFactory"); gpuFactory = (GpuFactoryType)dlsym(handle, "gpuFactory");
if (!gpuFactory) if (!gpuFactory)
{ {
LOGE("Cannot dlsym gpuFactory: %s", dlerror());
dlclose(handle); dlclose(handle);
return false; return false;
} }

Loading…
Cancel
Save