I've multiple version of gcc installed on my systems as follows:
ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root 7 Jan 11 05:20 /usr/bin/gcc -> gcc-4.4
-rwxr-xr-x 1 root root 239528 Sep 21 2010 /usr/bin/gcc-4.3
-rwxr-xr-x 1 root root 255536 Nov 15 2010 /usr/bin/gcc-4.4
I need to build a nvidia device driver using the same version of GNU compiler as was used to compile the currently running kernel. How do I find out the version of my GNU gcc compiler that was used by upstream Linux distribution to compile and pack my binary Linux kernel?
You need to cat the /proc/version file. This file identifies the kernel version that is currently running and gcc version used to build the kernel.
Sample Outputs From Debian GNU/Linux 6.x
Open a command-line terminal (select Applications > Accessories > Terminal), and then type:
$ cat /proc/version
Sample outputs:
Linux version 2.6.32-5-amd64 (Debian 2.6.32-41) (ben@decadent.org.uk) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Mon Jan 16 16:22:28 UTC 2012Sample Outputs From CentOS / RHEL 6.x Server
Type the following command:
$ cat /proc/version
Sample outputs:
Linux version 2.6.32-220.2.1.el6.x86_64 (mockbuild@x86-009.build.bos.redhat.com) (gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Tue Dec 13 16:21:34 EST 2011How Do I Force make To Use Particular Compiler?
You need to set shell environment variable called CC to point to your C compiler. In this example set CC to gcc version 4.3.x:
$ export CC=/usr/bin/gcc-4.3
$ make
OR start building NVIDIA module using gcc-4.3:
$ export CC=/usr/bin/gcc-4.3
$ bash NVIDIA-Linux-x86_64-295.20.run
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop













{ 1 comment… read it below or add one }
Just need to thank