From 1eba49357bb42c6e17dd521c1bb439987869d0a1 Mon Sep 17 00:00:00 2001 From: Niklas Dewally Date: Tue, 25 Jun 2024 21:24:10 +0100 Subject: [PATCH] fix: broken nightly builds In recent versions of the nightly / beta compilers, the use of linkme causes linker errors. (dtolnay/linkme#94) This is due to the new linker set as default in these versions. Add linker flags to nightly builds to revert to the old linker behaviour. See: - dtolnay/linkme#88 - https://blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html Signed-off-by: Niklas Dewally --- .github/workflows/code-coverage-main.yml | 4 ++++ .github/workflows/code-coverage.yml | 4 ++++ .github/workflows/test.yml | 6 +++++- readme.md | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code-coverage-main.yml b/.github/workflows/code-coverage-main.yml index 8060378fb1..50da0d7dd1 100644 --- a/.github/workflows/code-coverage-main.yml +++ b/.github/workflows/code-coverage-main.yml @@ -27,6 +27,10 @@ jobs: - name: Install rust ${{ env.rust_release }} run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} + - name: Disable rust-lld (to fix linkme) + run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zlinker-features=-lld >> $GITHUB_ENV + if: matrix.rust_release == 'nightly' + - uses: ./.github/actions/install-conjure with: os_arch: linux diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index d983307f0b..686960b92a 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -40,6 +40,10 @@ jobs: - name: Install rust ${{ env.rust_release }} run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} + + - name: Disable rust-lld (to fix linkme) + run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zlinker-features=-lld >> $GITHUB_ENV + if: matrix.rust_release == 'nightly' - uses: ./.github/actions/install-conjure with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d59d163835..ec99c9ca77 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ on: env: SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: "sccache" - SCCACHE_GHA_VERSION: 2 + SCCACHE_GHA_VERSION: 4 jobs: build-and-test: @@ -54,6 +54,10 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + - name: Disable rust-lld (to fix linkme) + run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zlinker-features=-lld >> $GITHUB_ENV + if: matrix.rust_release == 'nightly' + - run: rustup update ${{ matrix.rust_release }} && rustup default ${{ matrix.rust_release }} - run: cargo build -vv --workspace diff --git a/readme.md b/readme.md index dc829b0e75..70daa85d71 100644 --- a/readme.md +++ b/readme.md @@ -13,6 +13,20 @@ This repository hosts the following projects: This project is being produced by staff and students of University of St Andrews, and is licenced under the [MPL 2.0](./LICENCE). +## Rust Nightly Support + +The following compiler flags are required for Conjure-Oxide to work with +Nightly Rust: + +```sh +export RUSTFLAGS="-Zlinker-features=-lld" +cargo build <...> +``` + +This is because of current incompatibilities with linkme and the new default +linker ([link](https://github.com/dtolnay/linkme/issues/94)). + + ## Documentation API documentation can be found [here](https://conjure-cp.github.io/conjure-oxide/docs/).