Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI for ARM #425

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .github/workflows/m68k.yml → .github/workflows/cross.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TODO: check if qemu-user-static-binfmt is needed (perhaps to run some tests since it probably calls exec).

name: m68k CI
name: Cross-compilation CI

on:
- push
Expand All @@ -12,8 +12,6 @@ permissions:
env:
# Enable backtraces for easier debugging
RUST_BACKTRACE: 1
# TODO: remove when confish.sh is removed.
OVERWRITE_TARGET_TRIPLE: m68k-unknown-linux-gnu

jobs:
build:
Expand All @@ -22,6 +20,10 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [
"m68k",
"arm",
]
commands: [
"--mini-tests",
"--std-tests",
Expand Down Expand Up @@ -51,20 +53,20 @@ jobs:
sudo apt-get install qemu qemu-user-static

- name: Download artifact
run: curl -LO https://github.com/cross-cg-gcc-tools/cross-gcc/releases/latest/download/gcc-m68k-13.deb
run: curl -LO https://github.com/cross-cg-gcc-tools/cross-gcc/releases/latest/download/gcc-${{ matrix.arch }}-13.deb

- name: Download VM artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: m68k.yml
name: debian-m68k
workflow: ${{ matrix.arch }}.yml
name: debian-${{ matrix.arch }}
repo: cross-cg-gcc-tools/vms
branch: master
event: push

- name: Setup path to libgccjit
run: |
sudo dpkg -i gcc-m68k-13.deb
sudo dpkg -i gcc-${{ matrix.arch }}-13.deb
echo /usr/lib/ > gcc_path

- name: Set env
Expand All @@ -85,16 +87,16 @@ jobs:
- name: Prepare VM
run: |
mkdir vm
sudo mount debian-m68k.img vm
sudo cp $(which qemu-m68k-static) vm/usr/bin/
sudo mount debian-${{ matrix.arch }}.img vm
sudo cp $(which qemu-${{ matrix.arch }}-static) vm/usr/bin/

- name: Build
run: |
./y.sh prepare --only-libcore --cross
# TODO: remove --features master when it is back to the default.
./y.sh build --target-triple m68k-unknown-linux-gnu --features master
./y.sh build --target-triple ${{ matrix.arch }}-unknown-linux-gnu --features master
# TODO: remove --features master when it is back to the default.
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test --features master
CG_GCC_TEST_TARGET=${{ matrix.arch }}-unknown-linux-gnu cargo test --features master
./y.sh clean all

- name: Prepare dependencies
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ generate it in [gimple.md](./doc/gimple.md).
* Run `./y.sh prepare --cross` so that the sysroot is patched for the cross-compiling case.
* Set the path to the cross-compiling libgccjit in `gcc_path`.
* Make sure you have the linker for your target (for instance `m68k-unknown-linux-gnu-gcc`) in your `$PATH`. Currently, the linker name is hardcoded as being `$TARGET-gcc`. Specify the target when building the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu`.
* Build your project by specifying the target: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target m68k-unknown-linux-gnu`.
* Build your project by specifying the target: `../y.sh cargo build --target m68k-unknown-linux-gnu`.

If the target is not yet supported by the Rust compiler, create a [target specification file](https://docs.rust-embedded.org/embedonomicon/custom-target.html) (note that the `arch` specified in this file must be supported by the rust compiler).
Then, you can use it the following way:

* Add the target specification file using `--target` as an **absolute** path to build the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu --target $(pwd)/m68k-unknown-linux-gnu.json`
* Build your project by specifying the target specification file: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`.
* Build your project by specifying the target specification file: `../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`.

If you get the following error:

Expand Down
5 changes: 0 additions & 5 deletions build_system/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ impl ConfigInfo {
None => return Err("no host found".to_string()),
};

if self.target_triple.is_empty() {
if let Some(overwrite) = env.get("OVERWRITE_TARGET_TRIPLE") {
self.target_triple = overwrite.clone();
}
}
if self.target_triple.is_empty() {
self.target_triple = self.host_triple.clone();
}
Expand Down