This article describes a method using the latest ARM development environment to build C ++ compiler on a Linux host.
Install Ubuntu host
Install the virtual machine software
Download the latest VirtualBox from VitualBox official website.
https://www.virtualbox.org/wiki/Downloads
The determined specific installation packages of the operating system being used.
Install Ubuntu operating system
Download and install Ubuntu
Cross-compiler environment we have chosen the latest Ubuntu operating system, which can be downloaded from the following address:
https://ubuntu.com/#download
The following illustrates an example to Ubuntu Desktop 19.10, 18.04 no problem.
Configure the network
Due to the need to develop a shared directory, so the virtual machine's network is set to "bridge card" mode.
Software installation cross compiler (gcc / g ++)
Modify the mirror server list
Open the installation package file server list:
sudo vi /etc/apt/sources.list
It increases the mirror server
In the last srouce.list add the following:
deb http://th.archive.ubuntu.com/ubuntu bionic-updates main universe
Install g ++ / gcc
sudo apt-get install gcc-8-arm-linux-gnueabi
sudo apt-get install g++-8-arm-linux-gnueabi
It confirms the installation results
Enter the following command at an arbitrary installation position confirmation gcc-8-arm of:
arm-linux-gnueabi-gcc -v
When properly installed gcc cross-compiler, you should appear the following information:
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabi/8/lto-wrapper
Target: arm-linux-gnueabi
...
gcc version 8.3.0 (Ubuntu/Linaro 8.3.0-23ubuntu2)
The main concern version information COLLECT_GCC information on the second line and the last line (versions may differ slightly).
In the same manner as confirmation g ++ - 8 mounted Results:
arm-linux-gnueabi-g++ -v
When properly installed g ++ cross compiler, you should appear the following information:
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabi/8/lto-wrapper
Target: arm-linux-gnueabi
...
gcc version 8.3.0 (Ubuntu/Linaro 8.3.0-23ubuntu2)
The main concern version information COLLECT_GCC information on the second line and the last line (versions may differ slightly).
Reference Information:
gcc-8:
https://packages.ubuntu.com/bionic-updates/amd64/gcc-8-arm-linux-gnueabi/download
g++-8:
https://packages.ubuntu.com/bionic-updates/amd64/g++-8-arm-linux-gnueabi/download
Install Eclipse CDT
Download EclipseCDT
Go to the following pages:
https://www.eclipse.org/downloads/packages/
Choice FIG red frame Eclipse IDE for C / C ++ Developers:
Due to this development environment running on Ubuntu, so select [Linux 64-bit] to download.
Installation EclipseCDT
Using the following command in place decompressor installation package (it may show slightly different).
tar -zxvf eclipse-cpp-2019-12-R-linux-gtk-x86_64.tar.gz
The resulting compressed into overtime eclipse directory, start eclipse:
./eclipse
If you can not successfully start, it is the general environment does not have Java, you can install on their own jre or jdk.
The establishment of cross-compiling project
Building project
The resulting compressed into overtime eclipse directory, start eclipse:
./eclipse
FIG selected as the working directory and press [the Launch] button:
Create a new project by selecting menu as follows:
[File]-[New]-[Project]
Select [C / C ++ Project] as the project type, the next step:
After selecting [C ++ ManagedBuild], the next step:
After selecting [Cross GCC] to the next step:
Directly to the next step:
In the following cross compiler configuration screen, after pressing [Finish] end.
Configuring Content:
1. [Cross compiler prefix] edit box [arm-linux-gnueabi-]
2. [Cross complier path:] project selection [\ usr \ bin].
Written verification program
Refer to the following picture shows arm_cpp add arm_cpp.cpp project file:
Edit the following:
#include<iostream>
int main()
{
std::cout << "Hello GCC/G++ Compiler!" << std::endl;
return 0;
}
Compile arm_cpp project through the following menu:
[Project]-[Build Project]
Appears in the following column eclipse of the Console () says you're done!
16:29:17 **** Build of configuration Debug for project arm_cpp ****
make all
Building file: ../arm.cpp
Invoking: Cross G++ Compiler
arm-linux-gnueabi-g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"arm.d" -MT"arm.o" -o "arm.o" "../arm.cpp"
Finished building: ../arm.cpp
Building target: arm_cpp
Invoking: Cross G++ Linker
arm-linux-gnueabi-g++ -o "arm_cpp" ./arm.o
Finished building target: arm_cpp
16:29:17 Build Finished. 0 errors, 0 warnings. (took 382ms)
I think this article helpful? Welcome thumbs up and share it with more people.
Read more updated articles, please pay attention to micro-channel public number of object-oriented thinking []