From 1be011e43aaa2e736d2a00e8f89ab79388e4a9c2 Mon Sep 17 00:00:00 2001 From: chubei <914745487@qq.com> Date: Mon, 25 Sep 2023 20:58:30 +0800 Subject: [PATCH] fix: Add `BINDGEN_EXTRA_CLANG_ARGS` to cross compile rocksdb --- .github/workflows/release.yaml | 48 ++++++++++++++++------------------ 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c7be7ae4dc..69e9f89266 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -66,36 +66,30 @@ jobs: release-linux-aarch64: name: Release Linux binary for aarch64 - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20-16-cores needs: prepare - strategy: - fail-fast: false - matrix: - include: - - build: aarch64 - os: ubuntu-20-16-cores - target: aarch64-unknown-linux-gnu - linker: gcc-aarch64-linux-gnu - use-cross: true - file_name: dozer - asset_name: dozer-linux-aarch64 + env: + CARGO_TARGET: aarch64-unknown-linux-gnu + DEB_NAME: dozer-linux-aarch64 steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Install minimal stable with clippy and rustfmt uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable - target: ${{ matrix.target }} + target: ${{ env.CARGO_TARGET }} components: rustfmt, clippy + - name: APT update run: | sudo apt update + - name: Install target specific tools - if: matrix.use-cross run: | - sudo apt-get install -y ${{ matrix.linker }} + sudo apt-get install -y gcc-aarch64-linux-gnu clang - name: Install Protoc uses: arduino/setup-protoc@v1 @@ -119,17 +113,19 @@ jobs: ${{ runner.os }}-cargo-release- - name: Configure target aarch64 GNU - if: matrix.target == 'aarch64-unknown-linux-gnu' run: | echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config echo 'JEMALLOC_SYS_WITH_LG_PAGE=16' >> $GITHUB_ENV + - name: Cargo build uses: actions-rs/cargo@v1 + env: + BINDGEN_EXTRA_CLANG_ARGS: '--sysroot /usr/aarch64-linux-gnu/include/' # https://github.com/rust-lang/rust-bindgen/issues/1229 with: command: build use-cross: false - args: --release --target ${{ matrix.target }} --bin ${{ matrix.file_name }} + args: --release --target ${{ env.CARGO_TARGET }} --bin dozer - name: List target output files run: ls -lR ./target @@ -137,28 +133,28 @@ jobs: run: cargo install cargo-deb - name: Compile deb file - run: cargo-deb -p dozer-cli --target ${{ matrix.target }} --output ./deb/${{matrix.asset_name}}.deb + run: cargo-deb -p dozer-cli --target ${{ env.CARGO_TARGET }} --output ./deb/${{ env.DEB_NAME }}.deb - name: Prepare release assets shell: bash run: | mkdir -p release cp {LICENSE,README.md,CHANGELOG.md} release/ 2> /dev/null || echo "Copy Failed...Ignoring.." - cp target/${{ matrix.target }}/release/${{matrix.file_name}} release/ + cp target/${{ env.CARGO_TARGET }}/release/dozer release/ - mv release/ ${{matrix.asset_name}}/ + mv release/ ${{ env.DEB_NAME }}/ - tar -czvf ${{matrix.asset_name}}.tar.gz ${{matrix.asset_name}}/ + tar -czvf ${{ env.DEB_NAME }}.tar.gz ${{ env.DEB_NAME }}/ - cp deb/${{matrix.asset_name}}.deb ${{matrix.asset_name}}/ + cp deb/${{ env.DEB_NAME }}.deb ${{ env.DEB_NAME }}/ - ls -l ${{matrix.asset_name}} + ls -l ${{ env.DEB_NAME }} - name: Upload the release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{matrix.asset_name}}* + file: ${{ env.DEB_NAME }}* file_glob: true overwrite: true tag: ${{ needs.prepare.outputs.version }} @@ -169,10 +165,10 @@ jobs: - name: Set env variables env: VERSION: ${{ needs.prepare.outputs.version }} - RELEASE_NAME: ${{matrix.asset_name}}.tar.gz + RELEASE_NAME: ${{ env.DEB_NAME }}.tar.gz run: | echo "RELEASE_NAME=${{env.RELEASE_NAME}}" >> $GITHUB_ENV - echo "DEB_NAME=${{matrix.asset_name}}.deb" >> $GITHUB_ENV + echo "DEB_NAME=${{ env.DEB_NAME }}.deb" >> $GITHUB_ENV echo "VERSION=${{env.VERSION}}" >> $GITHUB_ENV echo "ARTIFACT_URL=https://${{ env.BUCKET_NAME }}.s3.ap-southeast-1.amazonaws.com/${{ env.VERSION }}/${{ env.RELEASE_NAME }}" >> $GITHUB_ENV