Compiling the Source Code
- Download the flink-release-1.9.1 source package and decompress it.
1 2
wget https://github.com/apache/flink/archive/release-1.9.1.tar.gz tar -zxf release-1.9.1.tar.gz
- Go to the directory generated after the decompression.
1cd flink-release-1.9.1
- Add the reference to the Kunpeng repository to the flink-release-1.9.1/pom.xml file.
- Open the file.
1vi pom.xml - Press i to enter the insert mode and add the Kunpeng Maven repository source to the first place of the <repositories> tag.
1 2 3 4 5
<repository> <id>kunpengmaven</id> <name>kunpeng maven</name> <url>https://mirrors.huaweicloud.com/kunpeng/maven</url> </repository>

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Add the reference to the Kunpeng repository to the flink-release-1.9.1/flink-dist/pom.xml file.
- Open the file.
1vi flink-dist/pom.xml - Press i to enter the insert mode and add the Kunpeng Maven repository source to the first place of the <repositories> tag.
1 2 3 4 5 6 7
<repositories> <repository> <id>kunpengmaven</id> <name>kunpeng maven</name> <url>https://mirrors.huaweicloud.com/kunpeng/maven</url> </repository> </repositories>

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Add the reference of the Kunpeng repository to the flink-release-1.9.1/flink-state-backends/flink-statebackend-rocksdb/pom.xml file.
- Open the file.
1vi flink-state-backends/flink-statebackend-rocksdb/pom.xml - Press i to enter the insert mode and add the Kunpeng Maven repository source to the first place of the <repositories> tag.
1 2 3 4 5 6 7
<repositories> <repository> <id>kunpengmaven</id> <name>kunpeng maven</name> <url>https://mirrors.huaweicloud.com/kunpeng/maven</url> </repository> </repositories>

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Add the reference to the Kunpeng repository to the flink-runtime/pom.xml file.
- Open the file.
1vi flink-runtime/pom.xml - Press i to enter the insert mode and add the Kunpeng Maven repository source to the first place of the <repositories> tag.
1 2 3 4 5 6 7
<repositories> <repository> <id>kunpengmaven</id> <name>kunpeng maven</name> <url>https://mirrors.huaweicloud.com/kunpeng/maven</url> </repository> </repositories>

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Perform the compilation in the flink-release-1.9.1 directory.
1mvn install -DskipTests -Dtar -Dhadoop.version=2.8.3
The following figure shows that the compilation is successful.

After the compilation is complete, the directory flink-1.9.1 is generated in flink-release-1.9.1/flink-dist/target/flink-1.9.1-bin/.
- Use the Kunpeng Porting Advisor to scan the .tar package generated after the compilation and ensure that the .tar package does not contain the x86 .so or .jar packages.
- The compiled Flink package must be scanned by using the Kunpeng Porting Advisor to ensure that no x86 .so or .jar packages are contained. If the compiled package contains x86 .so or .jar packages, the component functions may be affected.
- For details about how to use the Kunpeng Porting Advisor, see Kunpeng Porting Advisor Case Study.
Parent topic: Porting Guide (CentOS & openEuler)