From 74826c56a2e196a2f09afa93d99b3d70af6e142f Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Mon, 12 Feb 2018 13:37:52 -0800 Subject: [PATCH] set CUDA library search path for Mac OS X darknet failed to build on Mac OS X, because the Makefile passed an incorrect library search path for locating CUDA libraries. On Mac OS X, CUDA library installation path is /usr/local/cuda/lib by default. This patch fixed the issue. --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5f6f6e2d..e53d6f0e 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ ALIB=libdarknet.a EXEC=darknet OBJDIR=./obj/ +OS=$(shell uname -s) CC=gcc NVCC=nvcc AR=ar @@ -48,7 +49,12 @@ endif ifeq ($(GPU), 1) COMMON+= -DGPU -I/usr/local/cuda/include/ CFLAGS+= -DGPU -LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand +ifeq ($(OS), Darwin) +LDFLAGS+= -L/usr/local/cuda/lib +else +LDFLAGS+= -L/usr/local/cuda/lib64 +endif +LDFLAGS+=-lcuda -lcudart -lcublas -lcurand endif ifeq ($(CUDNN), 1)