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

Pregeneration of NASM build artifacts #491

Merged
merged 37 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
943e72e
Allow build with prebuilt NASM objects
justinwsmith May 10, 2024
a1ea63c
Symbols from ubuntu-latest
Aug 21, 2024
6012d59
Symbols from macos-13-xlarge
Aug 21, 2024
3c4f1bf
Symbols from x86_64-pc-windows-msvc
Aug 21, 2024
5286cbf
Symbols from x86_64-pc-windows-gnu
Aug 21, 2024
efbe81c
Symbols from i686-pc-windows-msvc
Aug 21, 2024
03cf516
Symbols from macos-12
Aug 21, 2024
5156523
Symbols from aarch64-pc-windows-msvc
Aug 21, 2024
e352bff
Symbols for powerpc-unknown-linux-gnu
Aug 21, 2024
77aee45
Symbols for armv7-unknown-linux-gnueabihf
Aug 21, 2024
e443efe
Symbols for i686-unknown-linux-gnu
Aug 21, 2024
d27d7d0
Symbols for arm-unknown-linux-gnueabi
Aug 21, 2024
1f4c340
Symbols for x86_64-unknown-linux-musl
Aug 21, 2024
1a8d00e
Symbols for powerpc64le-unknown-linux-gnu
Aug 21, 2024
8230eba
Symbols for aarch64-unknown-linux-gnu
Aug 21, 2024
58b361d
Symbols for aarch64-unknown-linux-musl
Aug 21, 2024
637af8d
Generated headers
Aug 21, 2024
84738bd
Generated bindings from ubuntu-latest
Aug 21, 2024
2146429
Generated bindings from macos-13-xlarge
Aug 21, 2024
5d3a3d5
Generated bindings for x86_64-pc-windows-gnu
Aug 21, 2024
0f0299f
Generated bindings for i686-pc-windows-msvc
Aug 21, 2024
a68a079
Generated bindings from macos-12
Aug 21, 2024
656318b
Generated bindings for aarch64-pc-windows-msvc
Aug 21, 2024
8df2f67
Generated bindings for x86_64-pc-windows-msvc
Aug 21, 2024
d8fd949
Generated bindings for aarch64-unknown-linux-gnu
Aug 21, 2024
4b3b4d9
Generated bindings for x86_64-unknown-linux-musl
Aug 21, 2024
ca3f1e3
Generated bindings for aarch64-unknown-linux-musl
Aug 21, 2024
71cab1b
Generated bindings for i686-unknown-linux-gnu
Aug 21, 2024
90029a3
Collected source files from ubuntu-latest
Aug 21, 2024
315fa37
Collected source files from macos-13-xlarge
Aug 21, 2024
eacaf2a
Collected source files from macos-12
Aug 21, 2024
6a22f4f
Collected NASM files
Aug 21, 2024
c5f51cd
Collected source files for x86_64-unknown-linux-musl
Aug 21, 2024
c1373cf
Collected source files for i686-unknown-linux-gnu
Aug 21, 2024
0ba5ca6
Collected source files for aarch64-unknown-linux-gnu
Aug 21, 2024
69f10f0
Collected source files for aarch64-unknown-linux-musl
Aug 21, 2024
144c689
Add copyright to prebuilt-nasm.bat
justsmth Aug 23, 2024
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
33 changes: 33 additions & 0 deletions .github/workflows/sys-bindings-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,36 @@ jobs:
run: ./scripts/build/collect_build_src.sh -t ${{ matrix.target }}
- name: Commit & Push changes
run: ./scripts/ci/ci_add_commit_rebase_push.sh "Collected source files for ${{ matrix.target }}"
collect-nasm-and-commit:
needs: generate-windows-bindings-and-commit
if: github.repository == 'aws/aws-lc-rs'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
ref: ${{ github.ref_name }}
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: stable
targets: "x86_64-pc-windows-msvc,x86_64-pc-windows-gnu"
- uses: ilammy/setup-nasm@v1
- name: Build aws-lc-sys
shell: bash
run: AWS_LC_SYS_PREBUILT_NASM=0 cargo build -p aws-lc-sys --release --target x86_64-pc-windows-msvc
- name: Collect NASM object files
shell: bash
run: ./scripts/build/collect_nasm_obj.sh
- name: Clean build
shell: bash
run: cargo clean
- name: Test aws-lc-rs for x86_64-pc-windows-msvc
shell: bash
run: AWS_LC_SYS_PREBUILT_NASM=1 cargo build -p aws-lc-sys --target x86_64-pc-windows-msvc
- name: Test aws-lc-sys for x86_64-pc-windows-gnu
shell: bash
run: AWS_LC_SYS_PREBUILT_NASM=1 cargo build -p aws-lc-sys --target x86_64-pc-windows-gnu
- name: Commit & Push changes
shell: bash
run: ./scripts/ci/ci_add_commit_rebase_push.sh "Collected NASM files"
82 changes: 57 additions & 25 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- --no-default-features --features non-fips,ring-sig-verify,unstable
- --no-default-features --features non-fips,alloc,unstable
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- --no-default-features --features aws-lc-sys,bindgen,unstable
- --release --all-targets --features bindgen,unstable
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- if: ${{ matrix.os == 'macos-13-xlarge' }}
Expand Down Expand Up @@ -106,9 +106,10 @@ jobs:
- --no-default-features --features non-fips,ring-io,unstable
- --no-default-features --features non-fips,ring-sig-verify,unstable
- --no-default-features --features non-fips,alloc,unstable
env:
AWS_LC_SYS_PREBUILT_NASM: 1
steps:
- uses: ilammy/setup-nasm@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
Expand All @@ -125,7 +126,7 @@ jobs:
name: aws-ls-rs coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
lfs: true
Expand Down Expand Up @@ -167,7 +168,7 @@ jobs:
- --no-default-features --features fips,asan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -196,7 +197,7 @@ jobs:
os: [ ubuntu-latest, macos-12, macos-13-xlarge ]
static: [ 0, 1 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -205,6 +206,40 @@ jobs:
# See: https://github.com/rust-lang/cargo/issues/8531
run: cargo test -p aws-lc-rs --tests

build-env-nasm-test:
if: github.repository_owner == 'aws'
name: prebuilt NASM verification
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target:
- 'x86_64-pc-windows-msvc'
- 'x86_64-pc-windows-gnu'
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
- name: Install NASM
uses: ilammy/setup-nasm@v1
- name: Remove NASM artifacts
shell: bash
run: |
cargo clean
rm ./aws-lc-sys/builder/prebuilt-nasm/*
- name: Run cargo test
shell: bash
run: AWS_LC_SYS_PREBUILT_NASM=0 cargo test --tests -p aws-lc-rs --release --no-default-features --features aws-lc-sys
- name: Collect NASM outputs
shell: bash
run: ./scripts/build/collect_nasm_obj.sh
- name: Flag any NASM changes
shell: bash
run: |
git add .
git diff --cached --exit-code HEAD -- aws-lc-sys/builder/prebuilt-nasm/*.txt
justsmth marked this conversation as resolved.
Show resolved Hide resolved

build-env-external-bindgen-test:
if: github.repository_owner == 'aws'
name: aws-lc-rs FIPS - External bindgen test
Expand All @@ -216,14 +251,14 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-12, macos-13-xlarge, windows-latest ]
steps:
- if: ${{ matrix.os == 'windows-latest' }}
uses: ilammy/setup-nasm@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v4
- if: ${{ matrix.os == 'windows-latest' }}
uses: ilammy/setup-nasm@v1
- if: ${{ matrix.os == 'windows-latest' }}
uses: seanmiddleditch/gha-setup-ninja@v5
- name: Install bindgen-cli
run: cargo install --locked bindgen-cli
- name: Remove bindings
Expand All @@ -245,12 +280,10 @@ jobs:
os: [ ubuntu-latest, macos-12, macos-13-xlarge ]
static: [ 0, 1 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v4
- uses: actions/setup-go@v4
with:
go-version: '>=1.18'
Expand All @@ -271,7 +304,7 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-12, macos-13-xlarge, windows-latest ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -306,15 +339,14 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-12, macos-13-xlarge, windows-latest ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v4
- uses: actions/setup-go@v4
with:
go-version: '>=1.18'
- uses: seanmiddleditch/gha-setup-ninja@v5
- name: Run cargo test
run: cargo test -p aws-lc-rs --tests --no-default-features --features fips
- name: Release build
Expand Down Expand Up @@ -346,14 +378,14 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-12, macos-13-xlarge, windows-latest ]
steps:
- if: ${{ matrix.os == 'windows-latest' }}
uses: ilammy/setup-nasm@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- if: ${{ matrix.os == 'windows-latest' }}
uses: ilammy/setup-nasm@v1
- if: ${{ matrix.os == 'windows-latest' }}
uses: seanmiddleditch/gha-setup-ninja@v5
- uses: dtolnay/rust-toolchain@stable
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v4
- uses: actions/setup-go@v4
with:
go-version: '>=1.18'
Expand All @@ -378,7 +410,7 @@ jobs:
- macos-12
- macos-13-xlarge
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
lfs: true
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-sys/builder/cc_builder/aarch64_apple_darwin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 14:33:51 UTC 2024
// Wed Aug 21 22:12:32 UTC 2024

use crate::cc_builder::Library;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 14:39:05 UTC 2024
// Wed Aug 21 22:18:30 UTC 2024

use crate::cc_builder::Library;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 14:40:07 UTC 2024
// Wed Aug 21 22:18:54 UTC 2024

use crate::cc_builder::Library;

Expand Down
2 changes: 1 addition & 1 deletion aws-lc-sys/builder/cc_builder/i686_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 14:39:33 UTC 2024
// Wed Aug 21 22:19:08 UTC 2024

use crate::cc_builder::Library;

Expand Down
2 changes: 1 addition & 1 deletion aws-lc-sys/builder/cc_builder/x86_64_apple_darwin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 14:35:11 UTC 2024
// Wed Aug 21 22:13:39 UTC 2024

use crate::cc_builder::Library;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 14:33:41 UTC 2024
// Wed Aug 21 22:12:14 UTC 2024

use crate::cc_builder::Library;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 14:40:14 UTC 2024
// Wed Aug 21 22:18:39 UTC 2024

use crate::cc_builder::Library;

Expand Down
41 changes: 29 additions & 12 deletions aws-lc-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use crate::OutputLib::{Crypto, RustWrapper, Ssl};
use crate::{
cargo_env, emit_warning, execute_command, is_crt_static, is_no_asm, option_env, target,
target_arch, target_env, target_family, target_os, target_underscored, target_vendor,
OutputLibType,
allow_prebuilt_nasm, cargo_env, emit_warning, execute_command, is_crt_static, is_no_asm,
option_env, target, target_arch, target_env, target_family, target_os, target_underscored,
target_vendor, test_nasm_command, OutputLibType,
};
use std::env;
use std::ffi::OsString;
Expand All @@ -22,10 +22,6 @@ fn test_clang_cl_command() -> bool {
execute_command("clang-cl".as_ref(), &["--version".as_ref()]).status
}

fn test_nasm_command() -> bool {
execute_command("nasm".as_ref(), &["-version".as_ref()]).status
}

fn find_cmake_command() -> Option<OsString> {
if let Some(cmake) = option_env("CMAKE") {
emit_warning(&format!(
Expand Down Expand Up @@ -162,7 +158,7 @@ impl CmakeBuilder {

// See issue: https://github.com/aws/aws-lc-rs/issues/453
if target_os() == "windows" {
Self::configure_windows(&mut cmake_cfg);
self.configure_windows(&mut cmake_cfg);
}

// If the build environment vendor is Apple
Expand Down Expand Up @@ -213,7 +209,7 @@ impl CmakeBuilder {
cmake_cfg
}

fn configure_windows(cmake_cfg: &mut cmake::Config) {
fn configure_windows(&self, cmake_cfg: &mut cmake::Config) {
match (target_env().as_str(), target_arch().as_str()) {
("msvc", "aarch64") => {
cmake_cfg.generator_toolset(format!(
Expand Down Expand Up @@ -243,6 +239,23 @@ impl CmakeBuilder {
}
_ => {}
}
if target_arch() == "x86_64" && !test_nasm_command() && Some(true) == allow_prebuilt_nasm()
{
emit_warning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
emit_warning("!!! Using pre-built NASM binaries !!!");
emit_warning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");

let script_path = self
.manifest_dir
.join("builder")
.join("prebuilt-nasm.bat")
.display()
.to_string();
let script_path = script_path.replace('\\', "/");

cmake_cfg.define("CMAKE_ASM_NASM_COMPILER", script_path.as_str());
cmake_cfg.define("CMAKE_VERBOSE_MAKEFILE", "1");
}
}

fn configure_open_harmony(cmake_cfg: &mut cmake::Config) {
Expand Down Expand Up @@ -298,10 +311,14 @@ impl crate::Builder for CmakeBuilder {
let mut missing_dependency = false;

if target_os() == "windows" {
if target_arch() == "x86_64" && !test_nasm_command() && !is_no_asm() {
if target_arch() == "x86_64"
&& !is_no_asm()
&& !test_nasm_command()
&& Some(true) != allow_prebuilt_nasm()
{
eprintln!(
"Consider setting `AWS_LC_SYS_NO_ASM` in the environment for development builds.\
See User Guide about the limitations: https://aws.github.io/aws-lc-rs/index.html"
"Consider setting `AWS_LC_SYS_PREBUILT_NASM` in the build environment.\
See User Guide: https://aws.github.io/aws-lc-rs/index.html"
justsmth marked this conversation as resolved.
Show resolved Hide resolved
);
eprintln!("Missing dependency: nasm");
missing_dependency = true;
Expand Down
Loading
Loading