Skip to content

Instantly share code, notes, and snippets.

@vfdev-5
Last active September 3, 2019 19:23
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vfdev-5/b2135401dec10d80dbfbf99e3aab15ab to your computer and use it in GitHub Desktop.
Save vfdev-5/b2135401dec10d80dbfbf99e3aab15ab to your computer and use it in GitHub Desktop.

HOW TO INSTALL pjreddie/DARKNET ON OSX

Install Opencv

  • use brew
brew install opencv
  • setup opencv.pc to pkgconfig, e.g :
ln -s /usr/local/Cellar/opencv/2.4.13/lib/pkgconfig/opencv.pc /usr/local/lib/pkgconfig/opencv.pc
  • setup libraries, e.g :
ln -s /usr/local/Cellar/opencv/2.4.13/ /usr/local/opt/opencv

Install and setup Cuda

  • Download from NVidia site and install the file cuda_X.X.X_mac.dmg

  • Make sure that libraries exist :

/usr/local/cuda
  • Add nvcc to the PATH : export PATH=/usr/local/cuda/bin:$PATH

Install and setup CuDNN

  • Download from NVidia site and extract the file cudnn-X.X-osx-xYY-vZ.Z
  • Copy libraries libcudnn.*, libcudnn_static.* to /usr/local/cuda/lib
  • Copy the header cudnn.h to /usr/local/cuda/include

Setup Makefile :

  • setup your configuration, e.g :
GPU=1
CUDNN=1
OPENCV=1
  • if your Mac OSX is 10.5 or later, add this to the Makefile:
CUDA_LIB_DIR=/usr/local/cuda/lib # your path to Cuda libraries
LDFLAGS += -Wl,-rpath,$(CUDA_LIB_DIR)

Compile and Run ./darknet and normally you get :

path/to/darknet $ make -j4

...

path/to/darknet $ ./darknet 
usage: ./darknet <function>
@bueller
Copy link

bueller commented Jun 3, 2017

May I ask which ver of Cudnn and Cuda you used to get this to work I run into a gabillion problems when trying to compile with GPU and OpenCV, thanks.

@davesade
Copy link

Same here, for example I got ./src/utils.c:29:19: fatal error: use of undeclared identifier 'CLOCK_REALTIME'...
Would be nice to know exact version of libraries and CUDA and Xcode.

@maerye
Copy link

maerye commented Nov 21, 2017

I have installed the opencv3 but got this error ,
_```
include/darknet.h:25:14: fatal error: 'opencv2/highgui/highgui_c.h' file not
found
#include "opencv2/highgui/highgui_c.h"

@jbryanking
Copy link

maerye, I found that I didn't have pkg-config installed. Once I didn't that I was able to fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment