From d44e4acf209673f83352561c84c98c9db5ccba0c Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 12 Aug 2024 14:50:53 -0700 Subject: [PATCH 01/70] Prebuild aws-lc --- CMakeLists.txt | 42 +++++++++++++++++++++++++++++------------- crt/aws-c-cal | 2 +- crt/aws-c-common | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8771c8ba9..ab8a44e52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,46 +60,62 @@ if (BUILD_DEPS) set(BUILD_TESTING OFF) add_subdirectory(crt/aws-c-common) if (UNIX AND NOT APPLE) - set(BUILD_LIBSSL OFF CACHE BOOL "Don't need libssl, only need libcrypto") + include(AwsPrebuildDependency) + + set(AWSLC_CMAKE_ARGUMENTS + -DBUILD_LIBSSL=OFF + -DBUILD_TESTING=OFF + ) + message("Build with FIPS: " ${CRT_FIPS}) if (CRT_FIPS) set(FIPS ON CACHE BOOL "FIPS compliance") + list(append AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) + set(PERL_EXECUTABLE "perl") + list(append AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) + if (DEFINED ENV{GO_PATH}) set(GO_EXECUTABLE $ENV{GO_PATH}/go) + list(append AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=${GO_EXECUTABLE}) message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") endif() else() - set(DISABLE_PERL ON CACHE BOOL "Disable codegen") - set(DISABLE_GO ON CACHE BOOL "Disable codegen") + list(append AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=ON) # Disable codegen + list(append AWSLC_CMAKE_ARGUMENTS -DDISABLE_GO=ON) # Disable codegen endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") - set(DISABLE_PERL OFF CACHE BOOL "Build with Perl to avoid using pre-compiled binary with AVX512") set(PERL_EXECUTABLE "perl") - set(MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX ON CACHE BOOL "Disable AVX512 on old GCC that not supports it") + # Build with Perl to avoid using pre-compiled binary with AVX512 + list(append AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) + list(append AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) + # Disable AVX512 on old GCC that not supports it + list(append AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) endif() # temporarily disable certain warnings as errors for the aws-lc build - set(OLD_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set(AWSLC_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") if (NOT MSVC) check_c_compiler_flag(-Wno-stringop-overflow HAS_WNO_STRINGOP_OVERFLOW) if (HAS_WNO_STRINGOP_OVERFLOW) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-stringop-overflow") + set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-stringop-overflow") endif() check_c_compiler_flag(-Wno-array-parameter HAS_WNO_ARRAY_PARAMETER) if (HAS_WNO_ARRAY_PARAMETER) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-array-parameter") + set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-array-parameter") endif() endif() + list(append AWSLC_CMAKE_ARGUMENTS ${AWSLC_CMAKE_C_FLAGS}) - add_subdirectory(crt/aws-lc) - - # restore previous build flags - set(CMAKE_C_FLAGS "${OLD_CMAKE_C_FLAGS}") + # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. + prebuild_dependency( + DEPENDENCY_NAME AWSLC + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/crt/aws-lc + CMAKE_ARGUMENTS ${AWSLC_CMAKE_ARGUMENTS} + ) - set(SEARCH_LIBCRYPTO OFF CACHE BOOL "Let S2N use libcrypto from AWS-LC.") set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) endif() diff --git a/crt/aws-c-cal b/crt/aws-c-cal index bc0d71b66..8232595f5 160000 --- a/crt/aws-c-cal +++ b/crt/aws-c-cal @@ -1 +1 @@ -Subproject commit bc0d71b66deea9e1a2d3a073c9f1ece9286b9e60 +Subproject commit 8232595f5344854fdeb74c80054742567673287a diff --git a/crt/aws-c-common b/crt/aws-c-common index 2add521b7..d6004d333 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 2add521b78d69f9f043a701232e751f43cf123e6 +Subproject commit d6004d3337c43275115bfddae289b787ebbf4d55 From fda36fe3d70dbd3494262f750876b5c4a704fb2e Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 12 Aug 2024 14:55:30 -0700 Subject: [PATCH 02/70] fixup --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab8a44e52..a41bc197b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,28 +70,28 @@ if (BUILD_DEPS) message("Build with FIPS: " ${CRT_FIPS}) if (CRT_FIPS) set(FIPS ON CACHE BOOL "FIPS compliance") - list(append AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) set(PERL_EXECUTABLE "perl") - list(append AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) if (DEFINED ENV{GO_PATH}) set(GO_EXECUTABLE $ENV{GO_PATH}/go) - list(append AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=${GO_EXECUTABLE}) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=${GO_EXECUTABLE}) message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") endif() else() - list(append AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=ON) # Disable codegen - list(append AWSLC_CMAKE_ARGUMENTS -DDISABLE_GO=ON) # Disable codegen + list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=ON) # Disable codegen + list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_GO=ON) # Disable codegen endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") set(PERL_EXECUTABLE "perl") # Build with Perl to avoid using pre-compiled binary with AVX512 - list(append AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) - list(append AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) # Disable AVX512 on old GCC that not supports it - list(append AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) endif() # temporarily disable certain warnings as errors for the aws-lc build @@ -107,7 +107,7 @@ if (BUILD_DEPS) set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-array-parameter") endif() endif() - list(append AWSLC_CMAKE_ARGUMENTS ${AWSLC_CMAKE_C_FLAGS}) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. prebuild_dependency( From f6c3021bf9a9e835de9e5e8c9c1e646f9c9750f6 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 12 Aug 2024 15:09:10 -0700 Subject: [PATCH 03/70] Update submodules --- crt/aws-c-cal | 2 +- crt/aws-c-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crt/aws-c-cal b/crt/aws-c-cal index 8232595f5..77ca3aea8 160000 --- a/crt/aws-c-cal +++ b/crt/aws-c-cal @@ -1 +1 @@ -Subproject commit 8232595f5344854fdeb74c80054742567673287a +Subproject commit 77ca3aea879bc768082fe7ec715adcde8e98c332 diff --git a/crt/aws-c-common b/crt/aws-c-common index d6004d333..8419fe707 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit d6004d3337c43275115bfddae289b787ebbf4d55 +Subproject commit 8419fe7077778b5ca40e8822f969665bbddc226c From 62452b46ff7e35ec81ca2a107799cd361fd8f1d2 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 8 Oct 2024 11:20:30 -0700 Subject: [PATCH 04/70] Fix naming --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a41bc197b..be4789cf0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,7 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. - prebuild_dependency( + aws_prebuild_dependency( DEPENDENCY_NAME AWSLC SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/crt/aws-lc CMAKE_ARGUMENTS ${AWSLC_CMAKE_ARGUMENTS} From 496042893cecc9dd7ae1859dba6eb7652ba2b4aa Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 8 Oct 2024 13:15:35 -0700 Subject: [PATCH 05/70] Try without PERL_EXECUTABLE --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be4789cf0..7e4a316d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,8 +72,9 @@ if (BUILD_DEPS) set(FIPS ON CACHE BOOL "FIPS compliance") list(APPEND AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) - set(PERL_EXECUTABLE "perl") - list(APPEND AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) + # FIXME + # set(PERL_EXECUTABLE "perl") + # list(APPEND AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) if (DEFINED ENV{GO_PATH}) set(GO_EXECUTABLE $ENV{GO_PATH}/go) From 2199d068122c0833c510ba151bec719fa26b020a Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 8 Oct 2024 13:23:33 -0700 Subject: [PATCH 06/70] Comment out another PERL_EXECUTABLE --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e4a316d1..84290cb74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,10 +87,11 @@ if (BUILD_DEPS) endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") - set(PERL_EXECUTABLE "perl") + # FIXME + # set(PERL_EXECUTABLE "perl") # Build with Perl to avoid using pre-compiled binary with AVX512 list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) + # list(APPEND AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) # Disable AVX512 on old GCC that not supports it list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) endif() From cf27dc5420e0c3795301cec9919c2a4f765c218c Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 8 Oct 2024 15:00:02 -0700 Subject: [PATCH 07/70] Debug android --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f8e33164..074cad87e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,7 +240,7 @@ jobs: # Build and publish locally for the test app to find the SNAPSHOT version - name: Build ${{ env.PACKAGE_NAME }} run: | - ./gradlew :android:crt:build + ./gradlew :android:crt:build --debug --stacktrace ./gradlew -PnewVersion="1.0.0-SNAPSHOT" :android:crt:publishToMavenLocal # Setup files required by test app for Device Farm testing - name: Setup Android Test Files From c38275ded75c9cf083be1da5780d5ac1040a5624 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 8 Oct 2024 15:31:42 -0700 Subject: [PATCH 08/70] Pass android vars --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84290cb74..c2e4d71dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,11 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_GO=ON) # Disable codegen endif() + if (ANDROID) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${CMAKE_CURRENT_SOURCE_DIR}/target/cmake-build/deps/${ANDROID_ABI}) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${CMAKE_BINARY_DIR}/../../../lib") + endif() + if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") # FIXME # set(PERL_EXECUTABLE "perl") From bd89df2cdd67f1f93eac208c44494a428e9af2d4 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 9 Oct 2024 13:55:48 -0700 Subject: [PATCH 09/70] Pass more android options --- CMakeLists.txt | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2e4d71dd..ca010e6dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,46 @@ if (BUILD_DEPS) endif() list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) + if (ANDROID) + if (ANDROID_PLATFORM) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_PLATFORM=${ANDROID_PLATFORM}) + endif() + + if (ANDROID_ABI) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_ABI=${ANDROID_ABI}) + endif() + + if (CMAKE_ANDROID_ARCH_ABI) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI}) + endif() + + if (ANDROID_NDK) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_NDK=${ANDROID_NDK}) + endif() + + if (CMAKE_TOOLCHAIN_FILE) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) + endif() + endif() + +# -H/home/runner/work/aws-crt-java/aws-crt-java +# -DCMAKE_SYSTEM_NAME=Android +# -DCMAKE_EXPORT_COMPILE_COMMANDS=ON +# -DCMAKE_SYSTEM_VERSION=24 +# -DANDROID_PLATFORM=android-24 +# -DANDROID_ABI=armeabi-v7a +# -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a +# -DANDROID_NDK=/usr/local/lib/android/sdk/ndk/21.4.7075529 +# -DCMAKE_ANDROID_NDK=/usr/local/lib/android/sdk/ndk/21.4.7075529 +# -DCMAKE_TOOLCHAIN_FILE=/usr/local/lib/android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake +# -DCMAKE_MAKE_PROGRAM=/usr/local/lib/android/sdk/cmake/3.10.2.4988404/bin/ninja +# -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/runner/work/aws-crt-java/aws-crt-java/android/crt/build/intermediates/cxx/Debug/u24h6x2s/obj/armeabi-v7a +# -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/home/runner/work/aws-crt-java/aws-crt-java/android/crt/build/intermediates/cxx/Debug/u24h6x2s/obj/armeabi-v7a +# -DCMAKE_BUILD_TYPE=Debug +# -B/home/runner/work/aws-crt-java/aws-crt-java/target/cmake-build/Debug/u24h6x2s/armeabi-v7a +# -GNinja +# -DBUILD_DEPS=ON + # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. aws_prebuild_dependency( DEPENDENCY_NAME AWSLC From 91c194f204e5408619dfa3e9dcdf52cdaf066f6a Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 9 Oct 2024 14:11:03 -0700 Subject: [PATCH 10/70] lc compiles, but s2n fails to find it --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca010e6dd..ee69e3e17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,6 +117,14 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) if (ANDROID) + if (CMAKE_SYSTEM_NAME) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) + endif() + + if (CMAKE_SYSTEM_VERSION) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}) + endif() + if (ANDROID_PLATFORM) list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_PLATFORM=${ANDROID_PLATFORM}) endif() From e54a74995fc74da74a447550f8f0ca4849a6ecfd Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 9 Oct 2024 14:24:55 -0700 Subject: [PATCH 11/70] Add debug message --- CMakeLists.txt | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee69e3e17..3e9361ce3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,24 +146,6 @@ if (BUILD_DEPS) endif() endif() -# -H/home/runner/work/aws-crt-java/aws-crt-java -# -DCMAKE_SYSTEM_NAME=Android -# -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -# -DCMAKE_SYSTEM_VERSION=24 -# -DANDROID_PLATFORM=android-24 -# -DANDROID_ABI=armeabi-v7a -# -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -# -DANDROID_NDK=/usr/local/lib/android/sdk/ndk/21.4.7075529 -# -DCMAKE_ANDROID_NDK=/usr/local/lib/android/sdk/ndk/21.4.7075529 -# -DCMAKE_TOOLCHAIN_FILE=/usr/local/lib/android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -# -DCMAKE_MAKE_PROGRAM=/usr/local/lib/android/sdk/cmake/3.10.2.4988404/bin/ninja -# -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/runner/work/aws-crt-java/aws-crt-java/android/crt/build/intermediates/cxx/Debug/u24h6x2s/obj/armeabi-v7a -# -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/home/runner/work/aws-crt-java/aws-crt-java/android/crt/build/intermediates/cxx/Debug/u24h6x2s/obj/armeabi-v7a -# -DCMAKE_BUILD_TYPE=Debug -# -B/home/runner/work/aws-crt-java/aws-crt-java/target/cmake-build/Debug/u24h6x2s/armeabi-v7a -# -GNinja -# -DBUILD_DEPS=ON - # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. aws_prebuild_dependency( DEPENDENCY_NAME AWSLC @@ -171,6 +153,8 @@ if (BUILD_DEPS) CMAKE_ARGUMENTS ${AWSLC_CMAKE_ARGUMENTS} ) + message(WARNING "AWSLC is installed, CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}") + set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) endif() From d0fd2ca92702946a1d94d0f086979004482a07bc Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 9 Oct 2024 14:39:23 -0700 Subject: [PATCH 12/70] More debugging --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e9361ce3..280257215 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,6 +156,7 @@ if (BUILD_DEPS) message(WARNING "AWSLC is installed, CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}") set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") + set(CMAKE_FIND_DEBUG_MODE TRUE) add_subdirectory(crt/s2n) endif() add_subdirectory(crt/aws-c-sdkutils) From 942f076ed5f3a75f0b76fce1d72135a43c0fe93f Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 9 Oct 2024 15:07:53 -0700 Subject: [PATCH 13/70] Add scan --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 074cad87e..c34f71aa5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,7 +240,7 @@ jobs: # Build and publish locally for the test app to find the SNAPSHOT version - name: Build ${{ env.PACKAGE_NAME }} run: | - ./gradlew :android:crt:build --debug --stacktrace + ./gradlew :android:crt:build --debug --stacktrace --scan ./gradlew -PnewVersion="1.0.0-SNAPSHOT" :android:crt:publishToMavenLocal # Setup files required by test app for Device Farm testing - name: Setup Android Test Files From 93b7f3568717cd3754bb1b206650318bf3acfb4f Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 9 Oct 2024 16:20:59 -0700 Subject: [PATCH 14/70] Debugging --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 280257215..1d495cf50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,8 +155,13 @@ if (BUILD_DEPS) message(WARNING "AWSLC is installed, CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}") - set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") + list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_PREFIX_PATH}) set(CMAKE_FIND_DEBUG_MODE TRUE) + find_package(crypto REQUIRED) + + message(FATAL_ERROR "=== enough for now") + + set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) endif() add_subdirectory(crt/aws-c-sdkutils) From 534ed54aa6ae36498a11cca6e20b1013af2f4005 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 9 Oct 2024 16:53:29 -0700 Subject: [PATCH 15/70] Print CMAKE_SYSROOT --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d495cf50..08bf8ed89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,7 @@ if (BUILD_DEPS) ) message(WARNING "AWSLC is installed, CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}") + message(WARNING "AWSLC is installed, CMAKE_SYSROOT is ${CMAKE_SYSROOT}") list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_PREFIX_PATH}) set(CMAKE_FIND_DEBUG_MODE TRUE) From 1241d2f60b8ca5a4338952e300b0cb7a015ecb39 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 10 Oct 2024 11:15:30 -0700 Subject: [PATCH 16/70] Print cmake vars --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08bf8ed89..d8c367389 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,7 +154,9 @@ if (BUILD_DEPS) ) message(WARNING "AWSLC is installed, CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}") - message(WARNING "AWSLC is installed, CMAKE_SYSROOT is ${CMAKE_SYSROOT}") + message(WARNING "CMAKE_SYSROOT is ${CMAKE_SYSROOT}") + message(WARNING "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE is ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}") + message(WARNING "CMAKE_FIND_ROOT_PATH is ${CMAKE_FIND_ROOT_PATH}") list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_PREFIX_PATH}) set(CMAKE_FIND_DEBUG_MODE TRUE) From 198e5411d05a2901e9feb3d212d592efe7df040e Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 10 Oct 2024 13:33:33 -0700 Subject: [PATCH 17/70] Set CMAKE_FIND_ROOT_PATH --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8c367389..cff2db5be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,7 +158,7 @@ if (BUILD_DEPS) message(WARNING "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE is ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}") message(WARNING "CMAKE_FIND_ROOT_PATH is ${CMAKE_FIND_ROOT_PATH}") - list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_PREFIX_PATH}) + list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) set(CMAKE_FIND_DEBUG_MODE TRUE) find_package(crypto REQUIRED) From be1cc06bf27c11b5e6aad5045edcc84bddc167ef Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 10 Oct 2024 13:46:45 -0700 Subject: [PATCH 18/70] Remove debugging --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 26 +++++--------------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c34f71aa5..8f8e33164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,7 +240,7 @@ jobs: # Build and publish locally for the test app to find the SNAPSHOT version - name: Build ${{ env.PACKAGE_NAME }} run: | - ./gradlew :android:crt:build --debug --stacktrace --scan + ./gradlew :android:crt:build ./gradlew -PnewVersion="1.0.0-SNAPSHOT" :android:crt:publishToMavenLocal # Setup files required by test app for Device Farm testing - name: Setup Android Test Files diff --git a/CMakeLists.txt b/CMakeLists.txt index cff2db5be..7e93fca22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,10 +71,7 @@ if (BUILD_DEPS) if (CRT_FIPS) set(FIPS ON CACHE BOOL "FIPS compliance") list(APPEND AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) - - # FIXME - # set(PERL_EXECUTABLE "perl") - # list(APPEND AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) if (DEFINED ENV{GO_PATH}) set(GO_EXECUTABLE $ENV{GO_PATH}/go) @@ -86,17 +83,9 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_GO=ON) # Disable codegen endif() - if (ANDROID) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${CMAKE_CURRENT_SOURCE_DIR}/target/cmake-build/deps/${ANDROID_ABI}) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${CMAKE_BINARY_DIR}/../../../lib") - endif() - if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") - # FIXME - # set(PERL_EXECUTABLE "perl") # Build with Perl to avoid using pre-compiled binary with AVX512 list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) - # list(APPEND AWSLC_CMAKE_ARGUMENTS -DPERL_EXECUTABLE=perl) # Disable AVX512 on old GCC that not supports it list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) endif() @@ -117,6 +106,9 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) if (ANDROID) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${AWS_LIBRARY_OUTPUT_DIR}") + if (CMAKE_SYSTEM_NAME) list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) endif() @@ -153,16 +145,8 @@ if (BUILD_DEPS) CMAKE_ARGUMENTS ${AWSLC_CMAKE_ARGUMENTS} ) - message(WARNING "AWSLC is installed, CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}") - message(WARNING "CMAKE_SYSROOT is ${CMAKE_SYSROOT}") - message(WARNING "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE is ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}") - message(WARNING "CMAKE_FIND_ROOT_PATH is ${CMAKE_FIND_ROOT_PATH}") - + # CMAKE_FIND_ROOT_PATH is used in cross-compiling mode. list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) - set(CMAKE_FIND_DEBUG_MODE TRUE) - find_package(crypto REQUIRED) - - message(FATAL_ERROR "=== enough for now") set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) From 79ec2e6e2f76bf3b9ae44ec3351b18e16c43d613 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 10 Oct 2024 16:45:13 -0700 Subject: [PATCH 19/70] Capture cmd vars and pass them to prebuild --- CMakeLists.txt | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e93fca22..dd339b9be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,19 @@ cmake_minimum_required(VERSION 3.1) +# Get list of variables provided via command line arguments. +# MUST be done before call to 'project'. +# Via https://cmake.org/pipermail/cmake/2018-January/067002.html +if(NOT AWS_CMAKE_CL_ARGS) + get_cmake_property(vars CACHE_VARIABLES) + foreach(var ${vars}) + get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) + if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") + list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") + endif() + endforeach() + set(AWS_CMAKE_CL_ARGS ${AWS_CMAKE_CL_ARGS} CACHE STRING "Command line variables") +endif() + project(aws-crt-jni C) option(BUILD_DEPS "Builds aws common runtime dependencies as part of build" ON) option(CRT_FIPS "Whether to build aws-lc with FIPS compliance" OFF) @@ -109,33 +123,9 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${AWS_LIBRARY_OUTPUT_DIR}") - if (CMAKE_SYSTEM_NAME) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) - endif() - - if (CMAKE_SYSTEM_VERSION) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}) - endif() - - if (ANDROID_PLATFORM) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_PLATFORM=${ANDROID_PLATFORM}) - endif() - - if (ANDROID_ABI) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_ABI=${ANDROID_ABI}) - endif() - - if (CMAKE_ANDROID_ARCH_ABI) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI}) - endif() - - if (ANDROID_NDK) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_NDK=${ANDROID_NDK}) - endif() - - if (CMAKE_TOOLCHAIN_FILE) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) - endif() + # Cross-compiling mode is used for Android, with some variables set via command line. Instead of adding + # these variables one by one explicitly, we pass all cmd variables. + list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) endif() # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. From 1a66e3a9064d2f9d92c0991df85760f5d2fcdb20 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 09:17:39 -0700 Subject: [PATCH 20/70] Print cmd vars --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f8e33164..c34f71aa5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,7 +240,7 @@ jobs: # Build and publish locally for the test app to find the SNAPSHOT version - name: Build ${{ env.PACKAGE_NAME }} run: | - ./gradlew :android:crt:build + ./gradlew :android:crt:build --debug --stacktrace --scan ./gradlew -PnewVersion="1.0.0-SNAPSHOT" :android:crt:publishToMavenLocal # Setup files required by test app for Device Farm testing - name: Setup Android Test Files diff --git a/CMakeLists.txt b/CMakeLists.txt index dd339b9be..5e73520e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,9 @@ if(NOT AWS_CMAKE_CL_ARGS) get_cmake_property(vars CACHE_VARIABLES) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) + message(WARNING "=== ${var}=${${var}}: ${currentHelpString}") if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") + message(WARNING "add var ${var}") list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") endif() endforeach() From 98201c8ebbdeb2e21a34a4f972b79ac99d1c1b48 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 09:24:56 -0700 Subject: [PATCH 21/70] Debugging --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e73520e2..f6742c271 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,8 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) endif() + message(WARNING "=== awslc cmake args: ${AWSLC_CMAKE_ARGUMENTS}") + # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. aws_prebuild_dependency( DEPENDENCY_NAME AWSLC From 3e80ac909f12d64aea8f8eb0d8a5ffcc01207bc3 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 13:40:00 -0700 Subject: [PATCH 22/70] Set all vars explicitly --- CMakeLists.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6742c271..7139c5b0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,7 +127,63 @@ if (BUILD_DEPS) # Cross-compiling mode is used for Android, with some variables set via command line. Instead of adding # these variables one by one explicitly, we pass all cmd variables. - list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) + #list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) + + if (CMAKE_SYSTEM_NAME) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) + endif() + + if (CMAKE_SYSTEM_VERSION) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}) + endif() + + if (ANDROID_PLATFORM) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_PLATFORM=${ANDROID_PLATFORM}) + endif() + + if (ANDROID_ABI) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_ABI=${ANDROID_ABI}) + endif() + + if (CMAKE_ANDROID_ARCH_ABI) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI}) + endif() + + if (ANDROID_NDK) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_NDK=${ANDROID_NDK}) + endif() + + if (CMAKE_TOOLCHAIN_FILE) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) + endif() + + if (ANDROID_DEPS_DIR) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) + endif() + + if (AWS_LIBRARY_OUTPUT_DIR) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR=${AWS_LIBRARY_OUTPUT_DIR}) + endif() + + if (BUILD_DEPS) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DBUILD_DEPS=${BUILD_DEPS}) + endif() + + if (CMAKE_ANDROID_NDK) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}) + endif() + + if (CMAKE_LIBRARY_OUTPUT_DIRECTORY) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + endif() + + if (CMAKE_MAKE_PROGRAM) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}) + endif() + + if (CMAKE_RUNTIME_OUTPUT_DIRECTORY) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + endif() endif() message(WARNING "=== awslc cmake args: ${AWSLC_CMAKE_ARGUMENTS}") From b19e2435f02e33e0398fbe917361ed74fc3f4f56 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 14:13:08 -0700 Subject: [PATCH 23/70] Back to working version --- CMakeLists.txt | 54 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7139c5b0e..acbd3a98d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,33 +157,33 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) endif() - if (ANDROID_DEPS_DIR) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) - endif() - - if (AWS_LIBRARY_OUTPUT_DIR) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR=${AWS_LIBRARY_OUTPUT_DIR}) - endif() - - if (BUILD_DEPS) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DBUILD_DEPS=${BUILD_DEPS}) - endif() - - if (CMAKE_ANDROID_NDK) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}) - endif() - - if (CMAKE_LIBRARY_OUTPUT_DIRECTORY) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - endif() - - if (CMAKE_MAKE_PROGRAM) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}) - endif() - - if (CMAKE_RUNTIME_OUTPUT_DIRECTORY) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - endif() +# if (ANDROID_DEPS_DIR) +# list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) +# endif() +# +# if (AWS_LIBRARY_OUTPUT_DIR) +# list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR=${AWS_LIBRARY_OUTPUT_DIR}) +# endif() +# +# if (BUILD_DEPS) +# list(APPEND AWSLC_CMAKE_ARGUMENTS -DBUILD_DEPS=${BUILD_DEPS}) +# endif() +# +# if (CMAKE_ANDROID_NDK) +# list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}) +# endif() +# +# if (CMAKE_LIBRARY_OUTPUT_DIRECTORY) +# list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +# endif() +# +# if (CMAKE_MAKE_PROGRAM) +# list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}) +# endif() +# +# if (CMAKE_RUNTIME_OUTPUT_DIRECTORY) +# list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +# endif() endif() message(WARNING "=== awslc cmake args: ${AWSLC_CMAKE_ARGUMENTS}") From ea3fddfb3e549d0a0e90e909aaf639a0ecdb9744 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 14:21:10 -0700 Subject: [PATCH 24/70] Add more vars --- CMakeLists.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acbd3a98d..a712ecdc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,18 +157,18 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) endif() -# if (ANDROID_DEPS_DIR) -# list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) -# endif() -# -# if (AWS_LIBRARY_OUTPUT_DIR) -# list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR=${AWS_LIBRARY_OUTPUT_DIR}) -# endif() -# -# if (BUILD_DEPS) -# list(APPEND AWSLC_CMAKE_ARGUMENTS -DBUILD_DEPS=${BUILD_DEPS}) -# endif() -# + if (ANDROID_DEPS_DIR) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) + endif() + + if (AWS_LIBRARY_OUTPUT_DIR) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR=${AWS_LIBRARY_OUTPUT_DIR}) + endif() + + if (BUILD_DEPS) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DBUILD_DEPS=${BUILD_DEPS}) + endif() + # if (CMAKE_ANDROID_NDK) # list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}) # endif() From 992fe2cd52d8040d656045c4a545b5c6a6b03e1b Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 14:25:21 -0700 Subject: [PATCH 25/70] debugging --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a712ecdc6..dea75f990 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,9 @@ if (BUILD_DEPS) set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) endif() + + message(FATAL_ERROR "enough") + add_subdirectory(crt/aws-c-sdkutils) add_subdirectory(crt/aws-c-io) add_subdirectory(crt/aws-c-cal) From e2f70bbd0ac08b6158a2ac165c95a76d42c8b23a Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 14:29:42 -0700 Subject: [PATCH 26/70] More vars --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dea75f990..b707fa1d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,14 +169,14 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DBUILD_DEPS=${BUILD_DEPS}) endif() -# if (CMAKE_ANDROID_NDK) -# list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}) -# endif() -# -# if (CMAKE_LIBRARY_OUTPUT_DIRECTORY) -# list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) -# endif() -# + if (CMAKE_ANDROID_NDK) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}) + endif() + + if (CMAKE_LIBRARY_OUTPUT_DIRECTORY) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + endif() + # if (CMAKE_MAKE_PROGRAM) # list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}) # endif() From b2eacf9399d6afb3404351107832ac957de31c13 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 14:35:10 -0700 Subject: [PATCH 27/70] More vars --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b707fa1d6..34c9f62fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,10 +177,10 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) endif() -# if (CMAKE_MAKE_PROGRAM) -# list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}) -# endif() -# + if (CMAKE_MAKE_PROGRAM) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}) + endif() + # if (CMAKE_RUNTIME_OUTPUT_DIRECTORY) # list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # endif() From b1a5f6df0a824b5323d60fa9465abd7cdb0a7960 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 15:05:55 -0700 Subject: [PATCH 28/70] Set cmake generator --- CMakeLists.txt | 58 ++------------------------------------------------ 1 file changed, 2 insertions(+), 56 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34c9f62fe..2bffc5079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,63 +127,9 @@ if (BUILD_DEPS) # Cross-compiling mode is used for Android, with some variables set via command line. Instead of adding # these variables one by one explicitly, we pass all cmd variables. - #list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) + list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) - if (CMAKE_SYSTEM_NAME) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) - endif() - - if (CMAKE_SYSTEM_VERSION) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}) - endif() - - if (ANDROID_PLATFORM) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_PLATFORM=${ANDROID_PLATFORM}) - endif() - - if (ANDROID_ABI) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_ABI=${ANDROID_ABI}) - endif() - - if (CMAKE_ANDROID_ARCH_ABI) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI}) - endif() - - if (ANDROID_NDK) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_NDK=${ANDROID_NDK}) - endif() - - if (CMAKE_TOOLCHAIN_FILE) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) - endif() - - if (ANDROID_DEPS_DIR) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) - endif() - - if (AWS_LIBRARY_OUTPUT_DIR) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR=${AWS_LIBRARY_OUTPUT_DIR}) - endif() - - if (BUILD_DEPS) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DBUILD_DEPS=${BUILD_DEPS}) - endif() - - if (CMAKE_ANDROID_NDK) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK}) - endif() - - if (CMAKE_LIBRARY_OUTPUT_DIRECTORY) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - endif() - - if (CMAKE_MAKE_PROGRAM) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}) - endif() - -# if (CMAKE_RUNTIME_OUTPUT_DIRECTORY) -# list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) -# endif() + list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) endif() message(WARNING "=== awslc cmake args: ${AWSLC_CMAKE_ARGUMENTS}") From 897dc6af31db46ed4bc30c0e4a7f2ba9a71fe795 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 15:09:10 -0700 Subject: [PATCH 29/70] Remove debugging --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c34f71aa5..8f8e33164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,7 +240,7 @@ jobs: # Build and publish locally for the test app to find the SNAPSHOT version - name: Build ${{ env.PACKAGE_NAME }} run: | - ./gradlew :android:crt:build --debug --stacktrace --scan + ./gradlew :android:crt:build ./gradlew -PnewVersion="1.0.0-SNAPSHOT" :android:crt:publishToMavenLocal # Setup files required by test app for Device Farm testing - name: Setup Android Test Files diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bffc5079..43205a3f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,8 +148,6 @@ if (BUILD_DEPS) add_subdirectory(crt/s2n) endif() - message(FATAL_ERROR "enough") - add_subdirectory(crt/aws-c-sdkutils) add_subdirectory(crt/aws-c-io) add_subdirectory(crt/aws-c-cal) From 9dcea618ca7b7a17c5fd8e6caaa3a05db4b4609b Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 11 Oct 2024 15:19:00 -0700 Subject: [PATCH 30/70] CLean up --- CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43205a3f3..becb9ece0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,7 @@ if(NOT AWS_CMAKE_CL_ARGS) get_cmake_property(vars CACHE_VARIABLES) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) - message(WARNING "=== ${var}=${${var}}: ${currentHelpString}") if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") - message(WARNING "add var ${var}") list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") endif() endforeach() @@ -128,11 +126,11 @@ if (BUILD_DEPS) # Cross-compiling mode is used for Android, with some variables set via command line. Instead of adding # these variables one by one explicitly, we pass all cmd variables. list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) - - list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) endif() - message(WARNING "=== awslc cmake args: ${AWSLC_CMAKE_ARGUMENTS}") + # In case a custom generator was provided via -G option. If we don't propagate it, the default value might + # conflict with other cmake options (e.g. CMAKE_MAKE_PROGRAM). + list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. aws_prebuild_dependency( From e8b31fa1e7fce09f868564aa9116a59394e370f3 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Wed, 16 Oct 2024 15:52:38 -0700 Subject: [PATCH 31/70] test get_cmake_property --- CMakeLists.txt | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index becb9ece0..0e233070b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,15 +3,23 @@ cmake_minimum_required(VERSION 3.1) # Get list of variables provided via command line arguments. # MUST be done before call to 'project'. # Via https://cmake.org/pipermail/cmake/2018-January/067002.html +# if(NOT AWS_CMAKE_CL_ARGS) +# get_cmake_property(vars CACHE_VARIABLES) +# foreach(var ${vars}) +# get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) +# if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") +# list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") +# endif() +# endforeach() +# set(AWS_CMAKE_CL_ARGS ${AWS_CMAKE_CL_ARGS} CACHE STRING "Command line variables") +# endif() + if(NOT AWS_CMAKE_CL_ARGS) - get_cmake_property(vars CACHE_VARIABLES) - foreach(var ${vars}) - get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) - if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") - list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") - endif() - endforeach() - set(AWS_CMAKE_CL_ARGS ${AWS_CMAKE_CL_ARGS} CACHE STRING "Command line variables") +cmake_host_system_information(RESULT _cache_vars QUERY CMAKE_CACHE_VARIABLES) + +foreach(var IN LISTS _cache_vars) + list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") +endforeach() endif() project(aws-crt-jni C) From f85ad04205dbadcfccac9b6b9255579849803670 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Wed, 16 Oct 2024 16:12:20 -0700 Subject: [PATCH 32/70] Revert "test get_cmake_property" This reverts commit e8b31fa1e7fce09f868564aa9116a59394e370f3. --- CMakeLists.txt | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e233070b..becb9ece0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,23 +3,15 @@ cmake_minimum_required(VERSION 3.1) # Get list of variables provided via command line arguments. # MUST be done before call to 'project'. # Via https://cmake.org/pipermail/cmake/2018-January/067002.html -# if(NOT AWS_CMAKE_CL_ARGS) -# get_cmake_property(vars CACHE_VARIABLES) -# foreach(var ${vars}) -# get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) -# if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") -# list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") -# endif() -# endforeach() -# set(AWS_CMAKE_CL_ARGS ${AWS_CMAKE_CL_ARGS} CACHE STRING "Command line variables") -# endif() - if(NOT AWS_CMAKE_CL_ARGS) -cmake_host_system_information(RESULT _cache_vars QUERY CMAKE_CACHE_VARIABLES) - -foreach(var IN LISTS _cache_vars) - list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") -endforeach() + get_cmake_property(vars CACHE_VARIABLES) + foreach(var ${vars}) + get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) + if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") + list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") + endif() + endforeach() + set(AWS_CMAKE_CL_ARGS ${AWS_CMAKE_CL_ARGS} CACHE STRING "Command line variables") endif() project(aws-crt-jni C) From eecbf051015129f9b67fb58041729be4c0fd0a95 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 29 Oct 2024 09:48:11 -0700 Subject: [PATCH 33/70] Remove unnecessary flags --- CMakeLists.txt | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 025f57da6..41c52ea5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,25 +94,12 @@ if (BUILD_DEPS) endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") - # Build with Perl to avoid using pre-compiled binary with AVX512 - list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) # Disable AVX512 on old GCC that not supports it list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) endif() # temporarily disable certain warnings as errors for the aws-lc build set(AWSLC_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - if (NOT MSVC) - check_c_compiler_flag(-Wno-stringop-overflow HAS_WNO_STRINGOP_OVERFLOW) - if (HAS_WNO_STRINGOP_OVERFLOW) - set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-stringop-overflow") - endif() - - check_c_compiler_flag(-Wno-array-parameter HAS_WNO_ARRAY_PARAMETER) - if (HAS_WNO_ARRAY_PARAMETER) - set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-array-parameter") - endif() - endif() list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) if (ANDROID) From 2cc1092bf7fc8c2ef8515a2bb3c37764c6918df0 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 29 Oct 2024 09:49:24 -0700 Subject: [PATCH 34/70] Forward command line vars for all builds --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41c52ea5f..90fb39928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,12 +105,10 @@ if (BUILD_DEPS) if (ANDROID) list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${AWS_LIBRARY_OUTPUT_DIR}") - - # Cross-compiling mode is used for Android, with some variables set via command line. Instead of adding - # these variables one by one explicitly, we pass all cmd variables. - list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) endif() + list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) + # In case a custom generator was provided via -G option. If we don't propagate it, the default value might # conflict with other cmake options (e.g. CMAKE_MAKE_PROGRAM). list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) From d3107932bbc4ce2ad58f6fb63c598f057a7d8e59 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 09:45:27 -0800 Subject: [PATCH 35/70] Ignore some cmd line vars that --- CMakeLists.txt | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90fb39928..92794fb0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,41 @@ cmake_minimum_required(VERSION 3.9) -# Get list of variables provided via command line arguments. -# MUST be done before call to 'project'. -# Via https://cmake.org/pipermail/cmake/2018-January/067002.html -if(NOT AWS_CMAKE_CL_ARGS) +# TODO This function should be provided by aws-c-common +function(aws_get_cmd_arguments) + set(multiValueArgs VARS_TO_IGNORE) + cmake_parse_arguments(AWS_GET_CMD_ARGS "" "" "${multiValueArgs}" ${ARGN}) + + if (AWS_GET_CMD_ARGS_VARS_TO_IGNORE) + message(STATUS "Ignored vars: ${AWS_GET_CMD_ARGS_VARS_TO_IGNORE}") + endif() + + if (PROJECT_NAME) + message(WARNING "aws_get_cmd_arguments is called after project(), some variables may be missed") + endif() + + if (AWS_CMAKE_CMD_ARGS) + message(STATUS "AWS_CMAKE_CMD_ARGS variable is already set, resetting it") + set(AWS_CMAKE_CMD_ARGS "") + endif() + get_cmake_property(vars CACHE_VARIABLES) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) - if("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") - list(APPEND AWS_CMAKE_CL_ARGS "-D${var}=${${var}}") + if ("${currentHelpString}" MATCHES "No help, variable specified on the command line.") + if("${var}" IN_LIST AWS_GET_CMD_ARGS_VARS_TO_IGNORE) + continue() + endif() + set(escaped_var ${${var}}) + # To store a list within another list, it needs to be escaped first. + string(REPLACE ";" "\\\\;" escaped_var "${${var}}") + list(APPEND AWS_CMAKE_CMD_ARGS "-D${var}=${escaped_var}") endif() endforeach() - set(AWS_CMAKE_CL_ARGS ${AWS_CMAKE_CL_ARGS} CACHE STRING "Command line variables") -endif() + # Store cmd variables in the cache. + set(AWS_CMAKE_CMD_ARGS ${AWS_CMAKE_CMD_ARGS} CACHE STRING "Command line variables" FORCE) +endfunction() + +aws_get_cmd_arguments(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) project(aws-crt-jni C) option(BUILD_DEPS "Builds aws common runtime dependencies as part of build" ON) From a628d21bc277b5ac90b0919fb2ce8861ca1e2f0c Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 10:05:58 -0800 Subject: [PATCH 36/70] Dump aws-lc cmake args --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92794fb0f..a33e44eea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,8 @@ if (BUILD_DEPS) # conflict with other cmake options (e.g. CMAKE_MAKE_PROGRAM). list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) + message(WARNING "=== AWSLC_CMAKE_ARGUMENTS: ${AWSLC_CMAKE_ARGUMENTS}") + # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. aws_prebuild_dependency( DEPENDENCY_NAME AWSLC From 6f5e9c1ae47485b2089063c8d034d0fa7fc001ba Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 10:11:41 -0800 Subject: [PATCH 37/70] Debugging --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a33e44eea..61aa29c46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,8 +21,11 @@ function(aws_get_cmd_arguments) get_cmake_property(vars CACHE_VARIABLES) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) + message(WARNING "aws_get_cmd_arguments: ${var}: ${currentHelpString}") if ("${currentHelpString}" MATCHES "No help, variable specified on the command line.") + message(WARNING "Processing {$var}") if("${var}" IN_LIST AWS_GET_CMD_ARGS_VARS_TO_IGNORE) + message(WARNING "Ignore {$var}") continue() endif() set(escaped_var ${${var}}) From f9ca281410ffa17ecb1c3aea16fe320bfee3ccd6 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 10:16:38 -0800 Subject: [PATCH 38/70] Debugging --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61aa29c46..f73344c29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,11 +23,11 @@ function(aws_get_cmd_arguments) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) message(WARNING "aws_get_cmd_arguments: ${var}: ${currentHelpString}") if ("${currentHelpString}" MATCHES "No help, variable specified on the command line.") - message(WARNING "Processing {$var}") if("${var}" IN_LIST AWS_GET_CMD_ARGS_VARS_TO_IGNORE) - message(WARNING "Ignore {$var}") + message(WARNING "Skip ${var}") continue() endif() + message(WARNING "Add ${var}") set(escaped_var ${${var}}) # To store a list within another list, it needs to be escaped first. string(REPLACE ";" "\\\\;" escaped_var "${${var}}") From 527559a8adff8fd306a72754a9bd245695154b67 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 10:23:00 -0800 Subject: [PATCH 39/70] Fix var name --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f73344c29..98e1f30bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${AWS_LIBRARY_OUTPUT_DIR}") endif() - list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CL_ARGS}) + list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CMD_ARGS}) # In case a custom generator was provided via -G option. If we don't propagate it, the default value might # conflict with other cmake options (e.g. CMAKE_MAKE_PROGRAM). From e578a651977e553b334c5e186063f827e35d93aa Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 12:49:57 -0800 Subject: [PATCH 40/70] Debug build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3ce5d496..72938cc25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,7 +240,7 @@ jobs: # Build and publish locally for the test app to find the SNAPSHOT version - name: Build ${{ env.PACKAGE_NAME }} run: | - ./gradlew :android:crt:build + ./gradlew :android:crt:build --debug --stacktrace --scan ./gradlew -PnewVersion="1.0.0-SNAPSHOT" :android:crt:publishToMavenLocal # Setup files required by test app for Device Farm testing - name: Setup Android Test Files From eb79bb4ffe2f841d4d3f545fdb2f9ecd122260ea Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 13:10:44 -0800 Subject: [PATCH 41/70] Try to pass everything to lc --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98e1f30bb..7f7b1cfe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,13 +21,12 @@ function(aws_get_cmd_arguments) get_cmake_property(vars CACHE_VARIABLES) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) - message(WARNING "aws_get_cmd_arguments: ${var}: ${currentHelpString}") if ("${currentHelpString}" MATCHES "No help, variable specified on the command line.") if("${var}" IN_LIST AWS_GET_CMD_ARGS_VARS_TO_IGNORE) message(WARNING "Skip ${var}") continue() endif() - message(WARNING "Add ${var}") + message(WARNING "aws_get_cmd_arguments: ${var}=${${var}}") set(escaped_var ${${var}}) # To store a list within another list, it needs to be escaped first. string(REPLACE ";" "\\\\;" escaped_var "${${var}}") @@ -38,7 +37,7 @@ function(aws_get_cmd_arguments) set(AWS_CMAKE_CMD_ARGS ${AWS_CMAKE_CMD_ARGS} CACHE STRING "Command line variables" FORCE) endfunction() -aws_get_cmd_arguments(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) +aws_get_cmd_arguments() project(aws-crt-jni C) option(BUILD_DEPS "Builds aws common runtime dependencies as part of build" ON) From ba7be8b7263f62f72a07b8ba5ff3842a07b2654a Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 14:44:33 -0800 Subject: [PATCH 42/70] Try to disable warnings --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f7b1cfe5..de1d94ea9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,17 @@ if (BUILD_DEPS) # temporarily disable certain warnings as errors for the aws-lc build set(AWSLC_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + if (NOT MSVC) + check_c_compiler_flag(-Wno-stringop-overflow HAS_WNO_STRINGOP_OVERFLOW) + if (HAS_WNO_STRINGOP_OVERFLOW) + set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-stringop-overflow") + endif() + + check_c_compiler_flag(-Wno-array-parameter HAS_WNO_ARRAY_PARAMETER) + if (HAS_WNO_ARRAY_PARAMETER) + set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-array-parameter") + endif() + endif() list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) if (ANDROID) From f80623f07c1bb7411635c02ccb40b4b7337dff43 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 14:59:37 -0800 Subject: [PATCH 43/70] Enable perl --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index de1d94ea9..4635ad00f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,8 @@ if (BUILD_DEPS) endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") + # Build with Perl to avoid using pre-compiled binary with AVX512 + list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) # Disable AVX512 on old GCC that not supports it list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) endif() From 697f90cbfd020f78c3dc34d8994f626872afed00 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 15:13:32 -0800 Subject: [PATCH 44/70] Debugging --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72938cc25..f3ce5d496 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,7 +240,7 @@ jobs: # Build and publish locally for the test app to find the SNAPSHOT version - name: Build ${{ env.PACKAGE_NAME }} run: | - ./gradlew :android:crt:build --debug --stacktrace --scan + ./gradlew :android:crt:build ./gradlew -PnewVersion="1.0.0-SNAPSHOT" :android:crt:publishToMavenLocal # Setup files required by test app for Device Farm testing - name: Setup Android Test Files diff --git a/CMakeLists.txt b/CMakeLists.txt index 4635ad00f..86778fb6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ function(aws_get_cmd_arguments) get_cmake_property(vars CACHE_VARIABLES) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) - if ("${currentHelpString}" MATCHES "No help, variable specified on the command line.") + if ("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") if("${var}" IN_LIST AWS_GET_CMD_ARGS_VARS_TO_IGNORE) message(WARNING "Skip ${var}") continue() From 9b8975cb18265eaecc28558be4344c3230e28939 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 4 Nov 2024 15:43:29 -0800 Subject: [PATCH 45/70] cleanup --- CMakeLists.txt | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86778fb6c..d26403a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,12 +21,10 @@ function(aws_get_cmd_arguments) get_cmake_property(vars CACHE_VARIABLES) foreach(var ${vars}) get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) - if ("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "") + if ("${currentHelpString}" MATCHES "No help, variable specified on the command line.") if("${var}" IN_LIST AWS_GET_CMD_ARGS_VARS_TO_IGNORE) - message(WARNING "Skip ${var}") continue() endif() - message(WARNING "aws_get_cmd_arguments: ${var}=${${var}}") set(escaped_var ${${var}}) # To store a list within another list, it needs to be escaped first. string(REPLACE ";" "\\\\;" escaped_var "${${var}}") @@ -37,7 +35,9 @@ function(aws_get_cmd_arguments) set(AWS_CMAKE_CMD_ARGS ${AWS_CMAKE_CMD_ARGS} CACHE STRING "Command line variables" FORCE) endfunction() -aws_get_cmd_arguments() +# We gather command line arguments to pass them to dependencies that need to be prebuilt. +# Since these dependencies are supposed to be installed in custom directories, CMAKE_INSTALL_PREFIX should be omit. +aws_get_cmd_arguments(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) project(aws-crt-jni C) option(BUILD_DEPS "Builds aws common runtime dependencies as part of build" ON) @@ -119,25 +119,11 @@ if (BUILD_DEPS) endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") - # Build with Perl to avoid using pre-compiled binary with AVX512 - list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) # Disable AVX512 on old GCC that not supports it list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) endif() - # temporarily disable certain warnings as errors for the aws-lc build set(AWSLC_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - if (NOT MSVC) - check_c_compiler_flag(-Wno-stringop-overflow HAS_WNO_STRINGOP_OVERFLOW) - if (HAS_WNO_STRINGOP_OVERFLOW) - set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-stringop-overflow") - endif() - - check_c_compiler_flag(-Wno-array-parameter HAS_WNO_ARRAY_PARAMETER) - if (HAS_WNO_ARRAY_PARAMETER) - set(AWSLC_CMAKE_C_FLAGS "${AWSLC_CMAKE_C_FLAGS} -Wno-array-parameter") - endif() - endif() list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) if (ANDROID) @@ -151,8 +137,6 @@ if (BUILD_DEPS) # conflict with other cmake options (e.g. CMAKE_MAKE_PROGRAM). list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) - message(WARNING "=== AWSLC_CMAKE_ARGUMENTS: ${AWSLC_CMAKE_ARGUMENTS}") - # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. aws_prebuild_dependency( DEPENDENCY_NAME AWSLC From 0e08f6cab854d482a9f75a91f3cb392a42894a45 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 5 Nov 2024 11:47:13 -0800 Subject: [PATCH 46/70] Remove aws_get_cmd_arguments --- CMakeLists.txt | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d26403a77..8798ca435 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,40 +1,5 @@ cmake_minimum_required(VERSION 3.9) -# TODO This function should be provided by aws-c-common -function(aws_get_cmd_arguments) - set(multiValueArgs VARS_TO_IGNORE) - cmake_parse_arguments(AWS_GET_CMD_ARGS "" "" "${multiValueArgs}" ${ARGN}) - - if (AWS_GET_CMD_ARGS_VARS_TO_IGNORE) - message(STATUS "Ignored vars: ${AWS_GET_CMD_ARGS_VARS_TO_IGNORE}") - endif() - - if (PROJECT_NAME) - message(WARNING "aws_get_cmd_arguments is called after project(), some variables may be missed") - endif() - - if (AWS_CMAKE_CMD_ARGS) - message(STATUS "AWS_CMAKE_CMD_ARGS variable is already set, resetting it") - set(AWS_CMAKE_CMD_ARGS "") - endif() - - get_cmake_property(vars CACHE_VARIABLES) - foreach(var ${vars}) - get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING) - if ("${currentHelpString}" MATCHES "No help, variable specified on the command line.") - if("${var}" IN_LIST AWS_GET_CMD_ARGS_VARS_TO_IGNORE) - continue() - endif() - set(escaped_var ${${var}}) - # To store a list within another list, it needs to be escaped first. - string(REPLACE ";" "\\\\;" escaped_var "${${var}}") - list(APPEND AWS_CMAKE_CMD_ARGS "-D${var}=${escaped_var}") - endif() - endforeach() - # Store cmd variables in the cache. - set(AWS_CMAKE_CMD_ARGS ${AWS_CMAKE_CMD_ARGS} CACHE STRING "Command line variables" FORCE) -endfunction() - # We gather command line arguments to pass them to dependencies that need to be prebuilt. # Since these dependencies are supposed to be installed in custom directories, CMAKE_INSTALL_PREFIX should be omit. aws_get_cmd_arguments(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) From d4da30734bca799391ac9abad816cb2229c5bf29 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 5 Nov 2024 12:46:32 -0800 Subject: [PATCH 47/70] Use aws-c-common branch with aws_get_cmd_arguments --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index f41b772f0..ceed4394e 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit f41b772f0de9454a4e7a65750b58c2379533bbf1 +Subproject commit ceed4394e361379c6ae9b1185c9f4f8284d3300c From 02e5e59a4b4f773e6004809576e3b5fc8f5c34a3 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Tue, 5 Nov 2024 12:53:38 -0800 Subject: [PATCH 48/70] Include missing AwsGetCmdArguments --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8798ca435..fe2d97ed4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.9) # We gather command line arguments to pass them to dependencies that need to be prebuilt. # Since these dependencies are supposed to be installed in custom directories, CMAKE_INSTALL_PREFIX should be omit. +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") +include(AwsGetCmdArguments) aws_get_cmd_arguments(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) project(aws-crt-jni C) @@ -53,7 +55,6 @@ if (ANDROID) endif() if (BUILD_DEPS) - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") include(AwsFindPackage) set(IN_SOURCE_BUILD ON) From 156420a582fa2a6bc531fae982eaa0ee41a8b9e9 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 6 Nov 2024 15:06:28 -0800 Subject: [PATCH 49/70] Prebuild aws-lc through pom.xml --- CMakeLists.txt | 49 ++-------------------- pom.xml | 58 ++++++++++++++++++++++++-- prebuild_configs/aws-lc/CMakeLists.txt | 37 ++++++++++++++++ 3 files changed, 95 insertions(+), 49 deletions(-) create mode 100644 prebuild_configs/aws-lc/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index fe2d97ed4..9e1f1f112 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,57 +61,16 @@ if (BUILD_DEPS) set(BUILD_TESTING OFF) add_subdirectory(crt/aws-c-common) if (UNIX AND NOT APPLE) - include(AwsPrebuildDependency) - - set(AWSLC_CMAKE_ARGUMENTS - -DBUILD_LIBSSL=OFF - -DBUILD_TESTING=OFF - ) - message("Build with FIPS: " ${CRT_FIPS}) if (CRT_FIPS) set(FIPS ON CACHE BOOL "FIPS compliance") - list(APPEND AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) - - if (DEFINED ENV{GO_PATH}) - set(GO_EXECUTABLE $ENV{GO_PATH}/go) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=${GO_EXECUTABLE}) - message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") - endif() - else() - list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=ON) # Disable codegen - list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_GO=ON) # Disable codegen endif() - if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") - # Disable AVX512 on old GCC that not supports it - list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) - endif() - - set(AWSLC_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) - - if (ANDROID) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${AWS_LIBRARY_OUTPUT_DIR}") - endif() - - list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CMD_ARGS}) - - # In case a custom generator was provided via -G option. If we don't propagate it, the default value might - # conflict with other cmake options (e.g. CMAKE_MAKE_PROGRAM). - list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) - - # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. - aws_prebuild_dependency( - DEPENDENCY_NAME AWSLC - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/crt/aws-lc - CMAKE_ARGUMENTS ${AWSLC_CMAKE_ARGUMENTS} - ) + # TODO CMAKE_FIND_ROOT_PATH is used in cross-compiling mode. + # list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) - # CMAKE_FIND_ROOT_PATH is used in cross-compiling mode. - list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) + # aws-c-cal supports both in-source and prebuilt aws-lc. Set this variable to expect prebuilt version. + set(AWSLC_PREBUILT TRUE CACHE INTERNAL "Dependency is built and can be used") set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) diff --git a/pom.xml b/pom.xml index 340a327ce..2a132fcfa 100644 --- a/pom.xml +++ b/pom.xml @@ -159,7 +159,57 @@ exec-maven-plugin 1.3.2 - + + + cmake-configure-aws-lc + generate-resources + + exec + + + ${cmake.command} + ${project.basedir} + + -B${cmake.binaries}/aws-lc + -H${project.basedir}/prebuild_configs/aws-lc + -DCMAKE_BUILD_TYPE=${cmake.buildtype} + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -DAWS_WARNINGS_ARE_ERRORS=${cmake.warningsareerrors} + -DCMAKE_PREFIX_PATH=${project.basedir}/${cmake.binaries}/install + -DCMAKE_INSTALL_PREFIX=${project.basedir}/${cmake.binaries}/install + -DCMAKE_C_FLAGS=${cmake.cflags} + -DBUILD_LIBSSL=OFF + ${cmake.min_osx_version} + ${cmake.osx_arch} + -DBUILD_TESTING=OFF + --no-warn-unused-cli + ${cmake.generator} + ${cmake.toolset} + + + + + + make-aws-lc + generate-resources + + exec + + + ${cmake.command} + ${cmake.binaries}/aws-lc + + --build + . + --config + ${cmake.buildconfig} + --target + + install + + + + cmake-configure generate-resources @@ -176,8 +226,8 @@ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_DEPS=ON -DAWS_WARNINGS_ARE_ERRORS=${cmake.warningsareerrors} - -DCMAKE_PREFIX_PATH=${cmake.binaries}/install - -DCMAKE_INSTALL_PREFIX=${cmake.binaries}/install + -DCMAKE_PREFIX_PATH=${project.basedir}/${cmake.binaries}/install + -DCMAKE_INSTALL_PREFIX=${project.basedir}/${cmake.binaries}/install -DCMAKE_C_FLAGS=${cmake.cflags} ${cmake.min_osx_version} ${cmake.osx_arch} @@ -190,7 +240,7 @@ - + make generate-resources diff --git a/prebuild_configs/aws-lc/CMakeLists.txt b/prebuild_configs/aws-lc/CMakeLists.txt new file mode 100644 index 000000000..fc6998411 --- /dev/null +++ b/prebuild_configs/aws-lc/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.9) + +project(prebuild-aws-lc C) + +option(CRT_FIPS "Whether to build aws-lc with FIPS compliance" OFF) + +if (ANDROID) + set(ANDROID_DEPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/target/cmake-build/deps/${ANDROID_ABI}) + set(AWS_LIBRARY_OUTPUT_DIR "${CMAKE_BINARY_DIR}/../../../lib") +endif() + +if (UNIX AND NOT APPLE) + set(IN_SOURCE_BUILD ON) + set(BUILD_TESTING OFF) + set(BUILD_LIBSSL OFF CACHE BOOL "Don't need libssl, only need libcrypto") + message("Build with FIPS: " ${CRT_FIPS}) + if (CRT_FIPS) + set(FIPS ON CACHE BOOL "FIPS compliance") + set(PERL_EXECUTABLE "perl") + if (DEFINED ENV{GO_PATH}) + set(GO_EXECUTABLE $ENV{GO_PATH}/go) + message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") + endif() + else() + set(DISABLE_PERL ON CACHE BOOL "Disable codegen") + set(DISABLE_GO ON CACHE BOOL "Disable codegen") + endif() + + if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") + set(PERL_EXECUTABLE "perl") + set(MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX ON CACHE BOOL "Disable AVX512 on old GCC that not supports it") + endif() + + add_subdirectory(../../crt/aws-lc ${CMAKE_BINARY_DIR}/aws-lc) +else() + install(CODE "MESSAGE(\"Nothing to install.\")") +endif() From 1b9d46300117d802d502b6a6ec5e1198d70a142e Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 6 Nov 2024 15:09:35 -0800 Subject: [PATCH 50/70] Revert aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index ceed4394e..f41b772f0 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit ceed4394e361379c6ae9b1185c9f4f8284d3300c +Subproject commit f41b772f0de9454a4e7a65750b58c2379533bbf1 From 8bfde9604ba199cab798266b2c2a845c22b8ae05 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 6 Nov 2024 15:11:05 -0800 Subject: [PATCH 51/70] Set CMAKE_FIND_ROOT_PATH --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e1f1f112..7bd35019b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,8 +66,8 @@ if (BUILD_DEPS) set(FIPS ON CACHE BOOL "FIPS compliance") endif() - # TODO CMAKE_FIND_ROOT_PATH is used in cross-compiling mode. - # list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) + # CMAKE_FIND_ROOT_PATH is used in cross-compiling mode. + list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) # aws-c-cal supports both in-source and prebuilt aws-lc. Set this variable to expect prebuilt version. set(AWSLC_PREBUILT TRUE CACHE INTERNAL "Dependency is built and can be used") From 7c41432a8c4088b50eddd9b062b14cd35f21e58b Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 6 Nov 2024 15:18:55 -0800 Subject: [PATCH 52/70] Remove aws_get_cmd_arguments --- CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bd35019b..1760b3eae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,5 @@ cmake_minimum_required(VERSION 3.9) -# We gather command line arguments to pass them to dependencies that need to be prebuilt. -# Since these dependencies are supposed to be installed in custom directories, CMAKE_INSTALL_PREFIX should be omit. -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") -include(AwsGetCmdArguments) -aws_get_cmd_arguments(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) - project(aws-crt-jni C) option(BUILD_DEPS "Builds aws common runtime dependencies as part of build" ON) option(CRT_FIPS "Whether to build aws-lc with FIPS compliance" OFF) @@ -55,6 +49,7 @@ if (ANDROID) endif() if (BUILD_DEPS) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") include(AwsFindPackage) set(IN_SOURCE_BUILD ON) From 0d6ebbfd0745d54246f638a385f534fe1b00202b Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 6 Nov 2024 15:19:16 -0800 Subject: [PATCH 53/70] Expand comment --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1760b3eae..a41ad22e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,9 @@ if (BUILD_DEPS) # CMAKE_FIND_ROOT_PATH is used in cross-compiling mode. list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) - # aws-c-cal supports both in-source and prebuilt aws-lc. Set this variable to expect prebuilt version. + # aws-c-cal supports both in-source and prebuilt aws-lc. + # Set this variable, so aws-c-cal will expect a prebuilt version. + # NOTE: aws-lc prebuilding happens in pom.xml. set(AWSLC_PREBUILT TRUE CACHE INTERNAL "Dependency is built and can be used") set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") From 13ef4a4590f22a7c4d4d3712053995bc01174b61 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 6 Nov 2024 16:02:30 -0800 Subject: [PATCH 54/70] Fixing armv7 --- builder.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/builder.json b/builder.json index feab51b6b..bad5327aa 100644 --- a/builder.json +++ b/builder.json @@ -124,13 +124,16 @@ "armv7": { "!packages": [], "!build_steps": [ + "cmake -S prebuild_configs/aws-lc -B kokoko -DCMAKE_INSTALL_PREFIX={source_dir}/build/prebuild-aws-lc", + "cmake --build kokoko --target install", "build" ], "!test_steps": [], "!cmake_args": [ "-DCMAKE_BUILD_TYPE=Release", "-DBUILD_DEPS=ON", - "-DBUILD_TESTING=OFF" + "-DBUILD_TESTING=OFF", + "-DCMAKE_PREFIX_PATH={source_dir}/build/prebuild-aws-lc" ] }, "arm64": { From 721bb2e4a8037ca46545b9766acd5ad9d91f6587 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 6 Nov 2024 16:06:57 -0800 Subject: [PATCH 55/70] Another try --- builder.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/builder.json b/builder.json index bad5327aa..6a5691c54 100644 --- a/builder.json +++ b/builder.json @@ -53,13 +53,16 @@ "armv7": { "!packages": [], "!build_steps": [ + "cmake -S prebuild_configs/aws-lc -B {source_dir}/build/prebuild-aws-lc -DCMAKE_INSTALL_PREFIX={source_dir}/build/prebuild-aws-lc/install", + "cmake --build {source_dir}/build/prebuild-aws-lc --target install", "build" ], "!test_steps": [], "!cmake_args": [ "-DCMAKE_BUILD_TYPE=Release", "-DBUILD_DEPS=ON", - "-DBUILD_TESTING=OFF" + "-DBUILD_TESTING=OFF", + "-DCMAKE_PREFIX_PATH={source_dir}/build/prebuild-aws-lc/install" ] }, "arm64": { From 3016c665a10682007ffb87a7c56784ca7edcf9b0 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 7 Nov 2024 13:11:56 -0800 Subject: [PATCH 56/70] Revert back to cmd args --- CMakeLists.txt | 56 ++++++++++++++++++++++--- builder.json | 10 +---- pom.xml | 58 ++------------------------ prebuild_configs/aws-lc/CMakeLists.txt | 37 ---------------- 4 files changed, 56 insertions(+), 105 deletions(-) delete mode 100644 prebuild_configs/aws-lc/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index a41ad22e9..fe2d97ed4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,11 @@ cmake_minimum_required(VERSION 3.9) +# We gather command line arguments to pass them to dependencies that need to be prebuilt. +# Since these dependencies are supposed to be installed in custom directories, CMAKE_INSTALL_PREFIX should be omit. +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") +include(AwsGetCmdArguments) +aws_get_cmd_arguments(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) + project(aws-crt-jni C) option(BUILD_DEPS "Builds aws common runtime dependencies as part of build" ON) option(CRT_FIPS "Whether to build aws-lc with FIPS compliance" OFF) @@ -49,26 +55,64 @@ if (ANDROID) endif() if (BUILD_DEPS) - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") include(AwsFindPackage) set(IN_SOURCE_BUILD ON) set(BUILD_TESTING OFF) add_subdirectory(crt/aws-c-common) if (UNIX AND NOT APPLE) + include(AwsPrebuildDependency) + + set(AWSLC_CMAKE_ARGUMENTS + -DBUILD_LIBSSL=OFF + -DBUILD_TESTING=OFF + ) + message("Build with FIPS: " ${CRT_FIPS}) if (CRT_FIPS) set(FIPS ON CACHE BOOL "FIPS compliance") + list(APPEND AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) + + if (DEFINED ENV{GO_PATH}) + set(GO_EXECUTABLE $ENV{GO_PATH}/go) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=${GO_EXECUTABLE}) + message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") + endif() + else() + list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=ON) # Disable codegen + list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_GO=ON) # Disable codegen + endif() + + if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") + # Disable AVX512 on old GCC that not supports it + list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) + endif() + + set(AWSLC_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) + + if (ANDROID) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${AWS_LIBRARY_OUTPUT_DIR}") endif() + list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CMD_ARGS}) + + # In case a custom generator was provided via -G option. If we don't propagate it, the default value might + # conflict with other cmake options (e.g. CMAKE_MAKE_PROGRAM). + list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) + + # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. + aws_prebuild_dependency( + DEPENDENCY_NAME AWSLC + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/crt/aws-lc + CMAKE_ARGUMENTS ${AWSLC_CMAKE_ARGUMENTS} + ) + # CMAKE_FIND_ROOT_PATH is used in cross-compiling mode. list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) - # aws-c-cal supports both in-source and prebuilt aws-lc. - # Set this variable, so aws-c-cal will expect a prebuilt version. - # NOTE: aws-lc prebuilding happens in pom.xml. - set(AWSLC_PREBUILT TRUE CACHE INTERNAL "Dependency is built and can be used") - set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) endif() diff --git a/builder.json b/builder.json index 6a5691c54..feab51b6b 100644 --- a/builder.json +++ b/builder.json @@ -53,16 +53,13 @@ "armv7": { "!packages": [], "!build_steps": [ - "cmake -S prebuild_configs/aws-lc -B {source_dir}/build/prebuild-aws-lc -DCMAKE_INSTALL_PREFIX={source_dir}/build/prebuild-aws-lc/install", - "cmake --build {source_dir}/build/prebuild-aws-lc --target install", "build" ], "!test_steps": [], "!cmake_args": [ "-DCMAKE_BUILD_TYPE=Release", "-DBUILD_DEPS=ON", - "-DBUILD_TESTING=OFF", - "-DCMAKE_PREFIX_PATH={source_dir}/build/prebuild-aws-lc/install" + "-DBUILD_TESTING=OFF" ] }, "arm64": { @@ -127,16 +124,13 @@ "armv7": { "!packages": [], "!build_steps": [ - "cmake -S prebuild_configs/aws-lc -B kokoko -DCMAKE_INSTALL_PREFIX={source_dir}/build/prebuild-aws-lc", - "cmake --build kokoko --target install", "build" ], "!test_steps": [], "!cmake_args": [ "-DCMAKE_BUILD_TYPE=Release", "-DBUILD_DEPS=ON", - "-DBUILD_TESTING=OFF", - "-DCMAKE_PREFIX_PATH={source_dir}/build/prebuild-aws-lc" + "-DBUILD_TESTING=OFF" ] }, "arm64": { diff --git a/pom.xml b/pom.xml index 2a132fcfa..340a327ce 100644 --- a/pom.xml +++ b/pom.xml @@ -159,57 +159,7 @@ exec-maven-plugin 1.3.2 - - - cmake-configure-aws-lc - generate-resources - - exec - - - ${cmake.command} - ${project.basedir} - - -B${cmake.binaries}/aws-lc - -H${project.basedir}/prebuild_configs/aws-lc - -DCMAKE_BUILD_TYPE=${cmake.buildtype} - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - -DAWS_WARNINGS_ARE_ERRORS=${cmake.warningsareerrors} - -DCMAKE_PREFIX_PATH=${project.basedir}/${cmake.binaries}/install - -DCMAKE_INSTALL_PREFIX=${project.basedir}/${cmake.binaries}/install - -DCMAKE_C_FLAGS=${cmake.cflags} - -DBUILD_LIBSSL=OFF - ${cmake.min_osx_version} - ${cmake.osx_arch} - -DBUILD_TESTING=OFF - --no-warn-unused-cli - ${cmake.generator} - ${cmake.toolset} - - - - - - make-aws-lc - generate-resources - - exec - - - ${cmake.command} - ${cmake.binaries}/aws-lc - - --build - . - --config - ${cmake.buildconfig} - --target - - install - - - - + cmake-configure generate-resources @@ -226,8 +176,8 @@ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_DEPS=ON -DAWS_WARNINGS_ARE_ERRORS=${cmake.warningsareerrors} - -DCMAKE_PREFIX_PATH=${project.basedir}/${cmake.binaries}/install - -DCMAKE_INSTALL_PREFIX=${project.basedir}/${cmake.binaries}/install + -DCMAKE_PREFIX_PATH=${cmake.binaries}/install + -DCMAKE_INSTALL_PREFIX=${cmake.binaries}/install -DCMAKE_C_FLAGS=${cmake.cflags} ${cmake.min_osx_version} ${cmake.osx_arch} @@ -240,7 +190,7 @@ - + make generate-resources diff --git a/prebuild_configs/aws-lc/CMakeLists.txt b/prebuild_configs/aws-lc/CMakeLists.txt deleted file mode 100644 index fc6998411..000000000 --- a/prebuild_configs/aws-lc/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.9) - -project(prebuild-aws-lc C) - -option(CRT_FIPS "Whether to build aws-lc with FIPS compliance" OFF) - -if (ANDROID) - set(ANDROID_DEPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/target/cmake-build/deps/${ANDROID_ABI}) - set(AWS_LIBRARY_OUTPUT_DIR "${CMAKE_BINARY_DIR}/../../../lib") -endif() - -if (UNIX AND NOT APPLE) - set(IN_SOURCE_BUILD ON) - set(BUILD_TESTING OFF) - set(BUILD_LIBSSL OFF CACHE BOOL "Don't need libssl, only need libcrypto") - message("Build with FIPS: " ${CRT_FIPS}) - if (CRT_FIPS) - set(FIPS ON CACHE BOOL "FIPS compliance") - set(PERL_EXECUTABLE "perl") - if (DEFINED ENV{GO_PATH}) - set(GO_EXECUTABLE $ENV{GO_PATH}/go) - message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") - endif() - else() - set(DISABLE_PERL ON CACHE BOOL "Disable codegen") - set(DISABLE_GO ON CACHE BOOL "Disable codegen") - endif() - - if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.0") - set(PERL_EXECUTABLE "perl") - set(MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX ON CACHE BOOL "Disable AVX512 on old GCC that not supports it") - endif() - - add_subdirectory(../../crt/aws-lc ${CMAKE_BINARY_DIR}/aws-lc) -else() - install(CODE "MESSAGE(\"Nothing to install.\")") -endif() From 1fa032ef32f316589902f91ef207680b9d640f2b Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 7 Nov 2024 13:35:44 -0800 Subject: [PATCH 57/70] Update aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index f41b772f0..3b06022ac 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit f41b772f0de9454a4e7a65750b58c2379533bbf1 +Subproject commit 3b06022ac4c8836dc14851b7c6157cc18a311bac From 3e6c138d162fb911a9414d0258e2aac38fd4351d Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 7 Nov 2024 13:41:48 -0800 Subject: [PATCH 58/70] Debugging --- CMakeLists.txt | 10 ++++++++-- crt/aws-c-common | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe2d97ed4..e56be55d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,16 @@ cmake_minimum_required(VERSION 3.9) # Since these dependencies are supposed to be installed in custom directories, CMAKE_INSTALL_PREFIX should be omit. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") include(AwsGetCmdArguments) -aws_get_cmd_arguments(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) +include(AwsPrebuildDependency) + +aws_get_cmd_arguments_for_prebuild_dependency(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) +message(WARNING "==== before project: ${AWS_CMAKE_CMD_ARGS}") project(aws-crt-jni C) + +aws_get_cmd_arguments_for_prebuild_dependency(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) +message(WARNING "==== after project: ${AWS_CMAKE_CMD_ARGS}") + option(BUILD_DEPS "Builds aws common runtime dependencies as part of build" ON) option(CRT_FIPS "Whether to build aws-lc with FIPS compliance" OFF) @@ -61,7 +68,6 @@ if (BUILD_DEPS) set(BUILD_TESTING OFF) add_subdirectory(crt/aws-c-common) if (UNIX AND NOT APPLE) - include(AwsPrebuildDependency) set(AWSLC_CMAKE_ARGUMENTS -DBUILD_LIBSSL=OFF diff --git a/crt/aws-c-common b/crt/aws-c-common index 3b06022ac..d1fa8fa9b 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 3b06022ac4c8836dc14851b7c6157cc18a311bac +Subproject commit d1fa8fa9b53ae7dee0a2d6fbf68b05aaae9c9229 From 3327913c7ee908a8636ea5f575c3dd8613d3795e Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 7 Nov 2024 13:53:35 -0800 Subject: [PATCH 59/70] Update aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index d1fa8fa9b..921950a7a 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit d1fa8fa9b53ae7dee0a2d6fbf68b05aaae9c9229 +Subproject commit 921950a7a745c837f59f20e69e4e9b22a85ab23f From 428452735d53bd579250d136c3b870b6d87cfea6 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 8 Nov 2024 14:32:36 -0800 Subject: [PATCH 60/70] Update aws-c-common --- CMakeLists.txt | 16 ++-------------- crt/aws-c-common | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e56be55d3..c02ba3d56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,6 @@ cmake_minimum_required(VERSION 3.9) -# We gather command line arguments to pass them to dependencies that need to be prebuilt. -# Since these dependencies are supposed to be installed in custom directories, CMAKE_INSTALL_PREFIX should be omit. -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") -include(AwsGetCmdArguments) -include(AwsPrebuildDependency) - -aws_get_cmd_arguments_for_prebuild_dependency(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) -message(WARNING "==== before project: ${AWS_CMAKE_CMD_ARGS}") - project(aws-crt-jni C) - -aws_get_cmd_arguments_for_prebuild_dependency(VARS_TO_IGNORE CMAKE_INSTALL_PREFIX) -message(WARNING "==== after project: ${AWS_CMAKE_CMD_ARGS}") - option(BUILD_DEPS "Builds aws common runtime dependencies as part of build" ON) option(CRT_FIPS "Whether to build aws-lc with FIPS compliance" OFF) @@ -62,12 +49,14 @@ if (ANDROID) endif() if (BUILD_DEPS) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-c-common/cmake") include(AwsFindPackage) set(IN_SOURCE_BUILD ON) set(BUILD_TESTING OFF) add_subdirectory(crt/aws-c-common) if (UNIX AND NOT APPLE) + include(AwsPrebuildDependency) set(AWSLC_CMAKE_ARGUMENTS -DBUILD_LIBSSL=OFF @@ -122,7 +111,6 @@ if (BUILD_DEPS) set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) endif() - add_subdirectory(crt/aws-c-sdkutils) add_subdirectory(crt/aws-c-io) add_subdirectory(crt/aws-c-cal) diff --git a/crt/aws-c-common b/crt/aws-c-common index 921950a7a..f2cd1e75f 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 921950a7a745c837f59f20e69e4e9b22a85ab23f +Subproject commit f2cd1e75fa75bf33aadc438030341fb8f34bf50f From 2ac906f2b157b50159d467530972a87a5a537b13 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 8 Nov 2024 14:39:19 -0800 Subject: [PATCH 61/70] Update aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index f2cd1e75f..70ec6a2f6 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit f2cd1e75fa75bf33aadc438030341fb8f34bf50f +Subproject commit 70ec6a2f6aaa022a744c9c11e0215e9799d58658 From 79f32957e0436098804c0a2cbdf096e42cbabd78 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 8 Nov 2024 14:47:46 -0800 Subject: [PATCH 62/70] Update aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index 70ec6a2f6..4e855e981 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 70ec6a2f6aaa022a744c9c11e0215e9799d58658 +Subproject commit 4e855e9819aa0b8b5de1887ef285845e23608f10 From 1eb97b1d251631e7b7e9b974aad4f41c364efd13 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 8 Nov 2024 15:30:09 -0800 Subject: [PATCH 63/70] Remove vars handled by aws_prebuild_dependency --- CMakeLists.txt | 9 --------- crt/aws-c-common | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c02ba3d56..8df02e0d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,20 +84,11 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=ON) endif() - set(AWSLC_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - list(APPEND AWSLC_CMAKE_ARGUMENTS -DCMAKE_C_FLAGS=${AWSLC_CMAKE_C_FLAGS}) - if (ANDROID) list(APPEND AWSLC_CMAKE_ARGUMENTS -DANDROID_DEPS_DIR=${ANDROID_DEPS_DIR}) list(APPEND AWSLC_CMAKE_ARGUMENTS -DAWS_LIBRARY_OUTPUT_DIR="${AWS_LIBRARY_OUTPUT_DIR}") endif() - list(APPEND AWSLC_CMAKE_ARGUMENTS ${AWS_CMAKE_CMD_ARGS}) - - # In case a custom generator was provided via -G option. If we don't propagate it, the default value might - # conflict with other cmake options (e.g. CMAKE_MAKE_PROGRAM). - list(APPEND AWSLC_CMAKE_ARGUMENTS -G${CMAKE_GENERATOR}) - # s2n-tls uses libcrypto during its configuration, so we need to prebuild aws-lc. aws_prebuild_dependency( DEPENDENCY_NAME AWSLC diff --git a/crt/aws-c-common b/crt/aws-c-common index 4e855e981..4c034b612 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 4e855e9819aa0b8b5de1887ef285845e23608f10 +Subproject commit 4c034b612d9c2f1fe6e41a6759cf29cd1c3d5495 From a89a6f343b02ab283d96d8d21a3c553114727a8b Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Fri, 8 Nov 2024 15:40:11 -0800 Subject: [PATCH 64/70] Do not set CMAKE_FIND_ROOT_PATH --- CMakeLists.txt | 3 --- crt/aws-c-common | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8df02e0d2..e207f31be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,9 +96,6 @@ if (BUILD_DEPS) CMAKE_ARGUMENTS ${AWSLC_CMAKE_ARGUMENTS} ) - # CMAKE_FIND_ROOT_PATH is used in cross-compiling mode. - list(INSERT CMAKE_FIND_ROOT_PATH 0 ${CMAKE_PREFIX_PATH}) - set(UNSAFE_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Disable warnings-as-errors when building S2N") add_subdirectory(crt/s2n) endif() diff --git a/crt/aws-c-common b/crt/aws-c-common index 4c034b612..a13540b38 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 4c034b612d9c2f1fe6e41a6759cf29cd1c3d5495 +Subproject commit a13540b38b8f88f892c714e31b73a8342b61a644 From 20638f6a201bbd9d063298a75209e3726fe90c34 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 14 Nov 2024 11:03:56 -0800 Subject: [PATCH 65/70] Update aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index a13540b38..c6cb3cd4d 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit a13540b38b8f88f892c714e31b73a8342b61a644 +Subproject commit c6cb3cd4d1e3ceaa03e6f1ac547b1f3a2e2a3a24 From 76f39d9189675cbd4e8ad324a2daf67dabbd7d38 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Thu, 14 Nov 2024 11:17:44 -0800 Subject: [PATCH 66/70] Update aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index c6cb3cd4d..394448393 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit c6cb3cd4d1e3ceaa03e6f1ac547b1f3a2e2a3a24 +Subproject commit 3944483936de23615cf2c6b8f8ae1f0c812761f8 From daa1e3d3fdc6dc5fec62d4638a79d5a48adfe08e Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 25 Nov 2024 15:44:12 -0800 Subject: [PATCH 67/70] Update aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index 394448393..2daea2718 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 3944483936de23615cf2c6b8f8ae1f0c812761f8 +Subproject commit 2daea2718ae413f6bf6c865969036276c974491a From 43e83aa066264fdfa898590c8420b3520dfcbf65 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 27 Nov 2024 11:14:29 -0800 Subject: [PATCH 68/70] Use tag for aws-c-common --- crt/aws-c-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index 2daea2718..be8ed873a 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 2daea2718ae413f6bf6c865969036276c974491a +Subproject commit be8ed873a5baf0239bf4941df75904c3053cd509 From 1c7118cce400d75ed1e0b1e9901be427fae33226 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 27 Nov 2024 15:28:26 -0800 Subject: [PATCH 69/70] Remove unused vars --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e207f31be..912130dfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,12 +65,10 @@ if (BUILD_DEPS) message("Build with FIPS: " ${CRT_FIPS}) if (CRT_FIPS) - set(FIPS ON CACHE BOOL "FIPS compliance") list(APPEND AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) if (DEFINED ENV{GO_PATH}) - set(GO_EXECUTABLE $ENV{GO_PATH}/go) list(APPEND AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=${GO_EXECUTABLE}) message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") endif() @@ -120,7 +118,7 @@ include(AwsPlatformDetect) include(AwsSharedLibSetup) include(AwsCRuntime) -if (CRT_FIPS AND NOT FIPS) +if (CRT_FIPS AND NOT AWSLC_PREBUILT) message(FATAL_ERROR "CRT_FIPS can only be set when build with aws-lc.") endif() From 79fd28d02a42ef63b7d7dcbba485b024fa9aabcb Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Wed, 27 Nov 2024 15:32:26 -0800 Subject: [PATCH 70/70] fips fixup --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 912130dfc..8f49fd86e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) if (DEFINED ENV{GO_PATH}) - list(APPEND AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=${GO_EXECUTABLE}) + list(APPEND AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=$ENV{GO_PATH}/go) message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") endif() else()