RHEL Centos 7.5 with devtoolset-7 (gcc V 7.3.1) and CUDA toolkit V 10.0.130 compile issue

Dear NVidia CUDA Toolkit Support,
I am using Centos 7.5 and I am trying to build SuiteSparse V 5.3.0 rpms using TBB and CUDA support using the devtoolset-7, which provides gcc V 7.3.1. It builds with the default gcc 4.8.5, but I want to enable the additional avx512 optimizations that are not available in gcc 4.8.5. I have tried just using the devtoolset-7-toolchain, as well as the full devtoolset-7 set of packages. Both result in the following set of errors (I am including just the first few, because the rest seem to be related to the errors below and are very long):

gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
COLLECT_GCC_OPTIONS=’-O2’ ‘-g’ ‘-pipe’ ‘-Wall’ ‘-fstack-protector-strong’ ‘–param’ ‘ssp-buffer-size=4’ ‘-grecord-gcc-switches’ ‘-m64’ ‘-mtune=generic’ ‘-I’ ‘/usr/include’ ‘-I’ ‘/usr/include/utility’ ‘-I’ ‘nvrtc.h’ ‘-D’ ‘HAVE_TBB’ ‘-v’ ‘-O3’ ‘-fexceptions’ ‘-fPIC’ ‘-fopenmp’ ‘-D’ ‘GPU_BLAS’ ‘-D’ ‘GPU_BLAS’ ‘-I’ ‘…/…/CHOLMOD/Include’ ‘-I’ ‘…/…/SuiteSparse_config’ ‘-I’ ‘…/Include’ ‘-I’ ‘…/…/SuiteSparse_GPURuntime/Include’ ‘-I’ ‘…/…/GPUQREngine/Include’ ‘-I’ ‘/usr/local/cuda/include/’ ‘-c’ ‘-shared-libgcc’ ‘-march=x86-64’ ‘-pthread’
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/cc1plus -quiet -v -I /usr/include -I /usr/include/utility -I nvrtc.h -I …/…/CHOLMOD/Include -I …/…/SuiteSparse_config -I …/Include -I …/…/SuiteSparse_GPURuntime/Include -I …/…/GPUQREngine/Include -I /usr/local/cuda/include/ -D_GNU_SOURCE -D_REENTRANT -D HAVE_TBB -D GPU_BLAS -D GPU_BLAS -D_FORTIFY_SOURCE=2 …/Source/spqr_assemble.cpp -quiet -dumpbase spqr_assemble.cpp -m64 -mtune=generic -march=x86-64 -auxbase spqr_assemble -g -grecord-gcc-switches -O2 -O3 -Wall -version -fstack-protector-strong -fexceptions -fPIC -fopenmp --param ssp-buffer-size=4 -o - |
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/as -v -I /usr/include -I /usr/include/utility -I nvrtc.h -I …/…/CHOLMOD/Include -I …/…/SuiteSparse_config -I …/Include -I …/…/SuiteSparse_GPURuntime/Include -I …/…/GPUQREngine/Include -I /usr/local/cuda/include/ --64 -o spqr_assemble.o
In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/utility:69:0,
from /usr/local/cuda/include/cuda_fp16.hpp:57,
from /usr/local/cuda/include/cuda_fp16.h:2524,
from /usr/local/cuda/include/cublas_api.h:75,
from /usr/local/cuda/include/cublas_v2.h:65,
from …/…/CHOLMOD/Include/cholmod_core.h:282,
from …/…/CHOLMOD/Include/cholmod.h:89,
from …/Include/SuiteSparseQR.hpp:17,
from …/Include/spqr.hpp:15,
from …/Source/SuiteSparseQR_expert.cpp:38:
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_relops.h:85:5: error: template with C linkage
template
^~~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_relops.h:98:5: error: template with C linkage
template
^~~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_relops.h:111:5: error: template with C linkage
template
^~~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_relops.h:124:5: error: template with C linkage
template
^~~~~~~~
In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_pair.h:59:0,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/utility:70,
from /usr/local/cuda/include/cuda_fp16.hpp:57,
from /usr/local/cuda/include/cuda_fp16.h:2524,
from /usr/local/cuda/include/cublas_api.h:75,
from /usr/local/cuda/include/cublas_v2.h:65,
from …/…/CHOLMOD/Include/cholmod_core.h:282,
from …/…/CHOLMOD/Include/cholmod.h:89,
from …/Include/SuiteSparseQR.hpp:17,
from …/Include/spqr.hpp:15,
from …/Source/SuiteSparseQR_expert.cpp:38:
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/move.h:45:3: error: template with C linkage
template
^~~~~~~~
In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/move.h:54:0,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/stl_pair.h:59,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/utility:70,
from /usr/local/cuda/include/cuda_fp16.hpp:57,
from /usr/local/cuda/include/cuda_fp16.h:2524,
from /usr/local/cuda/include/cublas_api.h:75,
from /usr/local/cuda/include/cublas_v2.h:65,
from …/…/CHOLMOD/Include/cholmod_core.h:282,
from …/…/CHOLMOD/Include/cholmod.h:89,
from …/Include/SuiteSparseQR.hpp:17,
from …/Include/spqr.hpp:15,
from …/Source/SuiteSparseQR_expert.cpp:38:
/opt/rh/devtoolset-7/root/usr/include/c++/7/type_traits:68:3: error: template with C linkage
template<typename _Tp, _Tp __v>
^~~~~~~~

 I have tried every trick I could find via internet searches, but none have worked.  The gcc V 4.8.5 build uses /bin/include/utility.  I noticed that you have a Fedora V 27 build, which uses gcc 7.3.1. Do I need to replace the RHEL - Centos 7 build:

cuda-toolkit-10-0.x86_64 10.0.130-1 @cuda

with the cuda-toolkit from the Fedora 27 version:

cuda-repo-fedora27-10-0-local-10.0.130-410.48-1.0-1.x86_64.rpm
?
That appears to be a fragile install for using yum?
Thank you in advance for your reply and guidance.

My theory:

The files in question (e.g. stl_relops.h) are evidently being compiled with C linkage. This is not due to some errant extern “C” statement in CUDA or SuiteSparse; your successful compile with gcc 4.8.5 proves that.

Therefore, for some reason, your gcc 7 install is choosing to consider that file a particular category of system header, which automatically gets compiled with C linkage.

Again, “that file” is a header file associated with gcc 7, not provided by CUDA or SuiteSparse.

A fairly simple test would help to confirm this. Try compiling just this:

#include <utility>

with your gcc 7 (e.g. g++ -c test.cpp). If that produces an error, it’s a solid indication your gcc 7 is misconfigured.

If that produces no error, I would work my way up the include chain, to try and narrow down where the problem is happening. For example, compile this:

#include "cuda_fp16"

with

g++ -c -I/usr/local/cuda/include test.cpp