Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

OpenCV 2.4.2 took 6 hours to compile on the Raspberry Pi and I'd love to package everything up as a deb but I have never done that before. How can I package the compiled files so that they download or include the necessary other libraries?

share|improve this question

migrated from raspberrypi.stackexchange.com Aug 22 '12 at 22:22

This question came from our site for users and developers of hardware and software for Raspberry Pi.

Is this more a Linux specific question rather than a Pi related one? Maybe better asking on Debain about it? – ppumkin Aug 22 '12 at 16:32
Hi there. Since this is generic Debian, would you mind if I moved this to Ask Ubuntu or Unix & Linux? – Jivings Aug 22 '12 at 17:15
@Jivings I think it is PI related since I don't know anything about hard float vs soft float and I know there are caveats with Pi regarding that. If there is a general consensus that someone there could help answer this question I have no problem with it being moved – onlinemarketresults Aug 22 '12 at 17:59
up vote 3 down vote accepted

If by OpenCV you mean the computer vision libraries at http://opencv.willowgarage.com/ then they are already packaged for debian by the Debian Science Team.

Your best bet is to download the debianised source package from your nearest debian mirror, modify the debian/rules and/or Makefile or configure etc as needed to compile correctly on the raspberry pi and rebuild the packages.

The packaging work is already done, there's no need to do it again....and again and again every time your want to update them.

There's a whole bunch of binary packages, but libopencv-dev is probably what you want to start with http://packages.debian.org/search?keywords=libopencv-dev

share|improve this answer
Will the published packages work on an ARM architecture like the Raspberry Pi? I wish I better understood packages and dependencies but it would seem to me that unless willowgarage released a package specifically for the processor in the Raspberry Pi then their packages will not work. – Dan B Aug 27 '12 at 14:03
You must have misread what I wrote. I said to download the debian SOURCE packages and recompile for Raspberry Pi. 'onlinemarketresults' already has a RPi compilation (or cross-compilation) environment set up and knows how to compile for RPi, he just wanted to know how to make a package. – cas Aug 27 '12 at 21:56

I thought I would add a better answer for anyone else observing this thread.

So, if you've already gone through the trouble of building opencv on the device, you've probably followed the instructions here:


In which case, if you don't add the -D args to dynamically override CMake parameters in step two and you instead just run cmake .. inside the build directory (you created), it will generate a CMakeCache.txt file.

If you edit the CMakeCache.txt file, you can change:


...in addition to the other specified variables in the above opencv link. Instead of running make or make install... just run make package and the magic happens.

Warning: If you have WITH_CUDA:BOOL=ON you may have dependency issues with the packager - and that's a totally different question...

For more info see the CPACK_*_*:BOOL parameters in the cmake files, and consult the CPack documentation:


share|improve this answer
This produces a couple of .deb files, a couple of tar files and a script. Which of these need to be distributed to and run on a target system? All? Do they need any supporting files? – Alex Mar 21 at 23:39
@Alex, forgot about this post last year. So, you should have OpenCV-*-{libs,dev}.deb You need both. I think dev has the headers ld uses to link against the .so in libs. You can also figure this out by running dpkg -c OpenCV-*.deb on the package, to list the contents. Also, if you created this from source.tar, you may not have a version number and dpkg -i $pkg will not like this. You can tell if it says OpenCV-unknown-*{dev,libs}.deb In which case git clone github.com/Itseez/opencv and git checkout $tag in the releases tab. If you build from top of tree, you also get tag on deb. – hhony Mar 23 at 16:42

This page should have all of the information and tutorials you need: http://wiki.debian.org/Packaging

share|improve this answer

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.