g++6 + host_compiler: g++-5.3 gives error!


I am currently working on my institutes framework and I want to integrate some of my cuda-apps.
If I configure my CMAKE_CPP_COMPILER as the current clang version (3.9) and the nvcc host compiler via --compiler-bindir as g+±5 (gcc version 5.3) then everything is working.
Despite that, if I’m using g++ version 6.1 as CMAKE_CPP_COMPILER then I get some compile errors like:
error: identifier “BOOST_PP_VARIADIC_TO_ARRAY” is undefined.

I really need c++11, so setting -std=c++98 is not an option for me. Is there anything else that could help?

My OS is arch-linux with CUDA 8.

Thank you in advance!

Best regards,


TL;DR: Stick with supported configurations.

Looking at the list of supported configurations in the Linux Installation Guide (http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html), I do not see support for gcc versions later than 5.3.1 (and I don’t see arch-linux on the list). You should not need gcc 6.1 to use C++11 functionality.

CUDA offers (for better and worse) tight integration with the host compiler. This means that adjustments need to be made on the CUDA side for new host tool chains. Where those adjustments are missing, errors (such as the one you are encountering) may occur.


Thank you for your comment.
I know that only the gcc 5.3 is supported by CUDA. That is why I set the host compiler of nvcc to gcc 5.3, even in the case of gcc6.1 as “normal compiler” for the rest of the framework. Maybe, there is no solution for my problem. But, I was wondering why the combination clang + gcc5.3 as host compiler for nvcc is working.

Best regards,


I don’t use clang, and it is not clear to me what exactly your setup is. In general, if you use a supported host compiler with CUDA, I would expect that host code compiled with a third compiler that successfully interoperates with that supported host compiler should cause no problem.

E.g. use of MSVC as my host compiler for CUDA code on Windows, plus a Fortran compiler than can produce code that successfully interfaces with code generated by MSVC allows me to use Fortran code in a CUDA project.

As far as I know, interoperability between code from multiple C++ compilers is not a given, due to lack of a standardized binary interface (e.g. different name decoration schemes).

For clarity the important parts of my CMakeList:

NVCC_FLAGS="–compiler-bindir /usr/bin/g+±5 -std=c++11"
–> this works
CMAKE_CPP_COMPILER=/usr/bin/g++ (gcc 6.1)
NVCC_FLAGS="–compiler-bindir /usr/bin/g+±5 -std=c++11"
–> this doesn’t work

Maybe you are right with the suggestion of the missing interoperability. But it would be great if there is a solution. Sadly, I can’t only use gcc-5 due to the other framework users.

I don’t use CMAKE (for good reasons),therefore can’t assess the ramifications of these changes.

For background knowledge: What software framework mandates the use of a gcc version newer than 5.3.x, and why?

The lines are basically saying, that the parts which are not included by a .cu file are compiled with the CMAKE_CPP_COMPILER and the CPU-parts of the cuda related code (.cu files and their included) are compiled with the g+±5.

The other developers in our institute and projects which are using this framework mandate the newest gcc of arch-linux. There is no technical reason, its more a practical one.

So your colleagues are mandating the use of the latest gcc, but not for technical reasons, simply because it’s “the latest”?

From long experience I can say that always chasing the latest release, in the absence of solid technical reasons, is foolish. However, it seems this is the “new normal” among certain segments of the programming public.