From 3b3a6c3ccaba9568faaa41fabe07eceb80b8efb6 Mon Sep 17 00:00:00 2001 From: cyjseagull Date: Fri, 13 Sep 2024 23:08:54 +0800 Subject: [PATCH] fix hdfs compile failed when disable sse on x86 machines --- cpp/cmake/BuildInfo.cmake | 2 +- cpp/cmake/CompilerSettings.cmake | 2 +- cpp/cmake/Installlibhdfs3.cmake | 2 +- cpp/cmake/Options.cmake | 15 +++++++++------ cpp/vcpkg-configuration.json | 6 +++--- cpp/vcpkg.json | 26 +++++++++++++++++++++----- 6 files changed, 36 insertions(+), 17 deletions(-) diff --git a/cpp/cmake/BuildInfo.cmake b/cpp/cmake/BuildInfo.cmake index 7ef9778c..b100a7f5 100644 --- a/cpp/cmake/BuildInfo.cmake +++ b/cpp/cmake/BuildInfo.cmake @@ -1,6 +1,6 @@ function(create_build_info) # Set build platform; to be written to BuildInfo.h - set(PPC_BUILD_OS "${CMAKE_SYSTEM_NAME}") + set(PPC_BUILD_OS "${CMAKE_HOST_SYSTEM_NAME}") if (CMAKE_COMPILER_IS_MINGW) set(PPC_BUILD_COMPILER "mingw") diff --git a/cpp/cmake/CompilerSettings.cmake b/cpp/cmake/CompilerSettings.cmake index 5e1140e3..8a068996 100644 --- a/cpp/cmake/CompilerSettings.cmake +++ b/cpp/cmake/CompilerSettings.cmake @@ -101,7 +101,7 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA add_compile_options(-fstack-protector) add_compile_options(-Winconsistent-missing-override) # Some Linux-specific Clang settings. We don't want these for OS X. - if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + if ("${CMAKE_HOST_SYSTEM_NAME}" MATCHES "Linux") # Tell Boost that we're using Clang's libc++. Not sure exactly why we need to do. add_definitions(-DBOOST_ASIO_HAS_CLANG_LIBCXX) # Use fancy colors in the compiler diagnostics diff --git a/cpp/cmake/Installlibhdfs3.cmake b/cpp/cmake/Installlibhdfs3.cmake index bcfc5d81..6b1f6c59 100644 --- a/cpp/cmake/Installlibhdfs3.cmake +++ b/cpp/cmake/Installlibhdfs3.cmake @@ -1,6 +1,6 @@ find_package(libxml2 REQUIRED) find_package(protobuf REQUIRED) -if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") +if ("${CMAKE_HOST_SYSTEM_NAME}" MATCHES "Linux") find_package(unofficial-libuuid REQUIRED) endif() find_package(libhdfs3 REQUIRED) \ No newline at end of file diff --git a/cpp/cmake/Options.cmake b/cpp/cmake/Options.cmake index ab319fb3..0293ad6b 100644 --- a/cpp/cmake/Options.cmake +++ b/cpp/cmake/Options.cmake @@ -82,9 +82,10 @@ macro(configure_project) if (${SUPPORTED_INSTRUCTIONS} MATCHES ".*SSE4.2.*") set(ENABLE_SSE ON) endif () - elseif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") + elseif(NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Windows") # detect sse4_2 FILE(READ "/proc/cpuinfo" SUPPORTED_INSTRUCTIONS) + message("* Linux SUPPORTED_INSTRUCTIONS: ${SUPPORTED_INSTRUCTIONS}") if (${SUPPORTED_INSTRUCTIONS} MATCHES ".*sse4_2.*") set(ENABLE_SSE ON) endif () @@ -137,15 +138,17 @@ macro(configure_project) if (BUILD_ALL) # install all dependencies list(APPEND VCPKG_MANIFEST_FEATURES "all") + if(ENABLE_SSE) + # enable sse for libhdfs3 + list(APPEND VCPKG_MANIFEST_FEATURES "sse-libhdfs3") + else() + list(APPEND VCPKG_MANIFEST_FEATURES "default-libhdfs3") + endif() endif() if (BUILD_WEDPR_TOOLKIT) # install wedpr dependencies list(APPEND VCPKG_MANIFEST_FEATURES "toolkit") endif() - if(ENABLE_SSE) - # enable sse for libhdfs3 - list(APPEND VCPKG_MANIFEST_FEATURES "sse") - endif() # cpp_features if(ENABLE_CPU_FEATURES) list(APPEND VCPKG_MANIFEST_FEATURES "cpufeatures") @@ -164,7 +167,7 @@ macro(print_config NAME) message("-- CMAKE_BUILD_TYPE Build type ${CMAKE_BUILD_TYPE}") message("-- VCPKG_MANIFEST_FEATURES VCPKG manifest features ${VCPKG_MANIFEST_FEATURES}") message("-- CMAKE_TOOLCHAIN_FILE Cmake toolchain file ${CMAKE_TOOLCHAIN_FILE}") - message("-- TARGET_PLATFORM Target platform ${CMAKE_SYSTEM_NAME} ${ARCHITECTURE}") + message("-- TARGET_PLATFORM Target platform ${CMAKE_HOST_SYSTEM_NAME} ${ARCHITECTURE}") message("-- BUILD_STATIC Build static ${BUILD_STATIC}") message("-- COVERAGE Build code coverage ${COVERAGE}") message("-- TESTS Build tests ${TESTS}") diff --git a/cpp/vcpkg-configuration.json b/cpp/vcpkg-configuration.json index a6334850..81446362 100644 --- a/cpp/vcpkg-configuration.json +++ b/cpp/vcpkg-configuration.json @@ -2,8 +2,8 @@ "registries": [ { "kind": "git", - "repository": "https://github.com/cyjseagull/registry", - "baseline": "6160f4167d4ab801f16a18bdd842a75edf7b069e", + "repository": "https://github.com/FISCO-BCOS/registry", + "baseline": "b483a0287c6ee7017983942af540e3ee672b0994", "packages": [ "openssl", "bcos-utilities", @@ -13,4 +13,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index 83449a54..7ff9a24e 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -38,7 +38,7 @@ }, { "name": "libhdfs3", - "version": "2024-04-27" + "version": "2024-04-27#1" }, { "name": "tbb", @@ -58,8 +58,25 @@ } ], "features": { - "sse": { - "description": "Enable SSE4.2 for libhdfs3" + "sse-libhdfs3": { + "description": "Enable SSE4.2 for libhdfs3", + "dependencies":[ + { + "name": "libhdfs3", + "version>=": "2024-04-27#1", + "features": ["sse"] + } + ] + }, + "default-libhdfs3": { + "description": "Disable SSE4.2 for libhdfs3", + "dependencies":[ + { + "name": "libhdfs3", + "version>=": "2024-04-27#1", + "features": [] + } + ] }, "cpufeatures":{ "description": "Enable cpu features", @@ -98,7 +115,6 @@ "name": "grpc", "version>=": "1.51.1" }, - "libhdfs3", "tarscpp", "tbb", "libxml2" @@ -121,4 +137,4 @@ ] } } -} \ No newline at end of file +}