How To Set Gcc Path In Linux
A PDF version of this guide, including project setup and debugging is available in the Documentation section.
This guide is targeted at Linux users, like instructions for Windows tin exist found here.
This guide is the showtime office of a Linux version of the guide we previously wrote dealing with setting up an embedded software toolchain within Eclipse. This guide is targeted at readers who need to ready upwardly a GCC toolchain within a vanilla Eclipse installation. This guide is written with embedded software development for MCU and SoCs in mind but can be used with any GCC toolchain regardless of the intended target. Note that there are many combinations of Eclipse versions, plugins and supporting tools that can be used to successfully build C and C++ applications using the GCC toolchain, this document is the recommended mode by JBLopen but readers are free to modify their development environment to accommodate their needs.
Setup Guide
This pace-by-footstep section volition become through the installation and configuration of the post-obit components in order:
- Eclipse – 2022.06 – eclipse-inst-linux64.tar.gz
- GCC – 9-2020q2 – gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
The versions cited above are those that were used when writing this guide. Installation instructions for newer versions, if bachelor, should be like.
Eclipse Installation
The first packet to install is the Eclipse IDE. As is usual with Linux, there'south more than i way to install Eclipse. This guide will use the official Eclipse installer from eclipse.org which will install Eclipse within the current user'southward dwelling directory. This is the simplest method and is also useful since it isolates the Eclipse installation from any native installation that may exist.
Outset past extracting the installation archive and executing the installer file. Note that if possible the 64-flake version of Eclipse is strongly recommended. In this case eclipse-inst
, the post-obit screen should appear.
Select "Eclipse IDE for C/C++ Developers" by clicking it. The install configuration screen should appear.
Set the installation directory, it is recommended to use a unique directory that is short with no spaces in the name as the eclipse install directory. In this example we will use /home/jblopen/eclipse
every bit the installation directory. The eclipse installer will automatically create an eclipse subdirectory inside the specified installation path.
Click install. Installation should start and a progress bar should be displayed.
Installation should proceed.
Launch the installation to check if it's working properly and create the beginning workspace. Practice then by clicking Launch.
The workspace selection prompt should appear.
Information technology is strongly recommended to create a unique workspace that will be used exclusively for the projects related to the GCC toolchain that will exist installed in this guide. The workspace selected should not have a path name that is excessively long and information technology is recommended not to apply spaces in the path name either. To keep everything well contained and ordered this example will use /habitation/jblopen/eclipse-workspace
as the workspace.
Click Launch.
The Eclipse welcome screen should appear.
Eclipse tin can be closed at this point as there are more packages to install before setting up the Eclipse IDE.
Toolchain Installation
This guide will use as an instance the GNU Embedded Toolchain for Cortex-R and M distributed by ARM. However the procedure should be very similar to other embedded GCC toolchains.
First the downloaded toolchain annal should be extracted to a suitable location. In this case we will create a directory named gcc in the current user dwelling house directory and then excerpt the toolchain into that directory. This tin can be washed, for example, past executing the following commands from the directory that contains the downloaded archive.
$ mkdir ~/gcc
$ tar -xvf gcc-arm-none-eabi-nine-2020-q2-update-x86_64-linux.tar.bz2 -C ~/gcc/
That's about it for the toolchain installation on Linux. Optionally, the toolchain can exist added to the PATH variable as shown in the next section.
GNU Make Installation
In improver to the toolchain and Eclipse it is usually necessary to at least have the GNU Make utility to process makefiles. This utility may already be installed, if not there's usually a bundle containing the minimal ready of applications required to build.
Under Debian, Ubuntu and many others one can simply install the build-essential packet. For example past running the following control:
$ sudo apt-get install build-essential
PATH Environment Variable Setup
Information technology is not necessary to add the toolchain to the PATH environs variable to utilise the newly installed toolchain in Eclipse. However, it can be useful for edifice straight from the command line.
One can notice that they are unremarkably two bin directories available within a GCC toolchain distribution. 1 directory contains all of the toolchain'due south executables prefixed with the target triplet, i.due east. arm-none-eabi-gcc
while the other contains generic names without the host triplets. When calculation the toolchain to the PATH surround variable, it is important to use the directory where the executables are prefixed with the target triplet. First the other directory doesn't comprise all the necessary executables, but may interfere with the Os native toolchain.
To add together the toolchain to the PATH, add or edit the post-obit line of the .bashrc
file located in the home directory of the current user. Information technology's usually a skillful thought to add information technology to the end of the listing to preclude conflicts.
export PATH=$PATH:/abode/jblopen/gcc/gcc-arm-none-eabi-9-2020-q2-update/bin
When updating the PATH variable similar this Eclipse will not see the new toolchain if Eclipse is launched from the desktop surround. This tin be stock-still past launching Eclipse from the command line, for instance:
$ nohup ./eclipse &
Additional methods of adding the toolchain to Eclipse will be discussed in the next part of this series.
Click here to read part two of this serial.
Visit the Documentation section for a PDF version of this guide including projection and debugging setup.
How To Set Gcc Path In Linux,
Source: https://www.jblopen.com/gcc-toolchain-eclipse-setup-linux-part-1/
Posted by: deanouncoung.blogspot.com
0 Response to "How To Set Gcc Path In Linux"
Post a Comment