From 49dfa5a17f00a82f0c160e20395c193b992d286e Mon Sep 17 00:00:00 2001 From: ahb Date: Mon, 13 Jan 2014 16:09:42 +0100 Subject: [PATCH] Fix the following error for ocl::getOpenCLPlatforms() on Ubuntu 12.04 with gcc 4.8 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 | 2 +- modules/ocl/src/cl_runtime/cl_runtime.cpp | 2 +- modules/ocl/src/cl_runtime/clamdblas_runtime.cpp | 2 +- modules/ocl/src/cl_runtime/clamdfft_runtime.cpp | 2 +- .../src/cl_runtime/generator/template/clamdblas_runtime.cpp.in | 2 +- .../src/cl_runtime/generator/template/clamdfft_runtime.cpp.in | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/3rdparty/include/opencl/1.2/CL/cl.hpp b/3rdparty/include/opencl/1.2/CL/cl.hpp index 0480e31163..2502d4c52c 100644 --- a/3rdparty/include/opencl/1.2/CL/cl.hpp +++ b/3rdparty/include/opencl/1.2/CL/cl.hpp @@ -210,7 +210,7 @@ #include #endif -#if defined(linux) || defined(__APPLE__) || defined(__MACOSX) +#if defined(__linux__) || defined(__APPLE__) || defined(__MACOSX) #include #include diff --git a/modules/ocl/src/cl_runtime/cl_runtime.cpp b/modules/ocl/src/cl_runtime/cl_runtime.cpp index a0d967c0b9..c3a31ccc33 100644 --- a/modules/ocl/src/cl_runtime/cl_runtime.cpp +++ b/modules/ocl/src/cl_runtime/cl_runtime.cpp @@ -45,7 +45,7 @@ #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name) #endif // _WIN32 -#if defined(linux) +#if defined(__linux__) #include #include diff --git a/modules/ocl/src/cl_runtime/clamdblas_runtime.cpp b/modules/ocl/src/cl_runtime/clamdblas_runtime.cpp index 0a077db691..1256000c8c 100644 --- a/modules/ocl/src/cl_runtime/clamdblas_runtime.cpp +++ b/modules/ocl/src/cl_runtime/clamdblas_runtime.cpp @@ -27,7 +27,7 @@ #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name) #endif // _WIN32 -#if defined(linux) +#if defined(__linux__) #include #include diff --git a/modules/ocl/src/cl_runtime/clamdfft_runtime.cpp b/modules/ocl/src/cl_runtime/clamdfft_runtime.cpp index 60cbecef2a..f0fa769b7d 100644 --- a/modules/ocl/src/cl_runtime/clamdfft_runtime.cpp +++ b/modules/ocl/src/cl_runtime/clamdfft_runtime.cpp @@ -27,7 +27,7 @@ #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name) #endif // _WIN32 -#if defined(linux) +#if defined(__linux__) #include #include diff --git a/modules/ocl/src/cl_runtime/generator/template/clamdblas_runtime.cpp.in b/modules/ocl/src/cl_runtime/generator/template/clamdblas_runtime.cpp.in index 8492edda9e..0cf33bb7ef 100644 --- a/modules/ocl/src/cl_runtime/generator/template/clamdblas_runtime.cpp.in +++ b/modules/ocl/src/cl_runtime/generator/template/clamdblas_runtime.cpp.in @@ -24,7 +24,7 @@ #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name) #endif // _WIN32 -#if defined(linux) +#if defined(__linux__) #include #include diff --git a/modules/ocl/src/cl_runtime/generator/template/clamdfft_runtime.cpp.in b/modules/ocl/src/cl_runtime/generator/template/clamdfft_runtime.cpp.in index aee6bd8ab6..8e8fb42c4f 100644 --- a/modules/ocl/src/cl_runtime/generator/template/clamdfft_runtime.cpp.in +++ b/modules/ocl/src/cl_runtime/generator/template/clamdfft_runtime.cpp.in @@ -24,7 +24,7 @@ #define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name) #endif // _WIN32 -#if defined(linux) +#if defined(__linux__) #include #include