From 8d428026db8a8d4434d3db50e982ad65a98fdeb3 Mon Sep 17 00:00:00 2001 From: Justin W Smith <103147162+justsmth@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:03:07 -0400 Subject: [PATCH] Fix for older GCC < 8.1.0 (#520) * Fix for older GCC * Fix CI cross test (x86_64-unknown-linux-gnu) --- .github/workflows/analysis.yml | 7 ++++-- .github/workflows/cross.yml | 33 +++++++++++++++++++++++++++++ Cross.toml.x86_64-unknown-linux-gnu | 0 aws-lc-sys/builder/cc_builder.rs | 14 ++++++++---- 4 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 Cross.toml.x86_64-unknown-linux-gnu diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 3a0dac562f1..0f105473c77 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -241,6 +241,9 @@ jobs: if: github.repository_owner == 'aws' name: Resolve the dependencies to the minimum SemVer version runs-on: ubuntu-latest + strategy: + matrix: + crate: [ 'aws-lc-rs', 'aws-lc-sys', 'aws-lc-fips-sys' ] steps: - uses: actions/checkout@v3 with: @@ -253,10 +256,10 @@ jobs: - name: Set Rust toolchain override run: rustup override set ${{ steps.toolchain.outputs.name }} - name: Setup to use minimal versions - working-directory: ./aws-lc-rs + working-directory: ./${{ matrix.crate }} run: cargo update -Z minimal-versions - name: Build with minimal versions - working-directory: ./aws-lc-rs + working-directory: ./${{ matrix.crate }} run: cargo --locked check copyright: diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml index ea0984304bf..09425941acd 100644 --- a/.github/workflows/cross.yml +++ b/.github/workflows/cross.yml @@ -70,6 +70,39 @@ jobs: - name: Cross-compilation (test release) run: cross test -p aws-lc-rs --release --features unstable --target ${{ matrix.target }} + + aws-lc-rs-cross-0_2_5-test: + if: github.repository_owner == 'aws' + name: cross tests ${{ matrix.target }} + runs-on: ubuntu-latest + env: + CROSS_CONFIG: './Cross.toml.x86_64-unknown-linux-gnu' + strategy: + fail-fast: false + matrix: + target: + - x86_64-unknown-linux-gnu + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 'stable' + - name: Install cross + run: cargo install cross --locked --version 0.2.5 + - uses: dtolnay/rust-toolchain@master + id: toolchain + with: + toolchain: 'stable' + target: ${{ matrix.target }} + - name: Set Rust toolchain override + run: rustup override set ${{ steps.toolchain.outputs.name }} + - name: Cross-compilation (build debug) + run: cross build -p aws-lc-rs --features unstable --target ${{ matrix.target }} + - name: Cross-compilation (test release) + run: cross test -p aws-lc-rs --release --features unstable --target ${{ matrix.target }} + aws-lc-rs-ios-aarch64: if: github.repository_owner == 'aws' name: iOS aarch64 cross-platform build diff --git a/Cross.toml.x86_64-unknown-linux-gnu b/Cross.toml.x86_64-unknown-linux-gnu new file mode 100644 index 00000000000..e69de29bb2d diff --git a/aws-lc-sys/builder/cc_builder.rs b/aws-lc-sys/builder/cc_builder.rs index c7dfe9285ae..0a017648b32 100644 --- a/aws-lc-sys/builder/cc_builder.rs +++ b/aws-lc-sys/builder/cc_builder.rs @@ -125,10 +125,16 @@ impl CcBuilder { match opt_level.as_str() { "0" | "1" | "2" => {} _ => { - cc_build.flag(format!( - "-ffile-prefix-map={}=", - self.manifest_dir.display() - )); + let file_prefix_map_option = + format!("-ffile-prefix-map={}=", self.manifest_dir.display()); + if let Ok(true) = cc_build.is_flag_supported(&file_prefix_map_option) { + cc_build.flag(file_prefix_map_option); + } else { + cc_build.flag_if_supported(format!( + "-fdebug-prefix-map={}=", + self.manifest_dir.display() + )); + } } }