Fix the following error for ocl::getOpenCLPlatforms() on Ubuntu 12.04 with gcc 4.8
authorahb <andreas.bihlmaier@gmx.de>
Mon, 13 Jan 2014 15:09:42 +0000 (16:09 +0100)
committerahb <andreas.bihlmaier@gmx.de>
Mon, 13 Jan 2014 15:09:42 +0000 (16:09 +0100)
OpenCV Error: Unknown error code -6 (OpenCL function is not available: [clGetPlatformIDs]) in opencl_check_fn, file /home/ahb/software/opencv/modules/ocl/src/cl_runtime/cl_runtime.cpp, line 83

The issue results from modules/ocl/src/cl_runtime/cl_runtime.cpp checking for
"linux" instead of "__linux__" (cp.  http://sourceforge.net/p/predef/wiki/OperatingSystems/)

Adjust all other occurrences of "defined(linux)" as well.

3rdparty/include/opencl/1.2/CL/cl.hpp
modules/ocl/src/cl_runtime/cl_runtime.cpp
modules/ocl/src/cl_runtime/clamdblas_runtime.cpp
modules/ocl/src/cl_runtime/clamdfft_runtime.cpp
modules/ocl/src/cl_runtime/generator/template/clamdblas_runtime.cpp.in
modules/ocl/src/cl_runtime/generator/template/clamdfft_runtime.cpp.in

index 0480e31..2502d4c 100644 (file)
 #include <string>
 #endif 
 
-#if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
+#if defined(__linux__) || defined(__APPLE__) || defined(__MACOSX)
 #include <alloca.h>
 
 #include <emmintrin.h>
index a0d967c..c3a31cc 100644 (file)
@@ -45,7 +45,7 @@
     #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
 #endif // _WIN32
 
-#if defined(linux)
+#if defined(__linux__)
     #include <dlfcn.h>
     #include <stdio.h>
 
index 0a077db..1256000 100644 (file)
@@ -27,7 +27,7 @@
     #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
 #endif // _WIN32
 
-#if defined(linux)
+#if defined(__linux__)
     #include <dlfcn.h>
     #include <stdio.h>
 
index 60cbece..f0fa769 100644 (file)
@@ -27,7 +27,7 @@
     #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
 #endif // _WIN32
 
-#if defined(linux)
+#if defined(__linux__)
     #include <dlfcn.h>
     #include <stdio.h>
 
index 8492edd..0cf33bb 100644 (file)
@@ -24,7 +24,7 @@
     #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
 #endif // _WIN32
 
-#if defined(linux)
+#if defined(__linux__)
     #include <dlfcn.h>
     #include <stdio.h>
 
index aee6bd8..8e8fb42 100644 (file)
@@ -24,7 +24,7 @@
     #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
 #endif // _WIN32
 
-#if defined(linux)
+#if defined(__linux__)
     #include <dlfcn.h>
     #include <stdio.h>