"error: kernel launches from templates are not allowed in system files" No thrust

I have a problem related to this:
https://code.google.com/p/thrust/issues/detail?id=359

There are a few dozen versions of this question, but I couldn’t find any that did not involve thrust. The solutions for thrust do not seem to apply here.

I am trying to build caffe (http://caffe.berkeleyvision.org/installation.html) on Arch Linux. Which I haven’t been using for very long. I installed cuda, and have run some samples, including another neural network library, convnet. These built and ran, and used the GPU correctly.

But I cannot get this one to build:

/usr/bin/g++ -pthread -fPIC -DNDEBUG -O2 -I/usr/local/include -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I./src -I./include -I/home/lieslw/cuda/include -I/opt/intel/mkl/include   -c -o src/caffe/solver.o src/caffe/solver.cpp
/home/lieslw/cuda/bin/nvcc -ccbin=/usr/bin/g++ -Xcompiler -fPIC -DNDEBUG -O2 -I/usr/local/include -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I./src -I./include -I/home/lieslw/cuda/include -I/opt/intel/mkl/include -arch=sm_30 -c src/caffe/layers/lrn_layer.cu -o src/caffe/layers/lrn_layer.cuo
/home/lieslw/cuda/bin/nvcc -ccbin=/usr/bin/g++ -Xcompiler -fPIC -DNDEBUG -O2 -I/usr/local/include -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I./src -I./include -I/home/lieslw/cuda/include -I/opt/intel/mkl/include -arch=sm_30 -c src/caffe/layers/padding_layer.cu -o src/caffe/layers/padding_layer.cuo

/home/lieslw/cuda/bin/nvcc -ccbin=/usr/bin/g++ -Xcompiler -fPIC -DNDEBUG -O2 -I/usr/local/include -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I./src -I./include -I/home/lieslw/cuda/include -I/opt/intel/mkl/include -arch=sm_30 -c src/caffe/layers/pooling_layer.cu -o src/caffe/layers/pooling_layer.cuo
src/caffe/layers/pooling_layer.cu(163): error: kernel launches from templates are not allowed in system files

src/caffe/layers/pooling_layer.cu(168): error: kernel launches from templates are not allowed in system files

src/caffe/layers/pooling_layer.cu(289): error: kernel launches from templates are not allowed in system files

src/caffe/layers/pooling_layer.cu(295): error: kernel launches from templates are not allowed in system files

src/caffe/layers/pooling_layer.cu(301): error: kernel launches from templates are not allowed in system files

5 errors detected in the compilation of "/tmp/tmpxft_0000094e_00000000-4_pooling_layer.cpp4.ii".
Makefile:130: recipe for target 'src/caffe/layers/pooling_layer.cuo' failed
make: *** [src/caffe/layers/pooling_layer.cuo] Error 2

So, does it think that my $HOME directory is a system file location? I investigated env output, and removed my home directory from $PATH, but that didn’t fix this issue. The gcc variables CPLUS_INCLUDE_PATH and others do not exist. I moved all of cuda into $HOME. I moved the caffe project out of HOME. Still the same problem on the same files.

The same 3 files fail: pooling_layer.cu, softmax_layer.cu, dropout_layer.cu. I ahve looked at them, but I cannot tell how they are different from the others. I have asked the caffe developers what they think as well.

Solved: Installed gcc 4.4 and used that to build instead. Now working on another issue.