Compile Opencv with Mac os Snow Leopard 10.6

Today i try install OpenCv in my MacOs Snow Leopard 10.6 and have this error:

error: CPU you selected does not support x86-64 instruction set

The searching in google have the solution

go to opencv folder and edit configure file, searchi prescott and replace the line

DEFAULT_CXXFLAGS=”-g -march=prescott -ffast-math -fomit-frame-pointer $DEFAULT_CXXFLAGS”

with this:

DEFAULT_CXXFLAGS=”-g -march=i686 -m32 -ffast-math -fomit-frame-pointer $DEFAULT_CXXFLAGS”

But when i try to compile i have other error i now looking for how to resolve it

Now i can install opencv lib with macport!!!

1.- i have old macport then first i need clean and delete it.

port installed > myports.txt
 
sudo port clean installed
 
sudo port -f uninstall installed

2.- Install ports you need you can see myports.txt to know the old ports you have installed before clean.

3.- Patch the opencv port: see http://trac.macports.org/ticket/21014 and download the patch Portfile-sl_64bit_21014.diff

4.- Follow the instruction in post of patch

Check where you installed macports, that is usually /opt/local/ Locate the Portfile for OpenCV, for me that is at

/opt/local/var/macports/sources/rsync.macports.org/release/ports/graphics/opencv

now apply the third patch (Portfile-sl_64bit_21014.diff) by executing

sudo patch Portfile -i ~/Downloads/Portfile-sl_64bit_21014.diff

in the above directory (adjust the last path accordingly to your download location)

When you execute port variants opencv you should see the sl_64bit_21014 variant. Now install opencv with

sudo port install opencv +sl_64bit_21014

8 Comments to “Compile Opencv with Mac os Snow Leopard 10.6”

  1. Morton 20 September 2009 at 1:15 am #

    Note, however, that Quicktime and Carbon GUI support is not supported when installing like that (which for many users will be central features). Basically that means that there is no normally working OpenCV available under OS X 10.6 as of today. Cf. the discussions here:
    http://tech.groups.yahoo.com/group/OpenCV/message/65895
    http://trac.macports.org/ticket/21014

    There is a ticket filed at the OpenCV system at sourceforge, however, it is not even assigned yet.

    I am under the impression that due to some deeper changes in QT architecture in 10.6, this might take some time to be solved.

  2. damiles 21 September 2009 at 9:09 am #

    Thanks Morton for your comment, of course i run opencv with X11 and without quicktime. There are a lot of things to correct for totally support of opencv in mac os snow leopard.

    Regards. David.

  3. [...] Compile Opencv with Mac os Snow Leopard 10.6の記事からバッチファイルを取得 wget [...]

  4. Björn Giesler 4 October 2009 at 11:29 am #

    Hi, compiling with Quicktime and Carbon GUI support is not a problem if you build using Xcode instead of Unix Makefiles. See my blog for details.

  5. [...] Mac os Snow Leopard 10.6 October 29, 2009 lgustavomartins Leave a comment Go to comments Compile Opencv with Mac os Snow Leopard 10.6. Categories: Development, Mac Tags: compile, openCV, Snow Leopard Comments (0) Trackbacks [...]

  6. memmaker650 16 January 2010 at 9:48 pm #

    En castellano.
    Poseo un PowerMac G5y estoy empezando con esto del OpenCV. En vez de instalarlo desde el código fuente tienes la opción de instalar el framework que esta en esta dirección: http://vislab.cs.vt.edu/~vislab/wiki/images/4/44/OpenCV2.0.dmg
    SEgun he notado probando códigos. La única peculiaridad es que compilando desde Terminal hay que usar g++ y no gcc para que compile bien, aunque lo hagas sobre ficheros de c.
    La instalación del framework es trivial y supongo que su uso con Xcode será muy sencillo, no lo he probado porque estoy acostumbrado a compilar desde terminal.
    Comentar que para que compile hay que cambiar las cabeceras incluidas en los ficheros por #include .
    Por cierto, excelentes artículos y espero ansioso tu artículo sobre substracción del fondo de forma avanzada.

    P.D. También tengo un portatil con Snow Leopard, pero todavía no he instalado OpenCV, si tienes cualquier duda dimelo y lo pruebo.

  7. تقنيون 5 July 2010 at 8:57 pm #

    thanx

    viry nice

  8. Mehmed 28 July 2010 at 7:41 am #

    I read and comment on a blog with the aid of an interpreter so I apologize for the sloppy. I sincerely wish to continue to write articles in a similar vein, that was more valuable information for people.


Leave a Reply