uraimo / run-on-arch-action

A Github Action that executes jobs/commands on non-x86 cpu architectures (ARMv6, ARMv7, aarch64, s390x, ppc64le, riscv64) via QEMU
BSD 3-Clause "New" or "Revised" License
682 stars 151 forks source link

The process '/home/runner/work/_actions/uraimo/run-on-arch-action/v2/src/run-on-arch.sh' failed #114

Open try-agaaain opened 1 year ago

try-agaaain commented 1 year ago

I want to build the project on the aarch64 platform, but the following error occurs:

image

Weird, the platform I set is aarch64, but it shows x86_64 here?

Below is my workflow:

on: [push, pull_request]

jobs:
  build_job:
    # The host should always be linux
    runs-on: ubuntu-22.04
    name: Build on ${{ matrix.distro }} ${{ matrix.arch }}

    # Run steps on a matrix of 4 arch/distro combinations
    strategy:
      matrix:
        include:
          - arch: aarch64
            distro: ubuntu22.04
    steps:
      - uses: actions/checkout@v3
      - uses: uraimo/run-on-arch-action@v2
        name: Build artifact
        id: build
        with:
          arch: aarch64
          distro: ubuntu22.04

          # Not required, but speeds up builds
          githubToken: ${{ github.token }}

          # Create an artifacts directory
          setup: |
            echo "my info: " `uname -a`

          # Mount the artifacts directory as /artifacts in the container
          dockerRunArgs: |
            -v /usr/bin/:/usr/bin/
          install: |
            echo "my info: " `uname -a`
            apt-get update && \
            apt-get install -y --no-install-recommends libelf1 libelf-dev \
                zlib1g-dev clang llvm libclang-13-dev make cmake git cargo wget tar curl && \
            apt-get install -y --no-install-recommends ca-certificates  && \
            update-ca-certificates  && \
            apt-get clean && \
            curl https://sh.rustup.rs -sSf | sh -s -- -y    && \
            rm -rf /var/lib/apt/lists/*
            mkdir /src && cd /src
            git clone https://github.com/eunomia-bpf/eunomia-bpf.git && cd eunomia-bpf
            git submodule update --init --recursive --remote
            echo "my info: get the whole repo!"
            cd ecli && make build
            cp /src/eunomia-bpf/ecli/build/bin/Release/ecli /usr/bin/

          # Pass some environment variables to the container
          env: | # YAML, but pipe character is necessary
            artifact_name: git-${{ matrix.distro }}_${{ matrix.arch }}

          # The shell to run commands with in the container
          shell: /bin/sh

          # Produce a binary artifact and place it in the mounted volume
          run: |
            ls -af /usr/bin/ecli
uraimo commented 1 year ago

Setup runs on the x86 host, so what you see is correct, that's github CI runner. I'm not so sure about that mounting of /usr/bin/ that you do in dockerRunArgs, I would use a separate directory for artifacts. If you are building something run: is the right section to do it.

Other than this I don' seen any obvious errors in that yaml, it should work, please post a link to the job if it's still broken after the modifications above.

try-agaaain commented 1 year ago

In run-on-arch-action, are run and setup both run in the ci environment (x86_64)? And only install is run in the user-specified environment (e.g. aarch64)?

martin-g commented 1 year ago

Only run is emulated