diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef00922e..fe6070e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,7 +123,7 @@ jobs: sudo apt-add-repository universe; \ sudo apt-get update; sudo apt-get install -y apt-utils libprocps-dev \ gcc-11 g++-11 valgrind gawk sed libffi-dev ccache libunwind-dev libgoogle-perftools-dev yasm texinfo \ - autotools-dev autogen automake autoconf m4 shtool pkg-config gawk nasm \ + autotools-dev autogen automake autoconf m4 shtool pkg-config gawk nasm unzip \ python3 python3-pip libtool libgcrypt20-dev # python python-pip # python-is-python3 @@ -174,9 +174,6 @@ jobs: - name: verify jsonrpc has been built run: ls libBLS/deps/deps_inst/x86_or_x64/include/jsonrpccpp/client.h - - name: workaround for HUNTER - run: cd .. && mkdir -p "${HOME}"/.hunter/_Base/Download/crc32c/1.0.5/dc7fa8c/ && wget -O "${HOME}"/.hunter/_Base/Download/crc32c/1.0.5/dc7fa8c/hunter-1.0.5.tar.gz https://github.com/hunter-packages/crc32c/archive/refs/tags/hunter-1.0.5.tar.gz - - name: build consensus run: | cd scripts && ./build.py Debug diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index d6c288da..13a19921 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -74,7 +74,7 @@ jobs: sudo apt-get install -y software-properties-common; sudo apt-add-repository universe; \ sudo apt-get update; sudo apt-get install -y software-properties-common apt-utils libprocps-dev \ gcc-11 g++-11 valgrind gawk sed libffi-dev ccache libunwind-dev libgoogle-perftools-dev yasm texinfo \ - autotools-dev autogen automake autoconf m4 shtool pkg-config sed gawk yasm nasm \ + autotools-dev autogen automake autoconf m4 shtool pkg-config sed gawk yasm nasm unzip \ python3 python3-pip python-is-python3 \ libtool build-essential \ libgcrypt20-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index 6db04e2b..5a73f410 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.10) - option(COVERAGE "Build with code coverage support" OFF) if (COVERAGE) message(STATUS "**********************") @@ -21,12 +20,6 @@ if (NOT DEFINED DEPS_INSTALL_ROOT) endif () message(INFO "---- DEPS_INSTALL_ROOT in consensus is: ${DEPS_INSTALL_ROOT}") -include("cmake/HunterGate.cmake") -include("cmake/precompiledheader.cmake") - - -HunterGate(URL "https://github.com/ruslo/hunter/archive/v0.23.76.tar.gz" SHA1 "c7b60993e841850e2c449afd454f5d5aa4ec04e4") - option( CONSENSUS_PROFILING "Build for profiling" OFF ) if( SKALED_PROFILING ) set( CONSENSUS_PROFILING ON ) @@ -63,20 +56,11 @@ include_directories("${DEPS_INSTALL_ROOT}/include" "${DEPS_INSTALL_ROOT}/include link_directories("${DEPS_INSTALL_ROOT}/lib") set(CMAKE_PREFIX_PATH "${DEPS_INSTALL_ROOT}") -# zeromq - - -#find_package(оч CONFIG REQUIRED) - - #leveldb - -hunter_add_package(leveldb) find_package(leveldb CONFIG REQUIRED) - -#set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wreturn-type -Winit-self") - +find_package( Snappy CONFIG REQUIRED ) +find_package( Crc32c CONFIG REQUIRED ) set(CMAKE_CXX_STANDARD 17) execute_process( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/gcc_ver_query.sh OUTPUT_VARIABLE GXX_MAJOR_VERSION ) @@ -95,7 +79,6 @@ add_definitions("-DZMQ_NONBLOCKING") if (CMAKE_PROJECT_NAME STREQUAL "consensus") - unset(SKALE_HAVE_BOOST_FROM_HUNTER) # to install compiler cache: sudo apt-get install ccache find_program(CCACHE_FOUND ccache) if (CCACHE_FOUND) @@ -201,16 +184,7 @@ include_directories(. spdlog/include ${BLS_INCLUDE_DIRS} ${DEPS_INSTALL_ROOT}/in "${DEPS_INSTALL_ROOT}/include" ${CMAKE_BINARY_DIR}/deps/include) -if (SKALE_HAVE_BOOST_FROM_HUNTER) - set(BOOST_LIBS_4_CONSENSUS - Boost::log Boost::thread Boost::system Boost::filesystem Boost::program_options - ) -else () - set(BOOST_LIBS_4_CONSENSUS - #boost_log - boost_thread boost_system boost_filesystem boost_program_options - ) -endif () +set(BOOST_LIBS_FOR_CONSENSUS boost_thread boost_system boost_filesystem boost_program_options) set(DASH_D_SUFFIX "") if (${CMAKE_BUILD_TYPE} MATCHES "Debug") @@ -221,9 +195,11 @@ endif () SET(LINK_LIBRARIES backtrace Threads::Threads - ${BOOST_LIBS_4_CONSENSUS} + ${BOOST_LIBS_FOR_CONSENSUS} ${LIB_NAME_cryptopp} - leveldb::leveldb + leveldb + snappy + crc32c "${DEPS_INSTALL_ROOT}/lib/libjsonrpccpp-client.a" "${DEPS_INSTALL_ROOT}/lib/libjsonrpccpp-server.a" "${DEPS_INSTALL_ROOT}/lib/libmicrohttpd.a" diff --git a/DockerfileBase b/DockerfileBase index 723a72b8..7ed2ea65 100644 --- a/DockerfileBase +++ b/DockerfileBase @@ -7,7 +7,7 @@ RUN apt-get update RUN sudo apt-add-repository universe; apt-get update; \ apt-get install -yq libprocps-dev gcc-11 g++-11 valgrind gawk sed libffi-dev ccache libgoogle-perftools-dev \ yasm texinfo autotools-dev automake python3 python3-pip \ - cmake libtool pkg-config autoconf wget git \ + cmake libtool pkg-config autoconf wget git unzip \ libhiredis-dev redis-server openssl libssl-dev doxygen idn2 libgcrypt20-dev \ libargtable2-dev libgnutls28-dev # python python-pip @@ -36,8 +36,6 @@ WORKDIR /consensust RUN cd deps && ./build.sh RUN ccache -M 20G -RUN mkdir -p "${HOME}"/.hunter/_Base/Download/crc32c/1.0.5/dc7fa8c/ && \ - wget -O "${HOME}"/.hunter/_Base/Download/crc32c/1.0.5/dc7fa8c/hunter-1.0.5.tar.gz https://github.com/hunter-packages/crc32c/archive/refs/tags/hunter-1.0.5.tar.gz RUN mkdir build WORKDIR build RUN cmake .. -DCMAKE_BUILD_TYPE=Debug diff --git a/deps/build.sh b/deps/build.sh index f8ad20c7..edca0aac 100755 --- a/deps/build.sh +++ b/deps/build.sh @@ -297,6 +297,10 @@ setup_variable WITH_FF "no" setup_variable WITH_GMP "no" setup_variable WITH_PBC "no" +setup_variable WITH_CRC32 "yes" +setup_variable WITH_SNAPPY "yes" +setup_variable WITH_LEVELDB "yes" + if [ -z "${PARALLEL_COUNT}" ]; then PARALLEL_COUNT=$NUMBER_OF_CPU_CORES @@ -600,10 +604,9 @@ echo -e "${COLOR_VAR_NAME}WITH_CRYPTOPP${COLOR_DOTS}..........${COLOR_VAR_DESC}L echo -e "${COLOR_VAR_NAME}WITH_GMP${COLOR_DOTS}...............${COLOR_VAR_DESC}LibGMP${COLOR_DOTS}.................................${COLOR_VAR_VAL}$WITH_GMP${COLOR_RESET}" echo -e "${COLOR_VAR_NAME}WITH_FF${COLOR_DOTS}................${COLOR_VAR_DESC}LibFF${COLOR_DOTS}..................................${COLOR_VAR_VAL}$WITH_FF${COLOR_RESET}" echo -e "${COLOR_VAR_NAME}WITH_PBC${COLOR_DOTS}...............${COLOR_VAR_DESC}LibPBC${COLOR_DOTS}.................................${COLOR_VAR_VAL}$WITH_PBC${COLOR_RESET}" - -# -# -# +echo -e "${COLOR_VAR_NAME}WITH_CRC32${COLOR_DOTS}.............${COLOR_VAR_DESC}LibCrc32${COLOR_DOTS}...............................${COLOR_VAR_VAL}$WITH_CRC32${COLOR_RESET}" +echo -e "${COLOR_VAR_NAME}WITH_SNAPPY${COLOR_DOTS}............${COLOR_VAR_DESC}LibSnappy${COLOR_DOTS}..............................${COLOR_VAR_VAL}$WITH_SNAPPY${COLOR_RESET}" +echo -e "${COLOR_VAR_NAME}WITH_LEVELDB${COLOR_DOTS}...........${COLOR_VAR_DESC}LibLevelDB${COLOR_DOTS}.............................${COLOR_VAR_VAL}$WITH_LEVELDB${COLOR_RESET}" cd "$SOURCES_ROOT" @@ -2374,6 +2377,91 @@ if [ "$WITH_BLAKE3" = "yes" ]; then fi fi +if [ "$WITH_CRC32" = "yes" ]; +then + echo -e "${COLOR_SEPARATOR}==================== ${COLOR_PROJECT_NAME}LibCrc32${COLOR_SEPARATOR} ===========================================${COLOR_RESET}" + if [ ! -f "$INSTALL_ROOT/lib/libcrc32c.a" ]; + then + env_restore + cd "$SOURCES_ROOT" + if [ ! -d "crc32c" ]; + then + echo -e "${COLOR_INFO}getting it from git${COLOR_DOTS}...${COLOR_RESET}" + git clone https://github.com/google/crc32c.git --recursive + fi + cd crc32c + git checkout 1.0.5 + echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" + mkdir -p build + cd build + $CMAKE "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" \ + -DCRC32C_BUILD_BENCHMARKS=OFF -DCRC32C_BUILD_TESTS=OFF -DCRC32C_USE_GLOG=OFF .. + echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}" + $MAKE ${PARALLEL_MAKE_OPTIONS} + $MAKE ${PARALLEL_MAKE_OPTIONS} install + cd "$SOURCES_ROOT" + else + echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" + fi +fi + +if [ "$WITH_SNAPPY" = "yes" ]; +then + echo -e "${COLOR_SEPARATOR}==================== ${COLOR_PROJECT_NAME}LibSnappy${COLOR_SEPARATOR} ===========================================${COLOR_RESET}" + if [ ! -f "$INSTALL_ROOT/lib/libsnappy.a" ]; + then + env_restore + cd "$SOURCES_ROOT" + if [ ! -d "snappy" ]; + then + echo -e "${COLOR_INFO}getting it from git${COLOR_DOTS}...${COLOR_RESET}" + git clone https://github.com/google/snappy.git --recursive + fi + cd snappy + git checkout 1.1.7 + echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" + mkdir -p build + cd build + $CMAKE "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" \ + -DSNAPPY_BUILD_TESTS=OFF .. + echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}" + $MAKE ${PARALLEL_MAKE_OPTIONS} + $MAKE ${PARALLEL_MAKE_OPTIONS} install + cd "$SOURCES_ROOT" + else + echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" + fi +fi + +if [ "$WITH_LEVELDB" = "yes" ]; +then + echo -e "${COLOR_SEPARATOR}==================== ${COLOR_PROJECT_NAME}LEVELDB${COLOR_SEPARATOR} ===========================================${COLOR_RESET}" + if [ ! -f "$INSTALL_ROOT/lib/libleveldb.a" ]; + then + env_restore + cd "$SOURCES_ROOT" + if [ ! -d "leveldb" ]; + then + echo -e "${COLOR_INFO}getting it from git${COLOR_DOTS}...${COLOR_RESET}" + git clone https://github.com/skalenetwork/leveldb.git --recursive + fi + cd leveldb + git checkout skale + echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}" + mkdir -p build + cd build + $CMAKE "${CMAKE_CROSSCOMPILING_OPTS}" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$TOP_CMAKE_BUILD_TYPE" \ + -DCMAKE_PREFIX_PATH="$INSTALL_ROOT" -DLEVELDB_BUILD_BENCHMARKS=OFF -DLEVELDB_BUILD_TESTS=OFF .. + echo -e "${COLOR_INFO}building it${COLOR_DOTS}...${COLOR_RESET}" + $MAKE ${PARALLEL_MAKE_OPTIONS} + $MAKE ${PARALLEL_MAKE_OPTIONS} install + cd "$SOURCES_ROOT" + else + echo -e "${COLOR_SUCCESS}SKIPPED${COLOR_RESET}" + fi +fi + + echo -e "${COLOR_SEPARATOR}===================================================================${COLOR_RESET}" echo -e "${COLOR_YELLOW}CONSENSUS dependencies build actions...${COLOR_RESET}" echo -e "${COLOR_SEPARATOR}==================== ${COLOR_PROJECT_NAME}FINISH${COLOR_SEPARATOR} =======================================${COLOR_RESET}" diff --git a/deps/clean.sh b/deps/clean.sh index 3448785e..4d01ca37 100755 --- a/deps/clean.sh +++ b/deps/clean.sh @@ -136,6 +136,9 @@ rm -rf ./gmp-6.1.2 rm -rf ./libff rm -rf ./pbc rm -rf ./libsodium +rm -rf ./crc32c +rm -rf ./snappy +rm -rf ./leveldb echo "Done (all clean)." #finish diff --git a/libBLS b/libBLS index 4a5c980b..93765031 160000 --- a/libBLS +++ b/libBLS @@ -1 +1 @@ -Subproject commit 4a5c980bc48379587e42667af42ea1af1ff612e9 +Subproject commit 93765031109834811379f90383c79189c80b1bb5