我要评分
获取效率
正确性
完整性
易理解

Compiling the Source Code

  1. 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
    
  2. Go to the directory generated after the decompression.
    1
    cd flink-release-1.9.1
    
  3. Add the reference to the Kunpeng repository to the flink-release-1.9.1/pom.xml file.
    1. Open the file.
      1
      vi pom.xml
      
    2. 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>
      

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Add the reference to the Kunpeng repository to the flink-release-1.9.1/flink-dist/pom.xml file.
    1. Open the file.
      1
      vi flink-dist/pom.xml
      
    2. 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>
      

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. Add the reference of the Kunpeng repository to the flink-release-1.9.1/flink-state-backends/flink-statebackend-rocksdb/pom.xml file.
    1. Open the file.
      1
      vi flink-state-backends/flink-statebackend-rocksdb/pom.xml
      
    2. 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>
      

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  6. Add the reference to the Kunpeng repository to the flink-runtime/pom.xml file.
    1. Open the file.
      1
      vi flink-runtime/pom.xml
      
    2. 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>
      

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  7. Perform the compilation in the flink-release-1.9.1 directory.
    1
    mvn 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/.

  8. 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.