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 the cat command:
$ 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 2012
Sample 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 2011
Sample outputs from an Ubuntu Linux laptop
$ cat /proc/version
Sample outputs:
Linux version 4.13.0-17-generic (buildd@lcy01-amd64-011) (gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3)) #20-Ubuntu SMP Mon Nov 6 10:04:08 UTC 2017
How 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
- Ubuntu Linux Install GNU GCC Compiler and Development Environment
- Debian Linux Install GNU GCC Compiler and Development Environment
- CentOS / RHEL 7: Install GCC (C and C++ Compiler) and Development Tools
- Download and Install C, C++ Compiler on Red Hat Enterprise Linux 5 (RHEL)
- Mac OS X: Install GCC Compiler with Xcode
- Where is My Linux GNU C or GCC Compilers Are Installed?
- HowTo: Compile And Run a C/C++ Code In Linux
- RHEL / CentOS Linux Install Core Development Tools Automake, Gcc (C/C++), Perl, Python & Debuggers
- HowTo Compiling C Program And Creating Executable File Under a Linux / UNIX / *BSD
- How To Install ncurses Library on a Linux
- Linux Find Out What Compilers Are Installed or Available On The System
- Linux Find Out GNU gcc Compiler Version Used To Compile Running Kernel
- Howto see output of C program in Linux or UNIX
Just need to thank