How to Check the Version of the Native gcc Compiler in Linux

Embedded linux






In this article, we show how to check the version of native gcc compiler installed on your linux system.

So if you are an embedded engineer or you work with embedded systems, there are 2 types of compilers that you are concerned with.

There is the native compiler for your host machine, such as the laptop you are using and then there is a cross-compilation toolchain (or cross compiler) which is used to compile code for target devices which use different processors than the host machine.

If you are using a laptop, there's a good chance that it is running on an x86 CPU. This is common for general-purpose computers. x86 is a processor made by Intel for desktop and server applications. Both Intel and AMD, the 2 dominant players for CPUs in the PC market both use the x86 architecture.

Embedded systems are very different and obviously have different purposes. ARM (standing for Advanced RISC Machine) architecture is designed to be as basic as possible to maximize energy efficiency. It has a more basic instruction set, RISC (Reduced Instruction Set Computer), which utilizes less energy. Therefore, it is used heavily in devices where energy concerns are very important, such as embedded devices which mostly run on batteries. This includes smartphones and tablets.

A good article that describes these differences is shown at the following link, ARM vs Intel Processors.

If you're an embedded programmer and your target device architecture is different than your host machine, it's ok.

Many programmers use the host machine to first check that the code runs well and without any errors. So running the code locally on the host machine serves for this purpose.

But then once you want to run the code on the target device, this is when you have to have the cross-compiler toolchain compile the code, so that it's compatible with the target host architecture.

So both the native compiler and the cross-chain compiler serve their purpose.

So if you are just looking to find out what native gcc compiler is installed on your linux system, this can be obtained through the line of code shown below.





Running this on my PC gives me the following output shown below.


Checking the version of the native gcc compiler in linux


You can see that the native gcc compiler for our host machine is Ubuntu 9.4.0.

If you're interested in finding out how to find out the version of a cross-compilation toolchain on your system, we've written an article on this which you can find at the following link, How to Check the Version of a Cross-Compilation ToolChain Installed in Linux

So this is how to check the version of the native gcc compiler installed in linux.



Related Resources





HTML Comment Box is loading comments...