Ask Your Question

2.4.8 Build fails Mac OSX, opencl_kernels.hpp file not found

asked 2014-01-01 05:36:56 -0600

CAlbertson gravatar image

updated 2014-01-01 05:47:59 -0600

EDIT: The parent directory where I unpacked the .tar file has a space in the name. Someplace ??? in the build scripts there is a quoting error. likely some place is doing a "mkdir -p". I placed this is "Software Projects" and the 2.4.8 build process created a directory called "Software\ Projects" with an actually backslash in the filename.

This entire tree .../build/modules/ocl in empty except for the files open_kernals.cpp and .hpp This is a bug that I can work around by moving files but it should be fixed.

The message is "opencl_kernels.hpp file not found "

But I do see a file by this name. Here it is cut and pasted from the terminal window.

chris$ pwd /Volumes/LaCie/Chris/Software\ Projects/opencv-2.4.8/build/modules/ocl chris$ ls opencl_kernels.cpp opencl_kernels.hpp chris$

Here are the last few lines printed.

[ 63%] Generating opencl_kernels.cpp, opencl_kernels.hpp -- /Volumes/LaCie/Chris/Software\ Projects/opencv-2.4.8/build/modules/ocl/opencl_kernels.hpp contains same content [ 63%] Building CXX object modules/ocl/CMakeFiles/opencv_ocl.dir/src/arithm.cpp.o /Volumes/LaCie/Chris/Software Projects/opencv-2.4.8/modules/ocl/src/arithm.cpp:54:10: fatal error: 'opencl_kernels.hpp' file not found

include "opencl_kernels.hpp"


1 error generated. make[2]: * [modules/ocl/CMakeFiles/opencv_ocl.dir/src/arithm.cpp.o] Error 1 make[1]: [modules/ocl/CMakeFiles/opencv_ocl.dir/all] Error 2 make: ** [all] Error 2

edit retag flag offensive close merge delete


Hi. I have a similar problem on a Ubuntu 12.04 virtual machine. Did you find a solution? Thanks

nicoara gravatar imagenicoara ( 2014-01-02 14:55:32 -0600 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2014-05-13 23:19:17 -0600

Guy gravatar image


Same issue with MacOSX / OpenCV 2.4.9, check that you don't have any space in your opencv folder path, it solved the issue for me,


edit flag offensive delete link more


Exactly! Helped me a lot, thx!

henrylee2570 gravatar imagehenrylee2570 ( 2016-07-08 08:46:58 -0600 )edit

answered 2015-04-23 05:41:48 -0600

Download a stable version 2.4 of opencv, and follow the steps in this blog. All is fine

For some notes:

I have encountered the same issue. There is no good solution existing in web. So, I try by my own.

This article give me key idea. The folder 'ocl' in modules is needed but missing. Maybe it is a bug in 3.0 beta, or there are some build tips needed but I can not find. Anyway, I download a stable version 2.4 of opencv. Then, CMake to conigure, generate, then make. It works.

edit flag offensive delete link more

Question Tools


Asked: 2014-01-01 05:36:56 -0600

Seen: 3,503 times

Last updated: May 13 '14