Compiling OpenCV Source Code for 64 bit (Mac)
===

I'm having some problems while trying to compile 64 bit OpenCV libraries. This is what I've done so far:

 1. Got the source code using svn
 2. In the `opencv` I have `mkdir build' then `cd build`
 3. `cmake -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=x86_64 -D CMAKE_C_FLAGS=-m64 -D CMAKE_CXX_FLAGS=-m64 ..`

This then leaves me with the output (below), which worries me because a number of packages are not found. I have tried disabling the `WITH_CUDA` flag as suggest in this post http://stackoverflow.com/questions/10342682/building-emgucv-on-osx-snow-leopard but it doesn't seem to help.

    -- Extracting svn version, please wait...
    -- SVNVERSION:  svn:9029
    -- checking for module 'libdc1394-2'
    --   package 'libdc1394-2' not found
    -- checking for module 'libdc1394'
    --   package 'libdc1394' not found
    -- checking for module 'libavcodec'
    --   package 'libavcodec' not found
    -- checking for module 'libavformat'
    --   package 'libavformat' not found
    -- checking for module 'libavutil'
    --   package 'libavutil' not found
    -- checking for module 'libswscale'
    --   package 'libswscale' not found
    -- Looking for libavformat/avformat.h
    -- Looking for libavformat/avformat.h - not found
    -- Looking for ffmpeg/avformat.h
    -- Looking for ffmpeg/avformat.h - not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named sphinx
    -- 
    -- General configuration for OpenCV 2.4.9 =====================================
    -- Version control:                 svn:9029
    -- 
    --   Platform:
    --     Host:                        Darwin 11.4.0 i386
    --     CMake:                       2.8.8
    --     CMake generator:             Unix Makefiles
    --     CMake build tool:            /usr/bin/make
    --     Configuration:               Release
    -- 
    --   C/C++:
    --     Built as dynamic libs?:      YES
    --     C++ Compiler:                /usr/bin/c++
    --     C++ flags (Release):         -m64   -O3 -DNDEBUG 
    --     C++ flags (Debug):           -m64   -g 
    --     C Compiler:                  /usr/bin/gcc
    --     C flags (Release):           -m64   -O3 -DNDEBUG 
    --     C flags (Debug):             -m64   -g 
    --     Linker flags (Release):      
    --     Linker flags (Debug):        
    --     Precompiled headers:         NO
    -- 
    --   OpenCV modules:
    --     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree legacy gpu photo python stitching ts videostab
    --     Disabled:                    world
    --     Disabled by dependency:      -
    --     Unavailable:                 androidcamera java
    -- 
    --   GUI: 
    --     QT 4.x:                      NO
    --     Cocoa:                       YES
    --     OpenGL support:              NO
    -- 
    --   Media I/O: 
    --     ZLib:                        build (ver 1.2.6)
    --     JPEG:                        build (ver 62)
    --     PNG:                         build (ver 1.5.9)
    --     TIFF:                        build (ver 42 - 4.0.1)
    --     JPEG 2000:                   build (ver 1.900.1)
    --     OpenEXR:                     NO
    -- 
    --   Video I/O:
    --     DC1394 1.x:                  NO
    --     DC1394 2.x:                  NO
    --     FFMPEG:                      NO
    --       codec:                     NO
    --       format:                    NO
    --       util:                      NO
    --       swscale:                   NO
    --       gentoo-style:              NO
    --     OpenNI:                      NO
    --     OpenNI PrimeSensor Modules:  NO
    --     PvAPI:                       NO
    --     QuickTime:                   NO
    --     QTKit:                       YES
    -- 
    --   Other third-party libraries:
    --     Use IPP:                     NO
    --     Use TBB:                     NO
    --     Use Cuda:                    NO
    --     Use Eigen:                   NO
    --     Use Clp:                     NO
    -- 
    --   Python:
    --     Interpreter:                 /usr/bin/python (ver 2.7.1)
    --     Libraries:                   /usr/lib/libpython2.7.dylib (ver 2.7.1)
    --     numpy:                       /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include (ver 1.5.1)
    --     packages path:               lib/python2.7/site-packages
    -- 
    --   Documentation:
    --     Build Documentation:         NO
    --     Sphinx:                      NO
    --     PdfLaTeX compiler:           /usr/texbin/pdflatex
    -- 
    --   Tests and samples:
    --     Tests:                       YES
    --     Performance tests:           YES
    --     Examples:                    NO
    -- 
    --   Install path:                  /usr/local
    -- 
    --   cvconfig.h is in:              /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/build
    -- -----------------------------------------------------------------
    -- 
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/build


If I then try `make -j8` I get something that starts off like this and goes on fo a while:

    [  0%] [  0%] [  0%] [  1%] [  1%] [  1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/adler32.c.o
    Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/compress.c.o
    Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/crc32.c.o
    Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngerror.c.o
    Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/png.c.o
    Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/deflate.c.o
    [  1%] [  1%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_cm.c.o
    Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcapimin.c.o
    In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngerror.c:19:
    /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngpriv.h:45:20: error: stdlib.h: No such file or directory
    In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngpriv.h:127,
                     from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngerror.c:19:
    /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.h:442:26: error: setjmp.h: No such file or directory
    /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.h:450:24: error: time.h: No such file or directory
    In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.c:14:
    /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngpriv.h:45:20: error: stdlib.h: No such file or directory
    In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/pngpriv.h:127,
                     from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.c:14:
    /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.h:442:26: error: setjmp.h: No such file or directory
    /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/libpng/png.h:450:24: error: time.h: No such file or directory
    In file included from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/zlib/zlib.h:34,
                     from /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/3rdparty/zlib/compress.c:9:
    /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/myOpencv/trunk/opencv/build/3rdparty/zlib/zconf.h:403:48: error: sys/types.h: No such file or directory
    