The default compiler from Fedora 25 (gcc and g++ Version 6.3 will never work properly with cuda-8.0, even if you change /usr/local/cuda-8.0/include/host_config.h. BUT CLANG do work if you cheat the makefiles.
Warning!!! : The nvidia-cuda-developers do know, why they use clang only on apple machines. My way to force cuda using clang on Linux is just an experiment, which worked for me. Use my method only on your own risk.
I was able to get Fedora 25 working very fine with cuda-8.0.
1. Install clang
2. install cuda-8.0 and Nvidia-Driver from nvidia.com
3. sudo gedit /usr/local/cuda-8.0/include/host_config.h and change "6" to "7" in those lines#
# if __GNUC__ > 6
#error -- unsupported GNU version! gcc versions later than 6 are not supported!
#endif /* __GNUC__ > 6 */
3. Change the environment variables:
3-a with sudo gedit write this one of those lines
/usr/local/cuda-8.0/lib64 (for x86_64-arch) or /usr/local/cuda-8.0/lib (for i386, i686)
save the file to: /etc/ld.so.conf.d/nvcuda.conf
then do : sudo ldconfig
3-b with sudo gedit write those lines
export LDFLAGS=-L/usr/local/cuda-8.0/lib64 (or /usr/local/cuda-8.0/lib)
save the file to /etc/profile.d/nvcuda.sh
the do: sudo chmod +x /etc/profile.d/nvcuda.sh
restart the terminal (Konsole)
4. Force the Makefile in your source code to use clang instead of gcc and g++ in one of those ways (or both):
Method 1 : Edit the Makefile in your source code and change the lines with "Host compiler=gcc (or g++) to
Hostcompiler=clang or clang++.
Method 2: Force the system to use clang instead of gcc and g++:
- Medthod 2-a: remove/backup your gcc and g++ compilers with:
sudo mv /usr/bin/gcc /home?/user?/gcc-backup
sudo mv /usr/bin/g++ /home?/user?/g++-backup
sudo mv /usr/bin/x86_64-redhat-linux-g++ /home?/usr?/x86_64-redhat-linux-g++-backup
sudo mv /usr/bin/x86_64-redhat-linux-gcc /home?/usr?/x86_64-redhat-linux-gcc-backup
- Medthod 2-b: cheat by linking
sudo ln -sf /usr/bin/clang /usr/bin/gcc
sudo ln -sf /usr/bin/clang /usr/bin/g++
*** Now you can compile CUDA-programs.
If you want your gcc and g++ back, just inverse the mentioned mv command removing the -backup suffix
Common problem if installing the nvidia-driver from nvidia.com is:
the **GL-, and **EGL symlinks in /usr/lib64 will always be re-linkend, if yum updates any GL or EGL-Libraries. That is the reason, why some EGL-programs and GL-Programs will crash. Because of this you may need to relink the symlinks /usr/lib64/libGL.so** and /usr/lib64/libEGL.so to the EGL- and GL-Libraries from Nvidia ( somthing like:
sudo ln -sf /usr/lib64/libEGL_nvidia.so.375.26 /usr/lib64/libEGL.so)