Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skaled 2053 remove hunter #853

Merged
merged 15 commits into from
Jan 2, 2025
Merged
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 7 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cmake_minimum_required(VERSION 3.10)


option(COVERAGE "Build with code coverage support" OFF)
if (COVERAGE)
message(STATUS "**********************")
Expand All @@ -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 )
Expand Down Expand Up @@ -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 )
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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"
Expand Down
4 changes: 1 addition & 3 deletions DockerfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
96 changes: 92 additions & 4 deletions deps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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}"
Expand Down
3 changes: 3 additions & 0 deletions deps/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libBLS
Submodule libBLS updated 4 files
+13 −21 CMakeLists.txt
+1 −1 README.md
+23 −20 deps/build.sh
+1 −0 deps/clean.sh
Loading