From 80c0636e0197af68c5aad83c521fb129b3dee79a Mon Sep 17 00:00:00 2001 From: "G. Bazior" Date: Fri, 20 Oct 2023 14:01:12 +0200 Subject: [PATCH] Repairing MacOs build on develop (#3977) * Turn macos on on CI Signed-off-by: safinsaf * Debug matrix Signed-off-by: safinsaf * Check comment body Signed-off-by: safinsaf * Check new line Signed-off-by: safinsaf * Check new line Signed-off-by: safinsaf * Check new line Signed-off-by: safinsaf * Remove debug data Signed-off-by: safinsaf * Try gcc for mac Signed-off-by: safinsaf * Try gcc-10 Signed-off-by: safinsaf * Debug macos Signed-off-by: safinsaf * Update gen matrix file Signed-off-by: safinsaf * Added patch which is fixing vcpkg dependency build of GTest library on MacOS by removing -Werror flag Signed-off-by: Grzegorz Bazior (Yodiss PSA) * Disabled compilation of iroha-lib for MacOS Signed-off-by: Grzegorz Bazior (Yodiss PSA) * Move to clang Signed-off-by: safinsaf --------- Signed-off-by: safinsaf Signed-off-by: Grzegorz Bazior (Yodiss PSA) Co-authored-by: safinsaf Co-authored-by: Grzegorz Bazior (Yodiss PSA) --- .github/build-iroha1.src.yml | 5 +- .github/chatops-gen-matrix.sh | 2 +- .github/workflows/build-iroha1.yml | 5 +- iroha-lib/examples/CMakeLists.txt | 78 ++++++++++--------- ...014-gtest-remove-werror-compile-flag.patch | 38 +++++++++ 5 files changed, 86 insertions(+), 42 deletions(-) create mode 100644 vcpkg/patches/0014-gtest-remove-werror-compile-flag.patch diff --git a/.github/build-iroha1.src.yml b/.github/build-iroha1.src.yml index d0398abf244..6501a6dc97b 100644 --- a/.github/build-iroha1.src.yml +++ b/.github/build-iroha1.src.yml @@ -208,10 +208,10 @@ jobs: true else #echo >/tmp/comment_body "/build debug; /build ubuntu release debug normal" - echo >/tmp/comment_body "/build ubuntu debug release normal gcc-10" + echo >/tmp/comment_body "/build ubuntu debug release normal gcc-10"$'\n' "/build macos debug clang" fi ;; push) commit_message_body_build_spec >/tmp/comment_body || { - echo "/build macos ubuntu debug release normal gcc-10" + echo "/build ubuntu debug release normal gcc-10" } >/tmp/comment_body ;; workflow_dispatch) echo >/tmp/comment_body "${{github.event.inputs.build_spec}}" ;; *) echo >&2 "::error::Unexpected event"; false ;; @@ -221,6 +221,7 @@ jobs: id: matrixes run: | set -x + cat /tmp/comment_body cat /tmp/comment_body | .github/chatops-gen-matrix.sh echo "::set-output name=matrix_ubuntu::$(cat matrix_ubuntu)" echo "::set-output name=matrix_ubuntu_release::$(cat matrix_ubuntu_release)" diff --git a/.github/chatops-gen-matrix.sh b/.github/chatops-gen-matrix.sh index 39b306e452a..a16432d4ce2 100755 --- a/.github/chatops-gen-matrix.sh +++ b/.github/chatops-gen-matrix.sh @@ -19,7 +19,7 @@ echoerr(){ readonly ALL_oses="ubuntu macos windows" ALL_build_types="Debug Release" ALL_cmake_opts="normal burrow ursa" ALL_compilers="gcc-9 gcc-10 clang-10 clang llvm msvc" readonly DEFAULT_oses="ubuntu macos windows" DEFAULT_build_types="Debug" DEFAULT_cmake_opts="normal burrow ursa" readonly DEFAULT_ubuntu_compilers="gcc-9" AVAILABLE_ubuntu_compilers="gcc-9 gcc-10 clang-10" -readonly DEFAULT_macos_compilers="clang" AVAILABLE_macos_compilers="clang" ## Also "llvm gcc-10" but they fail +readonly DEFAULT_macos_compilers="clang" AVAILABLE_macos_compilers="clang gcc-10" ## Also "llvm gcc-10" but they fail readonly DEFAULT_windows_compilers="msvc" AVAILABLE_windows_compilers="msvc" ## Also "clang mingw cygwin" but they are redundant --help-buildspec(){ diff --git a/.github/workflows/build-iroha1.yml b/.github/workflows/build-iroha1.yml index 1bd649e4c67..8c3c2028184 100644 --- a/.github/workflows/build-iroha1.yml +++ b/.github/workflows/build-iroha1.yml @@ -223,10 +223,10 @@ jobs: true else #echo >/tmp/comment_body "/build debug; /build ubuntu release debug normal" - echo >/tmp/comment_body "/build ubuntu debug release normal gcc-10" + echo >/tmp/comment_body "/build ubuntu debug release normal gcc-10"$'\n' "/build macos debug clang" fi ;; push) commit_message_body_build_spec >/tmp/comment_body || { - echo "/build macos ubuntu debug release normal gcc-10" + echo "/build ubuntu debug release normal gcc-10" } >/tmp/comment_body ;; workflow_dispatch) echo >/tmp/comment_body "${{github.event.inputs.build_spec}}" ;; *) echo >&2 "::error::Unexpected event"; false ;; @@ -235,6 +235,7 @@ jobs: id: matrixes run: | set -x + cat /tmp/comment_body cat /tmp/comment_body | .github/chatops-gen-matrix.sh echo "::set-output name=matrix_ubuntu::$(cat matrix_ubuntu)" echo "::set-output name=matrix_ubuntu_release::$(cat matrix_ubuntu_release)" diff --git a/iroha-lib/examples/CMakeLists.txt b/iroha-lib/examples/CMakeLists.txt index fe8eaf0a6fc..76bbdf799f1 100644 --- a/iroha-lib/examples/CMakeLists.txt +++ b/iroha-lib/examples/CMakeLists.txt @@ -1,51 +1,55 @@ -####### irohalib_tx_example: -add_executable(irohalib_tx_example - TxExample.cpp -) +if (APPLE) + message("iroha-lib does not support MacOS currently!") +else() + ###### irohalib_tx_example: + add_executable(irohalib_tx_example + TxExample.cpp + ) -target_link_libraries(irohalib_tx_example - iroha_lib_model - logger_manager -) + target_link_libraries(irohalib_tx_example + iroha_lib_model + logger_manager + ) -add_install_step_for_bin(irohalib_tx_example) + add_install_step_for_bin(irohalib_tx_example) -####### irohalib_batch_example: -add_executable(irohalib_batch_example - BatchExample.cpp -) + ###### irohalib_batch_example: + add_executable(irohalib_batch_example + BatchExample.cpp + ) -target_link_libraries(irohalib_batch_example - iroha_lib_model - logger_manager -) + target_link_libraries(irohalib_batch_example + iroha_lib_model + logger_manager + ) -add_install_step_for_bin(irohalib_batch_example) + add_install_step_for_bin(irohalib_batch_example) -####### irohalib_query_example: -add_executable(irohalib_query_example - QueryExample.cpp -) + ###### irohalib_query_example: + add_executable(irohalib_query_example + QueryExample.cpp + ) -target_link_libraries(irohalib_query_example - iroha_lib_model - logger_manager -) + target_link_libraries(irohalib_query_example + iroha_lib_model + logger_manager + ) -add_install_step_for_bin(irohalib_query_example) + add_install_step_for_bin(irohalib_query_example) -####### irohalib_domainassetcreation_example: -add_executable(irohalib_domainassetcreation_example - DomainAssetCreation.cpp -) + ###### irohalib_domainassetcreation_example: + add_executable(irohalib_domainassetcreation_example + DomainAssetCreation.cpp + ) -target_link_libraries(irohalib_domainassetcreation_example - iroha_lib_model - logger_manager - gflags -) + target_link_libraries(irohalib_domainassetcreation_example + iroha_lib_model + logger_manager + gflags + ) -add_install_step_for_bin(irohalib_domainassetcreation_example) + add_install_step_for_bin(irohalib_domainassetcreation_example) +endif() diff --git a/vcpkg/patches/0014-gtest-remove-werror-compile-flag.patch b/vcpkg/patches/0014-gtest-remove-werror-compile-flag.patch new file mode 100644 index 00000000000..70dcb755f13 --- /dev/null +++ b/vcpkg/patches/0014-gtest-remove-werror-compile-flag.patch @@ -0,0 +1,38 @@ +diff --git a/ports/gtest/portfile.cmake b/ports/gtest/portfile.cmake +index 11ac1140a..5226367cd 100644 +--- a/ports/gtest/portfile.cmake ++++ b/ports/gtest/portfile.cmake +@@ -12,6 +12,7 @@ vcpkg_from_github( + 0002-Fix-z7-override.patch + fix-main-lib-path.patch + fix-build-failure-in-gcc-11.patch ++ removing-werror-compiler-flag.patch + ) + + string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" GTEST_FORCE_SHARED_CRT) +diff --git a/ports/gtest/removing-werror-compiler-flag.patch b/ports/gtest/removing-werror-compiler-flag.patch +new file mode 100644 +index 000000000..2b7339da4 +--- /dev/null ++++ b/ports/gtest/removing-werror-compiler-flag.patch +@@ -0,0 +1,20 @@ ++diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake ++index 4439cb9..e385a5a 100644 ++--- a/googletest/cmake/internal_utils.cmake +++++ b/googletest/cmake/internal_utils.cmake ++@@ -82,13 +82,13 @@ macro(config_compiler_and_linker) ++ # http://stackoverflow.com/questions/3232669 explains the issue. ++ set(cxx_base_flags "${cxx_base_flags} -wd4702") ++ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ++- set(cxx_base_flags "-Wall -Wshadow -Werror -Wconversion") +++ set(cxx_base_flags "-Wall -Wshadow -Wconversion") ++ set(cxx_exception_flags "-fexceptions") ++ set(cxx_no_exception_flags "-fno-exceptions") ++ set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls") ++ set(cxx_no_rtti_flags "-fno-rtti") ++ elseif (CMAKE_COMPILER_IS_GNUCXX) ++- set(cxx_base_flags "-Wall -Wshadow -Werror") +++ set(cxx_base_flags "-Wall -Wshadow") ++ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) ++ set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else") ++ endif()