Skip to content

Cross building x86_64 and arm64 on a arm64 machine inside docker does not work #1628

Open
@ares-b

Description

@ares-b

Checklist

Describe your issue

Hey,

I'm running Gitea + Gitea runner on a arm64 VM hosted on Oracle Cloud.

I'm getting this error:

info: downloading component 'rust-src'
info: installing component 'rust-src'
exec /usr/bin/sh: exec format error

What target(s) are you cross-compiling for?

No response

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

0.2.5

Example

name: Rust CI

on:
  push:
    branches:
      - release-next
      - main

env:
  CARGO_TERM_COLOR: always

jobs:
  rust-ci:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        target: 
          - aarch64-unknown-linux-gnu
          - x86_64-unknown-linux-gnu

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: clippy, rustfmt
          target: ${{ matrix.target }}

      - name: Install cross
        run: cargo install cross --git https://github.com/cross-rs/cross.git
        shell: bash

      - name: Cross version
        run: cross --version
        shell: bash 
      
      - name: Check cargo fmt
        run: cargo fmt --all -- --check
        shell: bash

      - name: Build
        run: cross build --target ${{ matrix.target }}
        shell: bash

      - name: Run Tests
        run: cross test --target ${{ matrix.target }}
        shell: bash
      
      - name: Run Clippy
        run: cross clippy --target ${{ matrix.target }} -- -D warnings
        shell: bash

Additional information / notes

cross 0.2.5 (c7dee4d 2025-02-12)
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2025-01-30, rust version 1.84.1 (e71f9a9a9 2025-01-27)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-std'
info: installing component 'rustc'
stable-x86_64-unknown-linux-gnu installed - (error reading rustc version)
info: checking for self-update
info: downloading component 'rust-std' for 'aarch64-unknown-linux-gnu'
info: installing component 'rust-std' for 'aarch64-unknown-linux-gnu'
[cross] note: Falling back to cargo on the host.
cargo 1.84.1 (66221abde 2024-11-19)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions