Setting Up the Environment
Hardware Environment
Table 1 shows the compiler hardware configurations.
Software Environment
Table 2 shows the compiler software configurations.
Installing JDK
- Download the JDK installation package and decompress it to the installation directory.
1 2
wget https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u282-b08/OpenJDK8U-jdk_aarch64_linux_hotspot_jdk8u282-b08.tar.gz tar -zxf OpenJDK8U-jdk_aarch64_linux_hotspot_jdk8u282-b08.tar.gz -C /usr/local
- Configure the JDK environment variables.
1vim /etc/profileAdd the JDK path to the profile file.
1 2
export JAVA_HOME=/usr/local/jdk8u282-b08 export PATH=$JAVA_HOME/bin:${PATH}
- Make the environment variables take effect.
1source /etc/profile
- Check the JDK version.
1java -version
Installing Maven
- Download and install the installation package to a directory (for example, /opt/tools/installed).
1 2 3
wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz tar -zxf apache-maven-3.6.3-bin.tar.gz mv apache-maven-3.6.3 /opt/tools/installed/
- Modify the Maven environment variables.
1vim /etc/profileAdd the following code at the end of the /etc/profile file:1 2
export MAVEN_HOME=/opt/tools/installed/apache-maven-3.6.3 export PATH=$MAVEN_HOME/bin:$PATH
- Make the environment variables take effect.
1source /etc/profile
- Check whether the configuration takes effect.
1mvn -v
- Modify the local repository path and remote repository in the Maven configuration file.
Configuration file path: /opt/tools/installed/apache-maven-3.6.3/conf/settings.xml
The default local repository directory is ~/.m2/. If you want to change the directory, modify the localRepository tag. You do not need to modify this parameter unless otherwise specified.
Add the following content to the <mirrors> tag to configure the remote repository (change the repository to the Maven repository that you have built. If the Maven repository does not exist, configure it based on the following example):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<mirrors> <id>mirrors.huaweicloud.com</id> <url>https://mirrors.huaweicloud.com/kunpeng/maven</url> <name>mirrors huaweicloud com</name> <snapshots> <enabled>false</enabled> </snapshots> </mirrors> <mirrors> <id>repository.huaweicloud.com</id> <url>https://mirrors.huaweicloud.com/repository/maven</url> <name>repository huaweicloud com</name> <snapshots> <enabled>false</enabled> </snapshots> </mirrors>
If a proxy is used, add the proxy configuration to the settings.xml file. The details are as follows:
1 2 3 4 5 6 7 8 9 10 11 12
<proxies> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>[Username]</username> <password>[Password]</password> <host>[Proxy server URL]</host> <port>[Proxy server port]</port> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> </proxies>
When Maven is used for build, you are advised to use mvn installed by the local Maven instead of build/mvn, because build/mvn will run the zinc service, which may expose the build machine information.
Installing GCC-7.3.0
- Download the installation package and install Maven to a directory (for example, /opt/tools/installed/).
cd /opt/tools/installed/
- Download the GCC-7.3.0 source package.
wget https://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz
- Decompress the source package.
tar -xf gcc-7.3.0.tar.gz
- Go to the source code directory.
cd gcc-7.3.0
- Install bzip2.
yum install -y bzip2
- Download the dependency.
./contrib/download_prerequisites
Ensure that the network is connected. If the download fails, you can manually download the file.
wget http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 wget http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 wget http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz wget http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2
After the manual download is complete, run the script again.
./contrib/download_prerequisites
- Edit the configuration.
./configure --enable-languages=c,c++ --disable-multilib --with-system-zlib --prefix=/usr/local/gcc7.3.0
- Perform compilation and installation.
make -j15 make install
- Configure environment variables in the /etc/profile file.
vim /etc/profile
- Add the following content to the last line of the file:
export LD_LIBRARY_PATH=/usr/local/gcc7.3.0/lib64:${LD_LIBRARY_PATH} export CC=/usr/local/gcc7.3.0/bin/gcc export CXX=/usr/local/gcc7.3.0/bin/g++ - Press Esc to exit the edit mode and save the modification.
:wq
- Make the environment variables take effect.
source /etc/profile
- Verify the installation.
gcc -v

g++ -v

The installation path depends on the preceding configurations. You only need to pay attention to the version number.