Cannot compile cuda mex file ./nvmex: line 931: -c: command not found


I recently installed CUDA and Matlab plugin on a Mac Pro but have trouble compiling. I recieve the following error when invoking the makefile:

$ make

./nvmex -f -I/usr/local/cuda/include -L/usr/local/cuda/lib

./nvmex: line 931: -c: command not found

I found another thread on this forum where this problem is solved by replacing "CC=nvcc’ with “CC=’/usr/local/cuda/bin/nvcc’” in but it doesn’t work for me. Bandwithtest succesful and all that. The Makefile is pretty much the same except I added rule for mexmaci64 and altered Matlab installation folder. MEXEXT is properly returned (mexmaci64).

# Define installation location for CUDA and compilation flags compatible

# with the CUDA include files.

CUDAHOME	= /usr/local/cuda


INCLUDELIB  = -L$(CUDAHOME)/lib # -Wl,-rpath,$(CUDAHOME)/lib

CFLAGS	  = -fPIC -D_GNU_SOURCE -pthread -fexceptions

COPTIMFLAGS = -O3 -funroll-loops -msse2

# Define installation location for MATLAB.

export MATLAB = /Applications/

MEX		   = $(MATLAB)/bin/mex

MEXEXT		= .$(shell $(MATLAB)/bin/mexext)

# nvmex is a modified mex script that knows how to handle CUDA .cu files.

NVMEX = ./nvmex

# List the mex files to be built.  The .mex extension will be replaced with the

# appropriate extension for this installation of MATLAB, e.g. .mexglx or

# .mexa64.

MEXFILES = knn.mex

all: $(MEXFILES:.mex=$(MEXEXT))


	rm -f $(MEXFILES:.mex=$(MEXEXT))

.SUFFIXES: .cu .cu_o .mexglx .mexa64 .mexmaci64
















line 931 is where the compilation command is executed. Any experience with this issue?

Looks like this problem was fixed for me by “chmod +x nvmex”; but now there is another one – I get the following error:
[indent]./nvmex -f -I/usr/local/cuda/include -L/usr/local/cuda/lib -lcufft -lcudart -Wl,-rpath,/usr/local/cuda/libversion
mex: /Applications/ not a normal file or does not exist.
make: *** [Szeta.mexmaci] Error 1[/indent]

Oh btw – and also I think 64-bit mac is not supported; so one needs to (i) have a 32-bit Matlab compiler and (ii) export MACI64=0 to even get to the error message about mexversion.c :)