From 36e515967c3648162108781d45e7eb60af43f39b Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Mon, 6 Jan 2025 11:57:28 -0500 Subject: [PATCH 1/2] Improve message when repo submods not initialized --- aws-lc-fips-sys/CMakeLists.txt | 3 +++ aws-lc-sys/CMakeLists.txt | 3 +++ aws-lc-sys/builder/cc_builder.rs | 20 +++++++++++++------- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/aws-lc-fips-sys/CMakeLists.txt b/aws-lc-fips-sys/CMakeLists.txt index df13bc4540c..eb57fc620f3 100644 --- a/aws-lc-fips-sys/CMakeLists.txt +++ b/aws-lc-fips-sys/CMakeLists.txt @@ -22,6 +22,9 @@ if (BUILD_SHARED_LIBS AND FIPS) endif() add_subdirectory(aws-lc aws-lc EXCLUDE_FROM_ALL) +if(NOT EXISTS aws-lc/CMakeLists.txt) +message(WARNING "###### WARNING: MISSING GIT SUBMODULE ###### Did you initialize the repo's git submodules? CMakeLists.txt not found.") +endif() if (BUILD_LIBSSL) add_definitions(-DAWS_LC_RUST_INCLUDE_SSL) diff --git a/aws-lc-sys/CMakeLists.txt b/aws-lc-sys/CMakeLists.txt index e93e6e326fa..65908e53b2d 100644 --- a/aws-lc-sys/CMakeLists.txt +++ b/aws-lc-sys/CMakeLists.txt @@ -18,6 +18,9 @@ if(BUILD_SHARED_LIBS) endif() add_subdirectory(aws-lc aws-lc EXCLUDE_FROM_ALL) +if(NOT EXISTS aws-lc/CMakeLists.txt) +message(WARNING "###### WARNING: MISSING GIT SUBMODULE ###### Did you initialize the repo's git submodules? CMakeLists.txt not found.") +endif() if (BUILD_LIBSSL) add_definitions(-DAWS_LC_RUST_INCLUDE_SSL) diff --git a/aws-lc-sys/builder/cc_builder.rs b/aws-lc-sys/builder/cc_builder.rs index 4364dfac0e1..875b2cb49b8 100644 --- a/aws-lc-sys/builder/cc_builder.rs +++ b/aws-lc-sys/builder/cc_builder.rs @@ -267,14 +267,20 @@ impl CcBuilder { let mut ret_val = false; let output_dir = self.out_dir.join(format!("out-{basename}")); let mut cc_build = self.create_builder(); + let source_file = self + .manifest_dir + .join("aws-lc") + .join("tests") + .join("compiler_features_tests") + .join(format!("{basename}.c")); + if !source_file.exists() { + emit_warning(&format!( + "###### WARNING: MISSING GIT SUBMODULE ###### Did you initialize the repo's git submodules? Unable to find source file: {:?}.", + &source_file + )); + } cc_build - .file( - self.manifest_dir - .join("aws-lc") - .join("tests") - .join("compiler_features_tests") - .join(format!("{basename}.c")), - ) + .file(source_file) .warnings_into_errors(true) .out_dir(&output_dir); From 8acd16dda398433b96f3478bdd4028a5bb5be3eb Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Thu, 9 Jan 2025 10:36:42 -0500 Subject: [PATCH 2/2] Improve message; also check in bindgen --- aws-lc-fips-sys/CMakeLists.txt | 2 +- aws-lc-sys/CMakeLists.txt | 2 +- aws-lc-sys/builder/cc_builder.rs | 7 ++++++- aws-lc-sys/builder/main.rs | 12 ++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/aws-lc-fips-sys/CMakeLists.txt b/aws-lc-fips-sys/CMakeLists.txt index eb57fc620f3..f1387e21b5f 100644 --- a/aws-lc-fips-sys/CMakeLists.txt +++ b/aws-lc-fips-sys/CMakeLists.txt @@ -23,7 +23,7 @@ endif() add_subdirectory(aws-lc aws-lc EXCLUDE_FROM_ALL) if(NOT EXISTS aws-lc/CMakeLists.txt) -message(WARNING "###### WARNING: MISSING GIT SUBMODULE ###### Did you initialize the repo's git submodules? CMakeLists.txt not found.") +message(WARNING "###### WARNING: MISSING GIT SUBMODULE ###### Did you initialize the repo's git submodules? CMakeLists.txt not found.\n -- run 'git submodule update --init --recursive' to initialize.") endif() if (BUILD_LIBSSL) diff --git a/aws-lc-sys/CMakeLists.txt b/aws-lc-sys/CMakeLists.txt index 65908e53b2d..d1f2b1b1947 100644 --- a/aws-lc-sys/CMakeLists.txt +++ b/aws-lc-sys/CMakeLists.txt @@ -19,7 +19,7 @@ endif() add_subdirectory(aws-lc aws-lc EXCLUDE_FROM_ALL) if(NOT EXISTS aws-lc/CMakeLists.txt) -message(WARNING "###### WARNING: MISSING GIT SUBMODULE ###### Did you initialize the repo's git submodules? CMakeLists.txt not found.") +message(WARNING "###### WARNING: MISSING GIT SUBMODULE ###### Did you initialize the repo's git submodules? CMakeLists.txt not found.\n -- run 'git submodule update --init --recursive' to initialize.") endif() if (BUILD_LIBSSL) diff --git a/aws-lc-sys/builder/cc_builder.rs b/aws-lc-sys/builder/cc_builder.rs index 875b2cb49b8..1f14db97f89 100644 --- a/aws-lc-sys/builder/cc_builder.rs +++ b/aws-lc-sys/builder/cc_builder.rs @@ -274,10 +274,15 @@ impl CcBuilder { .join("compiler_features_tests") .join(format!("{basename}.c")); if !source_file.exists() { + emit_warning("######"); + emit_warning("###### WARNING: MISSING GIT SUBMODULE ######"); emit_warning(&format!( - "###### WARNING: MISSING GIT SUBMODULE ###### Did you initialize the repo's git submodules? Unable to find source file: {:?}.", + " -- Did you initialize the repo's git submodules? Unable to find source file: {:?}.", &source_file )); + emit_warning(" -- run 'git submodule update --init --recursive' to initialize."); + emit_warning("######"); + emit_warning("######"); } cc_build .file(source_file) diff --git a/aws-lc-sys/builder/main.rs b/aws-lc-sys/builder/main.rs index 3619a421d11..e9103c74ee5 100644 --- a/aws-lc-sys/builder/main.rs +++ b/aws-lc-sys/builder/main.rs @@ -597,6 +597,18 @@ fn main() { bindings_available = true; } } else if is_bindgen_required() { + let aws_lc_crypto_dir = Path::new(&manifest_dir).join("aws-lc").join("crypto"); + if !aws_lc_crypto_dir.exists() { + emit_warning("######"); + emit_warning("###### WARNING: MISSING GIT SUBMODULE ######"); + emit_warning(&format!( + " -- Did you initialize the repo's git submodules? Unable to find crypto directory: {:?}.", + &aws_lc_crypto_dir + )); + emit_warning(" -- run 'git submodule update --init --recursive' to initialize."); + emit_warning("######"); + emit_warning("######"); + } bindings_available = handle_bindgen(&manifest_dir, &prefix); } else { bindings_available = true;