From 4c6f4e29dbc0c612b8ef032293ac13e7d57e5d4a Mon Sep 17 00:00:00 2001 From: yarkin Date: Mon, 19 Feb 2024 14:29:14 +0800 Subject: [PATCH] Support arm in linux. --- CMakeLists.txt | 8 +++++--- cmake/conan.cmake | 6 +++++- cmake/profiles/linux_arm_gcc_11_debug | 12 ++++++++++++ cmake/profiles/linux_arm_gcc_11_release | 12 ++++++++++++ silkworm/silkrpc/commands/ots_api.cpp | 7 +++++++ 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 cmake/profiles/linux_arm_gcc_11_debug create mode 100644 cmake/profiles/linux_arm_gcc_11_release diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d5ac0ad1..212e3eec3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,14 +32,16 @@ if(NOT SILKWORM_HAS_PARENT) CACHE FILEPATH "" FORCE ) endif() - - include(cmake/conan.cmake) - endif() project(silkworm) set(PROJECT_VERSION 0.1.0-dev) +# conan must be initiailzed after project definition to properly detect target architecture. +if(NOT SILKWORM_HAS_PARENT) + include(cmake/conan.cmake) +endif() + include(CableBuildInfo) string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ ${PROJECT_VERSION}) diff --git a/cmake/conan.cmake b/cmake/conan.cmake index 3f5afacd6..187e65968 100644 --- a/cmake/conan.cmake +++ b/cmake/conan.cmake @@ -16,7 +16,11 @@ function(guess_conan_profile) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") - set(PROFILE linux_gcc_11_release) + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64") + set(PROFILE linux_arm_gcc_11_release) + else() + set(PROFILE linux_gcc_11_release) + endif() elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") set(PROFILE macos_arm_clang_13_release) diff --git a/cmake/profiles/linux_arm_gcc_11_debug b/cmake/profiles/linux_arm_gcc_11_debug new file mode 100644 index 000000000..93d21f94c --- /dev/null +++ b/cmake/profiles/linux_arm_gcc_11_debug @@ -0,0 +1,12 @@ +[settings] +os=Linux +os_build=Linux +arch=armv8 +arch_build=armv8 +compiler=gcc +compiler.version=11 +compiler.libcxx=libstdc++11 +build_type=Debug +[options] +[build_requires] +[env] diff --git a/cmake/profiles/linux_arm_gcc_11_release b/cmake/profiles/linux_arm_gcc_11_release new file mode 100644 index 000000000..2222f4639 --- /dev/null +++ b/cmake/profiles/linux_arm_gcc_11_release @@ -0,0 +1,12 @@ +[settings] +os=Linux +os_build=Linux +arch=armv8 +arch_build=armv8 +compiler=gcc +compiler.version=11 +compiler.libcxx=libstdc++11 +build_type=Release +[options] +[build_requires] +[env] diff --git a/silkworm/silkrpc/commands/ots_api.cpp b/silkworm/silkrpc/commands/ots_api.cpp index 22e213e55..bdc696e48 100644 --- a/silkworm/silkrpc/commands/ots_api.cpp +++ b/silkworm/silkrpc/commands/ots_api.cpp @@ -34,6 +34,13 @@ #include #include +// GCC in this setting will report mismatch in new delete when checking dtor of boost::asio::awaitable. +// Possibly cuased by GCC process ctor as inline but not for dtor. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100485 +// Any more fine-grained fix will need toching the boost files. So we supress the warning here. +// As for now, GCC does not report such warning in other architecture. So we can still rely on this check on other platform for protection. +#ifdef __aarch64__ +#pragma GCC diagnostic ignored "-Wmismatched-new-delete" +#endif namespace silkworm::rpc::commands { constexpr int kCurrentApiLevel{8};