Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I am trying to install Open CV on Raspbian by following these steps:


Everything works up until I do a "make". It gets up to 61% and then I get the following error:

[61% built target opencv_perf_gpu]

[61% building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_core.cpp.o]

c++: internal compiler error: Killed (program cclplus)

Please submit a full bug report,

with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

make[2]: *** [modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_core.cpp.o] Error 4

make[1]: *** [modules/gpu/CMakeFiles/opencv_test_gpu.dir/all] Error 2

make: *** [all] Error 2

I'm running 2012-08-16-wheezy-raspbian image, expanded to 8gigs.

The website I am following is installing an older version of Open CV [2.3.1] on a Debian img.

Do you think this is the problem? Is it worth perusing to fix this problem or should I simply revert to a older version of Open CV and use debian instead?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

Your error message says that you have got internal compiler error. This means there is a bug in compiler that prevents this code from being build. It happens sometimes, especially on less supported architectures like armv6. There are couple of things you can do to try to work around this:

  • use newer version of compiler. Default version in Debian 6 is GCC-4.6 but GCC-4.7 is also available. It's easy to install, just type sudo apt-get install gcc-4.7. Installing is only one step, however. Now you have to make opencv build system (which is cmake) use it. You can try this using environment variables by prefixing cmake with: CC=gcc-4.7 CXX=g++-4.7. So it would be cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ... Or you can do this in cmake-gui. Either way, start from the beginning, remove the folders you where compiling in and create fresh new one.

  • Install older version of opencv as it seems that this was working for somebody who wrote this tutorial. This is worth a shot if changing gcc version does not help. Unless you really need features from newer version.

  • Play with g++ compiler options. Especially with optimization levels (-O option). Sometimes turning optimizations off (-O0) solves problems with internal compiler errors. I can't give you any hints on how to do this, unfortunately. You could have to mess around with cmake build system or Makefile that it creates.

share|improve this answer
right now i'm going with your 2nd bullet point of reverting to open cv 2.3.1 and rebuilding everything. If this doesn't work then i'll go with gcc-4.7. after installing gcc-4.7, how exactly do I set up those environment variables you are talking about? CC=gcc-4.7 and CXX=g++-4.7? –  user1068636 Sep 16 '12 at 16:04
You either use export CC=gcc-4.7 and export CXX=g++-4.7 commands or just type CC=gcc-4.7 CXX=g++-4.7 cmake THE REST OF THE COMMAND –  Krzysztof Adamski Sep 16 '12 at 16:22
Well, I got it to work with OpenCV 2.3.1 on Raspbian Wheezy. I was able to successfully run the 3 demos "kmeans", "drawing", and "convexhull". Thanks for your help! –  user1068636 Sep 17 '12 at 1:15
add comment

I'm reasonably sure you've run out of memory. You should cross compile OpenCV using your PC.

share|improve this answer
I googled the error message and saw that conclusion. But what doesn't make sense to me is how come the other fellow was able to install open cv 2.3.1 on his debian image (he even shows youtube video)? –  user1068636 Sep 16 '12 at 16:06
I'm also reading through this page: bootc.net/archives/2012/05/26/… and wondering if I end up doing this, how would this work with Open CV? Do I use my toolchain to create all the binaries for Open CV and simply copy them into my raspberry pi somewhere? How does this work? –  user1068636 Sep 16 '12 at 16:19
@user1068636: Which memory split are you using? Do you have SWAP enabled? I believe if it was problem with not enough memory, you could find traces of OOM killer in your dmesg log. –  Krzysztof Adamski Sep 16 '12 at 16:20
@Krzysztof - How can you tell what kind of split you're using or if I have swap enabled? –  user1068636 Sep 17 '12 at 1:17
@user1068636: One way is to check how much available memory you have with free -m. Look for total value in Mem: row. If you don't know anything about memory split, you probably have 192MB which is default (free command will show slightly less). You could also have 128, 224 or 240. The more RAM you have, the less RAM is allocated for GPU. You can also check if your swap is enabled using the same command, just look for 'Swap:' row. If it's non-zero, you have swap enabled. –  Krzysztof Adamski Sep 17 '12 at 5:34
add comment

I had the same problem. Solution was get a new Raspberry. The old one had only 256MB memory. When I tested on the 512M version on a fresh raspbian image everything compiled ok, (6-7 hours)

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.