I am trying to use a simple code to check for presence of OpenCL support in Fedora 21. "clinfo" on my system lists my CPU as supporting OpenCL specifications.
if (!cv::ocl::haveOpenCL())
{
cout << "OpenCL is not avaiable..." << endl;
return -1;
}
else
{
cout << "Hi1" << endl;
}
std::exit(-1);
The call to haveOpenCL() in the above code does not return. I checked and it seems that the problem occurs in the function call g_isOpenCLAvailable = ::clGetPlatformIDs(0, NULL, &n) == CL_SUCCESS;
in the source file ocl.cpp. I have provided the gdb backtrace below.
(gdb) bt #0 0x00007ffff33fadd3 in pthread_mutex_unlock () at /lib64/libpthread.so.0
#1 0x00007ffff7ded4c9 in tls_get_addr_tail () at /lib64/ld-linux-x86-64.so.2
#2 0x00007ffff2f3704c in __cxa_get_globals () at /lib64/libstdc++.so.6
#3 0x00007ffff2f38063 in __cxa_throw () at /lib64/libstdc++.so.6
#4 0x00007ffff41333ff in (anonymous namespace)::opencl_fn3<58, int, unsigned int, _cl_platform_id**, unsigned int*>::switch_fn(unsigned int, _cl_platform_id**, unsigned int*) () at /home/myopencv3build/lib/libopencv_core.so.3.0
#5 0x00007ffff414d096 in cv::ocl::haveOpenCL() () at /home/myopencv3build/lib/libopencv_core.so.3.0
#6 0x0000000000405096 in main(int, char**) (argc=3, argv=0x7fffffffdb78) at /home/mysources/bgsub.cpp:69
Any help in resolving this would be greatly appreciated.