Ubuntu 14.04.1 LTS CUDA 6.5 GCC 4.9

I am working under Ubuntu 14.04.1 LTS with 2 GPUs Nvidia GTX 760
I have installed Nvidia-340.58 Graphics driver
I have gcc 4.9.2
I installed cuda 6.5
after installation while running cuda samples

i have error says gcc 4.9 is not supported cuda 6.5 on ubuntu only support gcc 4.8.2

what should i do
will cuda 6.5 nsight eclipse work well with gcc 4.9.2
can i change commands in make file to make sample work with gcc 4.9.2
should i install gcc 4.8.2 again and remove gcc 4.9.2 ?

i am working on it too.

could you please let me know if there are any advancements in the installation process

try gcc version 4.4

the process gone well after the process you cannot build the samples it requires gcc 4.8.2
i opened nsight eclipse and created cuda project with a template and clicked run it also generate one error gcc 4.9 not supported it support the compiler that comes with the OS which is gcc 4.8.2

after thinking there are two ways to solve this
1- update the environment variables and make files to run cuda samples with gcc 4.9.2.
2- (stupid solution and i did it) reinstall ubuntu 14.04 upgrade to 14.04.1 reinstall nvidia-340.58 graphics driver reinstall cuda toolkit 6.5
and guess what after installation the make process it had run well very well all samples succeeded
it works like charm with gcc 4.8.2

i added ubuntu toolchain test to install gcc 4.9.2 to learn OpenMP 4.0
at least now the driver work well cuda 6.5 work well i will have OpenMP 3.1 not OpenACC

also one person write a solution on google
I tried editing /usr/include/host_config.h as below to bypass the GCC
version check.
After this change, I was able to build all of the CUDA 5.5 SDK samples
without error.

Let me know if this works for you too and I will prepare a patch.


— /usr/include/host_config.h.orig 2014-08-14 11:44:17.760255774 +0200
+++ /usr/include/host_config.h 2014-08-14 11:34:42.820275680 +0200
@@ -77,7 +77,7 @@

#if defined(GNUC)

-#if GNUC > 4 || (GNUC == 4 && GNUC_MINOR > 8)
+#if GNUC > 4 || (GNUC == 4 && GNUC_MINOR > 9)

#error – unsupported GNU version! gcc 4.9 and up are not supported!

and it didn’t check for gcc version and they said it worked well

anyway thank you for answering and viewing my topic

here some links for solving this problem


atfer reading
the only solution is to edit /usr/include/host_config.h
by commenting the lines that nvidia written to check gcc version
remember they did this to make cuda work well if you change those line may be some problems or unexpected results because you use new compiler the latest one which is not yet tested by nvidia but many people done this and it worked well i will try it and tell you

Yes it worked
now to install Nvidia graphics driver and to install cuda toolkit 6.5
do these steps
first purchase external usb hard disk 500 GB or 1 TB
move all of your data your home folders and files don’t move any system’s folders or files
move games software sources movies songs videos documents books like that
purchase 4 GB flash disk
open Ubuntu 14.04 or what ever your OS
Download Ubuntu 14.04 LTS or 14.04.1 LTS directly
open dash write start up disk
open start up disk
browse select Ubuntu 14.04.iso file you have downloaded
choose your usb after you put it into your pc
click start enter your password
after finishing you have bootable usb stick for Ubuntu
press boot f11 or what ever on startup
choose boot options
make boot from usb first option
save and exit
click boot button f2 or whatever
install Ubuntu
restart after installation
enter your new desktop
open terminal
sudo add-apt-repository -y ppa:xorg-edgers/ppa

sudo apt-get update

sudo apt-get install nvidia-340

after finishing restart
enter your desktop
open terminal
install cuda toolkit 6.5
you must download ubuntu 14.04 cuda 6.5 .deb package from nvidia website

now run these commands
run commands in this tutorial

it will work fine and all the tests will work fine
remember when you install ubuntu 14.04 you will have gcc 4.8.2 it will work from first time with cuda toolkit 6.5

now after restart
open dash
write nvidia
you will see nvidia settings nvidia profiler nsight eclipse applications
open nsight eclipse
new cuda c/c++ project
runtime project
next finish

the project will be opened
build the file .cu after opening it and focusing on it
it will run everything is write

now in project explorer
expand includes
expand usr/local/cuda-6.5/targets/x86_64/include
you will find header file host_config.h
these file contain directives that checks gcc version
you must comment all lines 5 lines in this file that checks gcc version
close nsight eclipse
open terminal
cd usr/loca/cuda-6.5/targets/x86_64/include
sudo gedit host_config.h
comment the lines that checks gcc version

exit terminal

open terminal
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9

install gcc 4.9 g++ 4.9 cpp 4.9

now open nsight eclipse new cuda c/c++ project runtime project next
it will not generate error about gcc version