#error -- unsupported GNU version! gcc 4.5 How to invoke gcc-4.4 and g++-4.4 installed also

Hello,

I intend to install OpenFoam with ofgpu support on a current Linux Mint system. http://www.symscape.com/gpu-0-2-openfoam.

By default Linux Mint comes with gcc-4.5.2 and g+±4.5.2 but cuda 4.0 supports only gcc and g++ versions < 4.5.

ofgpu is configured with ccmake; I installed gcc-4.4 and g+±4.4 in addition to the standard version.

ccmake worked fine, using the following: CC=gcc-4.4 CXX=g+±4.4 ccmake /home/user/OpenFOAMSP/ofgpu-0-2/src but make install didn’t and resulted in the following error:

[ 25%] Building NVCC (Device) object ofgpu/./ofgpu_generated_sparsematrixsystem.cu.o
In file included from /usr/local/cuda/include/cuda_runtime.h:59:0,
from “command-line”:0:
/usr/local/cuda/include/host_config.h:82:2: error: #error – unsupported GNU version! gcc 4.5 and up are not supported!
CMake Error at CMakeFiles/ofgpu_generated_sparsematrixsystem.cu.o.cmake:200 (message):
Error generating
/home/user/OpenFOAMSP/ofgpu-0-2/ofgpu/./ofgpu_generated_sparsematrixsystem.cu.o

make[2]: *** [ofgpu/./ofgpu_generated_sparsematrixsystem.cu.o] Fehler 1
make[1]: *** [ofgpu/CMakeFiles/ofgpu.dir/all] Fehler 2
make: *** [all] Fehler 2

How can I invoke gcc-4.4 and g+±4.4?

Yeah, this is something I’ve been meaning to add automatic support for, but I haven’t gotten around it. NVCC picks up the default version of GCC that’s in your path. In order to get around this, you can specify the version of the compiler you want to use by adding the compiler to to NVCC command line arguments.

Look for CUDA_NVCC_FLAGS in your ccmake or cmake-gui. Then add -ccbin;gcc-4.4 (note the semi-colon is the argument separator here). The -ccbin argument tells NVCC that you are going to specify the host compiler it should use. See the help output from NVCC (nvcc --help).

This is how it works!

The following is based on Linux Mint 11 with default gcc and g++ version 4.5.2 which is not supported by cuda 4.0. Cuda 4.0 requires a version < 4.5:

  1. Install gcc-4.4 and g+±4.4 which are in the repository (binaries will be located in /usr/bin after installation)

  2. Create a directory e.g. sudo mkdir /opt/gcc44

  3. Create a symbolic for gcc: sudo ln -s /usr/bin/gcc-4.4 /opt/gcc44/gcc

  4. Create a symbolic for g++: sudo ln -s /usr/bin/g+±4.4 /opt/gcc44/g++

  5. Edit nvcc.profile located in /usr/local/cuda/bin/ and add compiler-bindir=/opt/gcc44 at the end of the file (e.g. sudo gedit…; cuda 4.0 will now be using gcc-4.4 and g+±4.4)

  6. Create your application with reference to gcc-4.4 and g+±4.4 e.g. when using cmake: CC=gcc-4.4 CXX=g+±4.4 ccmake /…/src

speedx

Well, that’s certainly the big hammer approach to it. Glad you got something working, but don’t forget that you can specify the compiler you want to nvcc using the -ccbin argument. This method would not require you setting all the links and editing nvcc.profile.

Does anyone have any ideas of when this will be fixed so we do not have to backdate our GCC installations just
to use CUDA??