Makefile to be used in projects subfolder of MAC OS X CUDA SDK 2.0
############################################################
#
# Build script for project
#
############################################################
# Add source files here
EXECUTABLE := repro1
# CUDA source files (compiled with cudacc)
CUFILES := repro1.cu
############################################################
# Rules and targets
include ../../common/common.mk
Code for repro1.cu
#include <cuComplex.h>
#include <stdio.h>
int main(int argc, char **argv)
{
int max_index= 7;
cuComplex test[max_index];
for (int i=0; i < max_index; i++)
test[i] = make_cuComplex(i, i+1);
for (int i=0; i < max_index; i++)
printf("%f, %f\n", test[i].x, test[i].y);
return 0;
}
Note: this compiles when using nvcc on the command line.
This does not compile (actually: link) using make, no matter what dbg or emu flag is given.
Error is as follows:
Macintosh-2:repro1 buchner$ make
Undefined symbols:
"___vla_alloc", referenced from:
_main in repro1.cu_o
"___vla_dealloc", referenced from:
_main in repro1.cu_o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [../../bin/darwin/release/repro1] Error 1
Macintosh-2:repro1 buchner$
So it’s probably not an issue with the CUDA toolchain, but rather with the build environment that is created in common.mk of the SDK 2.0 for MAC
I’ve been having a similar issue, where the Mac OS X linker can’t find the ___vla_alloc/___vla_dealloc, but it will not have a problem under linux.
In my case I was passing an array by reference to a subfunction that dereferenced the array, memcpy’ed its elements and then called a stream of cuda kernels.
Has there been any progress with this issue (FYI: I’m using CUDA 2.0).