Blender: cycles renderer and CUDA in Ubuntu 12.10 on nvidia GPU

If you want to run blender ootb in ubuntu with CUDA support you will make a sad face at first.

Maybe at first you search for the preference for CUDA like its stated in the internet under “User-Preferences->System”, and dont find it. Then maybe you have a look at the addons for the cycles renderer and will see an error message stating “missing script files”. If you then try the version from debian (Step 1 and 2 in this guide) and install CUDA (Step 3), as render result you will only get a black screen, and maybe you will find the error message “error — unsupported GNU version! gcc 4.7 and up are not supported!” so cuda kernel compilation failed. So this is what step 4 in this guide is for.

Maybe this is going to change as 12.10 is still in beta, if not, follow this steps. I dont know if it also works for other Ubuntu versions as 12.04 Precise Pangolin.

There the two problems as of now are:

  • The blender in in current ubuntu packages does not support CUDA with cycles renderer.
  • CUDA needs gcc version <4.7, but on Quetzal version 4.7 is default, so CUDA fails to compile.

You need to have the proprietary nvidia drivers and some additional Packages installed:

sudo apt-get install nvidia-current build-essential gcc-4.6 freeglut3-dev

1. Download and install blender 2.63a-2 from the debian-experimental repository. As it depends on 2 packages that are newer in debian experimental, you have to download two additional packages, namely libglew1.7 and libpng15-15. Choose the right .deb package for your architecture (i386 or amd64 would be the most common depending if you are on 32 or 64 bit) from the following sites:


* Edit, libpng package changed, thx to majorkillsmurfsmrblurgle in the comments*

2. Install the packages with dpkg. For me the command is

sudo dpkg -i blender_2.63a-2_amd64.deb libglew1.7_1.7.0-3_amd64.deb \

3. Get CUDA toolkit from nvidia and install it by running the installer. Get the right package from and install it to the default location (if you change the location consider this in step 3) For Quetzal you can use the CUDA toolkit for Ubuntu 11.04

Install the toolkit with:

chmod +x
sudo ./

4. Link gcc4.6 to the CUDA installation, so it does not use the default 4.7

sudo ln -s /usr/bin/gcc-4.6 /usr/local/cuda/bin/gcc

So thats it.


, ,

  1. #1 by Yohann on September 26, 2012 - 09:22


    Installation of cuda 5 RC fails on Ubuntu Quantal 12.10 :

    $ sudo apt-get install libghc-glut-dev
    $ wget -c
    $ chmod +x
    $ sudo ./
    [sudo] password for yoyo:
    Logging to /tmp/cuda_install_6537.log
    Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 304.33? (yes/no/quit): no
    Install the CUDA 5.0 Toolkit? (yes/no/quit): yes
    Enter Toolkit Location [ default is /usr/local/cuda-5.0 ]
    Install the CUDA 5.0 Samples? (yes/no/quit): yes
    Enter CUDA Samples Location [ default is /usr/local/cuda-5.0/samples ]
    Unsupported compiler: 4.7.2
    Missing required library

    = Summary =

    Driver: Not Selected
    Toolkit: Installation Failed. Using unsupported Compiler.
    Samples: Installation Failed. Missing required libraries.

    Logfile is /tmp/cuda_install_6537.log

    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu quantal (development branch)
    Release: 12.10
    Codename: quantal

    $ uname -a
    Linux yoyo-laptop 3.6.0-999-generic #201209170418 SMP Mon Sep 17 08:19:54 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

    $ apt-cache policy nvidia-current
    Installed: 304.43-0ubuntu5
    Candidate: 304.51-0ubuntu1~precise~xup1
    Version table:
    304.51-0ubuntu1~precise~xup1 0
    500 precise/main amd64 Packages
    *** 304.43-0ubuntu5 0
    500 quantal/restricted amd64 Packages
    100 /var/lib/dpkg/status

    • #2 by gunni on September 26, 2012 - 09:37

      I used cuda 4.2, not 5 RC. From your log i see two problems:
      Unsupported compiler: 4.7.2
      Missing required library
      I had none of these two problems. For the i surely had some needed package installed on my system. I will have a look when i am back at home. I will also check a reinstall and an installation of the newer version.

      • #3 by Yohann on September 26, 2012 - 09:47


        liglut has been rename to freeglut :

        $ apt-cache policy freeglut3-dev
        Installed: 2.6.0-4ubuntu1
        Candidate: 2.6.0-4ubuntu1
        Version table:
        *** 2.6.0-4ubuntu1 0
        500 quantal/main amd64 Packages
        100 /var/lib/dpkg/status

        $ locate

        And for the compiler, yes, it’s too recent :

        $ gcc –version
        gcc (Ubuntu/Linaro 4.7.2-1ubuntu1) 4.7.2

    • #4 by gunni on September 26, 2012 - 22:39

      So even with cuda_5 RC it does install here, so try installing gcc 4.6 in parallel:

      gunni@server:~/Downloads$ sudo ./
      [sudo] password for gunni:
      Logging to /tmp/cuda_install_26978.log
      Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 304.33? (yes/no/quit): no
      Install the CUDA 5.0 Toolkit? (yes/no/quit): yes
      Enter Toolkit Location [ default is /usr/local/cuda-5.0 ]
      Install the CUDA 5.0 Samples? (yes/no/quit): yes
      Enter CUDA Samples Location [ default is /usr/local/cuda-5.0/samples ]
      Installing the CUDA Toolkit in /usr/local/cuda-5.0 …
      Missing required library

      = Summary =

      Driver: Not Selected
      Toolkit: Installed in /usr/local/cuda-5.0
      Samples: Installation Failed. Missing required libraries.

      Logfile is /tmp/cuda_install_26978.log

      gunni@server:~/Downloads$ gcc –version
      gcc (Ubuntu/Linaro 4.7.2-1ubuntu1) 4.7.2

  2. #5 by Yohann on September 26, 2012 - 09:50

    For information, ther is no option for including for add a path for libs :

    $ sudo ./ -help
    -help : Print help message
    -driver : Install NVIDIA Display Driver
    -uninstall : Uninstall NVIDIA Display Driver
    -toolkit : Install CUDA 5.0 Toolkit
    -toolkitpath= : Specify path for CUDA location (default: /usr/local/cuda-5.0)
    -samples : Install CUDA 5.0 Samples
    -samplespath= : Specify path for Samples location (default: /usr/local/cuda-5.0/samples)
    -silent : Run in silent mode
    -verbose : Run in verbose mode
    -extract= : Extract individual installers from the .run file to PATH
    -optimus : Install driver support for Optimus

    • #6 by gunni on September 26, 2012 - 13:18

      I got both gcc 4.6 and 4.7 installed. As i had no such problems with CUDA 4.2 maybe the installer can choose the right one if both are installed.
      Cant check that by now, as i am not at home.

  3. #7 by Chuck Moyes on October 20, 2012 - 23:15

    For those of you still having GLUT problems, after you install freeglut-dev, create symlinks to /usr/lib like follows (for i686):
    sudo ln -sf /usr/lib/i386-linux-gnu/ /us/
    sudo ln -sf /usr/lib/i386-linux-gnu/ /us/
    for all BLAH. I’m _pretty_ sure if you’re using amd64, then you’ll find it in another folder instead so look for files in /usr/lib using the find command. Feel free to delete these symlinks after CUDA successfully installs, but I’d keep them around since symlinks to GLUT arent really that harmful. If you upgrade to a newer version and have issues, just update the symlinks. I’m really surprised the freeglut package doesn’t install libraries to the /usr/lib directory. I suppose CUDA development with Ubuntu (particularly the just-released 12.10) is still very much experimental.

    For those of you who are still seeing “Unsupported compiler” messages: After installing GCC 4.6, you will need to make sure the correct compiler is selected using update-alternatives. To do so, run “sudo update-alternatives -config gcc” and ensure that GCC 4.6 is selected. Then do sudo su to change to root user, and run “export CXX=/usr/bin/gcc-4.6” to choose the right compiler. This is a temporary measure to get the CUDA toolkit to install (you can permanently set the environment variable if you want but I don’t recommend it since it will break other things) so while you are still as root, run the installer (NO sudo ./, just ./ and make sure it’s marked as an executable file with chmod since we want to use our root environment to install it). After it installs (successfully), go back and log out of root (will clear out the temporary environment variable) and reset the default compiler using update-alternatives again.

    Let me know if you still have any problems as I was able to successfully install the CUDA development toolkit and drivers under 12.10 after these tweaks. Hope this helps!

    • #8 by gunni on October 20, 2012 - 23:58

      I had none of these problems, but maybe thats because i had no fresh install.

  4. #9 by majorkillsmurfsmrblurgle on November 19, 2012 - 12:27

    • #10 by gunni on November 19, 2012 - 12:38

      Thx. Edited the link in the post.

  5. #12 by Dan on November 22, 2012 - 20:30

    after doing the steps above modify /usr/local/cuda/include/host_config.h and change the gcc version from 6 to 8. cylcles works fine after that with gcc 4.7

  6. #13 by majorkillsmurfs on November 27, 2012 - 08:41

    I noticed afterwards that I was still on CPU rendering – to enable GPU rendering I also had to follow Dan’s advice. For clarity, this is the line that requires modification – #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) (the 8 here was originally a 6). I haven’t had any major issues with this yet.

  7. #14 by Azad Abraham on November 15, 2013 - 10:34

    i am new learner of blender3D i installed Ubuntu two days ago, and struggling installing my nvidia and blender on new OS, after more than 15 times fresh installation and following help forum i am able to install but now i have a problem, my preference > system dose not show GPU option, ( once it did yesterday but i ruined my installation trying to fix left mouse button issue) is there any one who can help me with this, I am very new to linux, I know nothing about it.

    what i want to achieve

    run blender and get the utmost performance of my hard ware on Linux Ubuntu

    what i have

    i7 processor, with nvidia 640 graphic card.

    what i did

    fresh install of Ubuntu then installation of nvidia driver

    sudo apt-get install nvidia-current

    then i installed blender 2.69

    sudo apt-get install blender

    sudo apt-get update

    sudo add-apt-repository ppa:irie/blender

    So, now my blender is working, but in the system preference it shows NO CPU and when i go to render view i don’t see the environment texture only green and gray colors at back ground.

    • #15 by gunni on November 15, 2013 - 10:51

      Sorry, i cant help for now, as i never tried this again so i dont know if the description of this post still works.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: