1

i have installed opencv with brew and everything is magically ok. now i want to try to recompile by myself with cuda support.

for this i have to download opencv, change a line in CMakeList.txt (because i have already installed cuds 5 and cuda toolkit), run cmake, run make, run make install. Exactly what brew has done.

I am scared to do some mess with brew and blabla and going end up to have 2 different version of opencv and brew not happy.

I just compile opencv with pkg-config --cflags --libs opencv so pkg-config is the only thing i care about.

What is the best way to do it without mess everything up?

1
  • 1
    The reason to use other packaging systems rather than brew is that they leave /usr/local for this sort of thing - It might be easiest to use one of these e.g. macports, fink ratherthan brew if you are going totry your own builds
    – mmmmmm
    Apr 19 '13 at 14:28
1

You can pass the CMAKE_INSTALL_PREFIX option to cmake to have OpenCV install to a different location. It's analagous to ./configure --prefix. For example:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/opt/reallylocal -D WITH_CUDA ..

This will install it under /opt/reallylocal, leaving /usr/local untouched. Then, to run your custom build, call it with the full path, or put the appropriate directories on your PATH and PYTHONPATH variables when working with it. If you build other projects against your opencv, you'll need to point their build scripts at your custom install location. Leave those paths alone when doing brew tasks and other work, and brew won't care about your other install off to the side.

The OpenCV Install Guide has full details.

I tested this on my OS X 10.8.3 box. /usr stayed clean.

[✘ @ in ~/tmp/homebrew/opencv/install]
$ find /usr > before-install.txt
find: /usr/sbin/authserver: Permission denied
... did the whole build & install in another terminal ...
[✘ @ in ~/tmp/homebrew/opencv/install]
$ find /usr > after-install.txt
find: /usr/sbin/authserver: Permission denied
[✘ @ in ~/tmp/homebrew/opencv/install]
$ diff before-install.txt after-install.txt
[@ in ~/tmp/homebrew/opencv/install]
$
1
  • which compiler are using? c++ with llvm backend? which version?
    – nkint
    May 15 '13 at 8:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .