gcc? blockIdx and kernel calls are not recognized.. nvcc? Unknown option 'dumpspecs'

Dear all,

I’m trying to build the CUDA project using Scons on Mac OS X 10.8 (NSight).

If I’m using the key “-ccbin=/usr/local/cuda/bin/nvcc”
I’m getting fatal errors from nvcc (pre)compiler: nvcc fatal : Unknown option ‘dumpspecs’

If I’m using the key “-ccbin=/opt/local/bin/g++”
I’m getting errors of kind:
src/GPUShift.cuh:44:22: error: ‘blockIdx’ was not declared in this scope
src/GPUShift.cuh:58:27: error: ‘threadIdx’ was not declared in this scope
src/GPUShift.cuh:77:17: error: there are no arguments to ‘__syncthreads’ that depend on a template parameter, so a declaration of ‘__syncthreads’ must be available [-fpermissive]

(my kernel is template function)

In last case gcc compiler is used, as could be seen from console output:
#$ “/opt/local/bin”/g++ -c -x c++ -D__NVCC__ -Wall -g3 -O0 -Wconversion -ansi -Wno-long-long -pedantic -Werror -std=c++0x -I"/usr/local/cuda/common/inc" -I"/usr/local/cuda/include" -I"/usr/local/cuda/include" …

Does anybody have an idea, how to fix it? Which compiler option should I use (I was sure, that it should be g++) and, if it is g++, why all CUDA-related functions and calls are not recognized (while usr/local/cuda/include is included).

Thanks in advance.

On Mac OS X 10.8, if you have installed Xcode 5.0, try this:

mvcc -ccbin=/usr/bin/clang

Tried this, but getting almost the same errors as with g++:
error: use of undeclared identifier ‘__syncthreads’
error: use of undeclared identifier ‘threadIdx’
etc.

And #include <cuda_runtime.h> is seen as unresolved inclusion, while in the compiler’s output I clearly see needed inclusion: #$ “/usr/bin”/clang -c -x c++ -D__NVCC__ -Wall -g3 -O0 -ansi -Wno-long-long -pedantic -std=c++0x -I"/usr/local/cuda/common/inc" -I"/usr/local/cuda/include" …