View Single Post
Old 07-18-11, 07:36 AM   #14
ant
A GeForced Ant
 
ant's Avatar
 
Join Date: Sep 2002
Location: An Ant Farm
Posts: 348
Default Re: Could not compile 'gcc-version-check.c' in my Debian box.

Quote:
Originally Posted by dk75 View Post
Strange thought... you are using stable debian (2.6.32 kernel) and have same problem like testing had (i have not anymore).

PS: i'm using alternatives system to change gcc, g++, gcov and cpp in one go to version that i need (all of them).
It needs to be configured before, like with that script (it's my environment script as i have 4.3, 4.4, 4.5 and 4.6 GCC installed):
Code:
#!/bin/bash

sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --remove-all gcov
sudo update-alternatives --remove-all cpp

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 43 \
	--slave /usr/bin/g++ g++ /usr/bin/g++-4.3 \
	--slave /usr/bin/gcov gcov /usr/bin/gcov-4.3 \
	--slave /usr/bin/cpp cpp /usr/bin/cpp-4.3

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 44 \
	--slave /usr/bin/g++ g++ /usr/bin/g++-4.4 \
	--slave /usr/bin/gcov gcov /usr/bin/gcov-4.4 \
	--slave /usr/bin/cpp cpp /usr/bin/cpp-4.4

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.5 45 \
	--slave /usr/bin/g++ g++ /usr/bin/g++-4.5 \
	--slave /usr/bin/gcov gcov /usr/bin/gcov-4.5 \
	--slave /usr/bin/cpp cpp /usr/bin/cpp-4.5

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 46 \
	--slave /usr/bin/g++ g++ /usr/bin/g++-4.6 \
	--slave /usr/bin/gcov gcov /usr/bin/gcov-4.6 \
	--slave /usr/bin/cpp cpp /usr/bin/cpp-4.6

exit 0
Then i do "sudo update-alternatives --config gcc" and chose desired gcc environment.
If I don't specify which gcc version when compiling NVIDIA drivers, then I get error:

The CC version check failed:

The compiler used to compile the kernel (gcc 4.3) does not exactly match the current compiler
(gcc 4.6). The Linux 2.6 kernel module loader rejects kernel modules built with a version of
gcc that does not exactly match that of the compiler used to build the running kernel.

If you know what you are doing and want to ignore the gcc version check, select "No" to continue
installation. Otherwise, select "Yes" to abort installation, set the CC environment variable to
the name of the compiler used to compile your kernel, and restart installation. Abort now?

Yes No
__________________
Ant @ The Ant Farm (http://antfarm.ma.cx) and Ant's Quality Foraged Links (http://aqfl.net).
ant is offline   Reply With Quote