From 12fa524c3f4ecfc0e7bd3d8635c8ac761fe8e98a Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Tue, 2 Apr 2024 11:26:36 +0800 Subject: [PATCH] feat use qemu-user-binfmt --- .gitea/workflows/linux-aarch64-gcc.yml | 37 +---------- .gitea/workflows/linux-arm-gcc.yml | 87 ++------------------------ .gitea/workflows/linux-mips64-gcc.yml | 38 +---------- 3 files changed, 10 insertions(+), 152 deletions(-) diff --git a/.gitea/workflows/linux-aarch64-gcc.yml b/.gitea/workflows/linux-aarch64-gcc.yml index 83dd312..a44fe88 100644 --- a/.gitea/workflows/linux-aarch64-gcc.yml +++ b/.gitea/workflows/linux-aarch64-gcc.yml @@ -31,41 +31,10 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 - - name: cache-qemu - id: cache-qemu - uses: actions/cache@v4 - with: - path: qemu-install - key: qemu-aarch64-install-20220502-ubuntu-2004-2 - - name: install-qemu-build-deps - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - sudo apt-get update -y - sudo apt-get install -y autoconf automake autotools-dev ninja-build - - name: checkout-qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - mkdir qemu && cd qemu - git init - git remote add origin https://gitlab.com/qemu-project/qemu.git - git fetch --depth=1 origin f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - git checkout f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - # uses: actions/checkout@v4 - # with: - # repository: qemu/qemu - # path: qemu - # ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - - name: qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - cd qemu - ./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=aarch64-linux-user --disable-system - make -j$(nproc) - make install - name: aarch64-gnu-toolchain run: | sudo apt-get update -y - sudo apt-get install -y cmake make g++-aarch64-linux-gnu + sudo apt-get install -y cmake make g++-aarch64-linux-gnu qemu-user-binfmt - name: build run: | mkdir build && cd build @@ -73,9 +42,7 @@ jobs: cmake --build . -j $(nproc) - name: test run: |- - export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH cd build ln -sf /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1 export LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib - qemu-aarch64 ctest --output-on-failure -j$(nproc) - # TESTS_EXECUTABLE_LOADER=qemu-aarch64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/aarch64-linux-gnu" ctest --output-on-failure -j $(nproc) + ctest --output-on-failure -j$(nproc) diff --git a/.gitea/workflows/linux-arm-gcc.yml b/.gitea/workflows/linux-arm-gcc.yml index 538e375..9ae60ed 100644 --- a/.gitea/workflows/linux-arm-gcc.yml +++ b/.gitea/workflows/linux-arm-gcc.yml @@ -31,47 +31,10 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 - - name: cache-qemu - id: cache-qemu - uses: actions/cache@v4 - with: - path: qemu-install - key: qemu-arm-install-20220502-2 - - name: install-qemu-build-deps - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - sudo apt-get update -y - sudo apt-get install -y autoconf automake autotools-dev ninja-build - - name: checkout-qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - mkdir qemu && cd qemu - git init - git remote add origin https://gitlab.com/qemu-project/qemu.git - git fetch --depth=1 origin f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - git checkout f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - # uses: actions/checkout@v4 - # with: - # repository: qemu/qemu - # path: qemu - # ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - - name: qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - cd qemu - ./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=arm-linux-user --disable-system - make -j$(nproc) - make install - - name: set-qemu-cache - uses: actions/cache/save@v3 - if: steps.cache-qemu.outputs.cache-hit != 'true' - with: - key: qemu-arm-install-20220502-2 - path: qemu-install - name: arm-gnu-toolchain run: | sudo apt-get update -y - sudo apt-get install -y cmake make g++-arm-linux-gnueabi + sudo apt-get install -y cmake make g++-arm-linux-gnueabi qemu-static - name: build run: | mkdir build && cd build @@ -79,56 +42,18 @@ jobs: cmake --build . -j $(nproc) - name: test run: | - export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH cd build + ln -sf /usr/arm-linux-gnueabi/lib/ld-linux.so.3 export LD_LIBRARY_PATH=/usr/arm-linux-gnueabi/lib qemu-arm ctest --output-on-failure -j$(nproc) - # TESTS_EXECUTABLE_LOADER=qemu-arm TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/arm-linux-gnueabi" ctest --output-on-failure -j $(nproc) linux-gcc-armhf: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 - - name: cache-qemu - id: cache-qemu - uses: actions/cache@v4 - with: - path: qemu-install - key: qemu-arm-install-20220502-2 - - name: install-qemu-build-deps - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - sudo apt-get update -y - sudo apt-get install -y autoconf automake autotools-dev ninja-build - - name: checkout-qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - mkdir qemu && cd qemu - git init - git remote add origin https://gitlab.com/qemu-project/qemu.git - git fetch --depth=1 origin f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - git checkout f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - # uses: actions/checkout@v4 - # with: - # repository: qemu/qemu - # path: qemu - # ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - - name: qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - cd qemu - ./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=arm-linux-user --disable-system - make -j$(nproc) - make install - - name: set-qemu-cache - uses: actions/cache/save@v3 - if: steps.cache-qemu.outputs.cache-hit != 'true' - with: - key: qemu-arm-install-20220502-2 - path: qemu-install - name: arm-gnu-toolchain run: | sudo apt-get update -y - sudo apt-get install -y cmake make g++-arm-linux-gnueabihf + sudo apt-get install -y cmake make g++-arm-linux-gnueabihf qemu-user-binfmt - name: build run: | mkdir build && cd build @@ -136,9 +61,7 @@ jobs: cmake --build . -j $(nproc) - name: test run: |- - export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH cd build ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux-armhf.so.3 - export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib - qemu-arm ctest --output-on-failure -j$(nproc) - # TESTS_EXECUTABLE_LOADER=qemu-arm TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/arm-linux-gnueabihf" ctest --output-on-failure -j $(nproc) + export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib/ + ctest --output-on-failure -j$(nproc) diff --git a/.gitea/workflows/linux-mips64-gcc.yml b/.gitea/workflows/linux-mips64-gcc.yml index 52cd879..f5112a0 100644 --- a/.gitea/workflows/linux-mips64-gcc.yml +++ b/.gitea/workflows/linux-mips64-gcc.yml @@ -35,43 +35,10 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - name: cache-qemu - id: cache-qemu - uses: actions/cache@v3 - with: - path: qemu-install - key: qemu-mips64el-install-20220502-2 - - name: checkout-qemu - # uses: actions/checkout@v4 - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - mkdir qemu && cd qemu - git init - git remote add origin https://gitlab.com/qemu-project/qemu.git - git fetch --depth=1 origin f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - git checkout f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 - - name: install-qemu-build-deps - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - sudo apt-get update -y - sudo apt-get install -y autoconf automake autotools-dev ninja-build - - name: qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - cd $GITHUB_WORKSPACE/qemu - ./configure --target-list=mips64el-linux-user --prefix=$GITHUB_WORKSPACE/qemu-install - make -j `nproc` - make install - - name: set-qemu-cache - uses: actions/cache/save@v3 - if: steps.cache-qemu.outputs.cache-hit != 'true' - with: - key: qemu-mips64el-install-20220502-2 - path: qemu-install - name: mips64el-gnuabi64-toolchain run: | sudo apt-get update -y - sudo apt-get install -y cmake make g++-mips64el-linux-gnuabi64 + sudo apt-get install -y cmake make g++-mips64el-linux-gnuabi64 qemu-user-binfmt - name: configure run: | mkdir build && cd build @@ -80,6 +47,7 @@ jobs: run: cmake --build build --target all -j `nproc` - name: test run: |- - export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH cd build + ln -sf /usr/mips64el-linux-gnuabi64/lib/ld-2.30.so /lib/ld-2.30.so + export LD_LIBRARY_PATH=/usr/mips64el-linux-gnuabi64/lib/:/usr/mips64el-linux-gnuabi64/lib64/ ctest --output-on-failure -j`nproc`