Skip to content

Commit

Permalink
when WITH_TBB=OFF not compile tbb library
Browse files Browse the repository at this point in the history
  • Loading branch information
bxq2011hust committed Apr 26, 2024
1 parent 4cbb931 commit 989e3cf
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 60 deletions.
59 changes: 34 additions & 25 deletions .github/workflows/arm_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,52 @@ on:
- "README.md"
release:
types: [published, created, edited]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CCACHE_DIR: ${{ github.workspace }}/ccache

jobs:
build:
name: build_arm
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
runs-on: self-hosted-arm-2.0
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5

- uses: actions/cache@v3
id: cache
with:
path: $RUNNER_TEMP/deps/src
key: deps-v10-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
path: deps/src
key: deps-aarch64-v0-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/arm_runner.yml') }}
restore-keys: |
deps-v10-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
deps-v10-${{ runner.temp }}-${{ github.base_ref }}-
deps-v10-${{ runner.temp }}-
- uses: pguyot/arm-runner-action@v2
deps-aarch64-v0-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/arm_runner.yml') }}
deps-aarch64-v0-${{ runner.temp }}-${{ github.base_ref }}-
deps-aarch64-v0-${{ runner.temp }}-
- name: install ubuntu dependencies
run: sudo apt install -y g++ libssl-dev openssl git build-essential autoconf texinfo flex patch bison libgmp-dev zlib1g-dev automake libtool curl && sudo apt -y remove libtbb-dev
- name: Setup cmake
run: curl -sSL https://cmake.org/files/v3.21/cmake-3.21.0-linux-aarch64.tar.gz | sudo tar -xzC /usr
- name: configure
run: export PATH=$PATH:/usr/cmake-3.21.0-linux-aarch64/bin;cmake .
- name: compile
run: make -j4
- name: tar fisco-bcos for ubuntu
run: cp tools/build_chain.sh bin/ && cd bin && strip fisco-bcos && tar -zcf fisco-bcos.tar.gz fisco-bcos build_chain.sh
- uses: actions/upload-artifact@v4
with:
name: fisco-bcos.tar.gz
path: bin/fisco-bcos.tar.gz
- name: run uint tests
run: CTEST_OUTPUT_ON_FAILURE=TRUE make test
- name: configure without tbb
run: export PATH=$PATH:/usr/cmake-3.21.0-linux-aarch64/bin;cmake . -DWITH_TBB=OFF
- name: compile
run: make -j4
- name: tar fisco-bcos for ubuntu
run: cp tools/build_chain.sh bin/ && cd bin && strip fisco-bcos && tar -zcf fisco-bcos.tar.gz fisco-bcos build_chain.sh
- uses: actions/upload-artifact@v4
with:
base_image: raspios_lite_arm64:latest
commands: |
# install ubuntu dependencies
sudo apt install -y g++ libssl-dev openssl git build-essential autoconf texinfo flex patch bison libgmp-dev zlib1g-dev automake libtool cmake
# configure and compile
cmake . -DTESTS=ON -DARCH_NATIVE=ON; make -j2
# run test
CTEST_OUTPUT_ON_FAILURE=TRUE make test
# - name: tar fisco-bcos for Linux
# run: cp tools/build_chain.sh bin/ && cd bin && strip fisco-bcos && tar -zcf fisco-bcos.tar.gz fisco-bcos build_chain.sh
# - uses: actions/upload-artifact@v2
# with:
# name: fisco-bcos.tar.gz
# path: bin/fisco-bcos.tar.gz
name: fisco-bcos-without-tbb.tar.gz
path: bin/fisco-bcos.tar.gz
42 changes: 25 additions & 17 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
- "README.md"
release:
types: [published, created, edited]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CCACHE_DIR: ${{ github.workspace }}/ccache

Expand Down Expand Up @@ -73,11 +76,8 @@ jobs:
name: fisco-bcos.tar.gz
path: bin/fisco-bcos.tar.gz
build_macOS:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
name: build_macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -105,9 +105,13 @@ jobs:
ccache-v4-${{ runner.temp }}-
- name: install macOS dependencies
if: runner.os == 'macOS'
run: brew install [email protected] ccache gmp cmake zlib
run: brew install [email protected] ccache gmp zlib cmake
# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v2
# with:
# cmake-version: '3.21.0'
- name: configure
run: CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DTESTS=ON -DCMAKE_BUILD_TYPE=Release .
run: cmake -DTESTS=ON .
- name: compile
run: make -j2
- name: run uint tests
Expand All @@ -121,7 +125,7 @@ jobs:

macOS_integration_test:
name: build_integration_test
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -130,12 +134,12 @@ jobs:
id: cache
with:
path: deps/src
key: deps-v6-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
key: deps-v7-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
restore-keys: |
deps-v6-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
deps-v6-notest-${{ runner.temp }}-${{ github.base_ref }}-
deps-v6-notest-${{ runner.temp }}-
deps-v6-${{ runner.temp }}-
deps-v7-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }}
deps-v7-notest-${{ runner.temp }}-${{ github.base_ref }}-
deps-v7-notest-${{ runner.temp }}-
deps-v7-${{ runner.temp }}-
- uses: actions/cache@v2
id: ccache
with:
Expand All @@ -147,10 +151,14 @@ jobs:
ccache-v2-notest-${{ runner.temp }}-
- name: install macOS dependencies
run: brew install [email protected] ccache cmake
# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v2
# with:
# cmake-version: '3.21.0'
- name: configure
run: cmake .
run: xcode-select -p;export SDKROOT="`xcrun --show-sdk-path`";CC=/usr/bin/clang CXX=/usr/bin/clang++;cmake .
- name: compile
run: make -j2
run: export SDKROOT="`xcrun --show-sdk-path`";CC=/usr/bin/clang CXX=/usr/bin/clang++;make -j2
- name: run integration testing
run: cd tools && bash ci/ci_check.sh
- name: tar fisco-bcos for macOS
Expand Down Expand Up @@ -189,13 +197,13 @@ jobs:
- name: install ubuntu dependencies
run: sudo apt install -y g++ libssl-dev openssl git build-essential autoconf texinfo flex patch bison libgmp-dev zlib1g-dev automake libtool && sudo apt -y remove libtbb-dev
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.21.0'
- name: configure
run: cmake . -DBUILD_STATIC=ON
- name: compile
run: make -j2
run: export SDKROOT="`xcrun --show-sdk-path`";make -j2
- name: run integration testing
run: cd tools && bash ci/ci_check.sh
- name: tar fisco-bcos for Linux
Expand Down
9 changes: 8 additions & 1 deletion cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ macro(configure_project)
#ARCH TYPE
eth_default_option(ARCH_NATIVE OFF)
set(USE_LD_GOLD ON)
# if aarch64 set arch_native on
if("${ARCHITECTURE}" STREQUAL "aarch64" OR "${ARCHITECTURE}" STREQUAL "arm64")
set(ARCH_NATIVE ON)
endif()
if(ARCH_NATIVE)
if(APPLE)
set(MARCH_TYPE "-mtune=generic -fvisibility=hidden -fvisibility-inlines-hidden")
else()
set(MARCH_TYPE "-march=native -mtune=generic -fvisibility=hidden -fvisibility-inlines-hidden")
set(MARCH_TYPE "-march=native")
set(USE_LD_GOLD OFF)
endif()
set(COMPILE_OPTIONS "native")
Expand Down Expand Up @@ -106,6 +110,9 @@ macro(configure_project)
endif()
eth_default_option(WITH_URING OFF)
eth_default_option(WITH_TBB ON)
if(TESTS)
set(WITH_TBB ON)
endif()
if (WITH_TBB)
add_definitions(-DWITH_TBB)
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/ProjectBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ExternalProject_Add(boost
DOWNLOAD_NO_PROGRESS 1
URL https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.bz2
https://jaist.dl.sourceforge.net/project/boost/boost/1.85.0/boost_1_85_0.tar.bz2
# https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/deps/boost_1_85_0.tar.bz2
https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/deps/boost_1_85_0.tar.bz2
URL_HASH SHA256=7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${BOOST_BOOTSTRAP_COMMAND}
Expand Down
9 changes: 5 additions & 4 deletions cmake/ProjectCryptopp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,19 @@ ExternalProject_Add(cryptopp
-DBUILD_TESTING=OFF
-DCMAKE_C_FLAGS='${MARCH_TYPE}'
-DCMAKE_CXX_FLAGS='${MARCH_TYPE}'
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
# -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
# -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config Release
INSTALL_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config Release --target install
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_CONFIGURE 0
LOG_BUILD 0
LOG_INSTALL 1
${_overwrite_install_command}
BUILD_BYPRODUCTS "${CRYPTOPP_LIBRARY}"
)
ExternalProject_Get_Property(cryptopp INSTALL_DIR)
add_library(Cryptopp STATIC IMPORTED)
message(STATUS "CMAKE_OSX_SYSROOT === ${CMAKE_OSX_SYSROOT}")

file(MAKE_DIRECTORY ${CRYPTOPP_INCLUDE_DIR}) # Must exist.

Expand Down
7 changes: 7 additions & 0 deletions cmake/ProjectEVMC.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
include(ExternalProject)
include(GNUInstallDirs)

if (APPLE)
set(SED_CMMAND sed -i .bkp)
else()
set(SED_CMMAND sed -i)
endif()

ExternalProject_Add(evmc
PREFIX ${CMAKE_SOURCE_DIR}/deps
DOWNLOAD_NO_PROGRESS 1
Expand All @@ -10,6 +16,7 @@ ExternalProject_Add(evmc
URL_HASH SHA256=bc75110885ac5524dcbe8af0d3670add5b414697d8154ec2e885b1d6806f9332
# GIT_REPOSITORY https://github.com/FISCO-BCOS/evmc.git
# GIT_TAG e0bd9d5dc68ec3a00fe9a3c5e81c98946449a20d
PATCH_COMMAND ${SED_CMMAND} "s#evmc_last_error_msg()#evmc_last_error_msg(void)#g" include/evmc/loader.h COMMAND ${SED_CMMAND} "s#evmc_last_error_msg()#evmc_last_error_msg(void)#g" lib/loader/loader.c
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DHUNTER_USE_CACHE_SERVERS=NO
BUILD_IN_SOURCE 1
Expand Down
4 changes: 2 additions & 2 deletions cmake/ProjectJsonCpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ ExternalProject_Add(jsoncpp
-DJSONCPP_WITH_STRICT_ISO=OFF
-DCMAKE_C_FLAGS=-Wno-error -Wno-implicit-int-float-conversion #-Wa,-march=generic64
-DCMAKE_CXX_FLAGS=-Wno-error -Wno-implicit-int-float-conversion #-Wa,-march=generic64
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -Wno-error
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -Wno-error
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
LOG_CONFIGURE 1
LOG_BUILD 1
BUILD_COMMAND ""
Expand Down
22 changes: 16 additions & 6 deletions cmake/ProjectTBB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ if (APPLE)
set(ENABLE_STD_LIB stdlib=libc++)
endif()

if(WITH_TBB)
set(TBB_BUILD_CMD make extra_inc=big_iron.inc ${ENABLE_STD_LIB})
else()
set(TBB_BUILD_CMD "")
endif()

ExternalProject_Add(tbb
PREFIX ${CMAKE_SOURCE_DIR}/deps
DOWNLOAD_NO_PROGRESS 1
DOWNLOAD_NAME v2021.6.0-rc1
DOWNLOAD_NAME oneTBB-2021.12.0.tar.gz
# TODO: add wb cdn link
URL https://codeload.github.com/oneapi-src/oneTBB/tar.gz/refs/tags/v2021.12.0
https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/deps/oneTBB-2021.12.tar.gz
Expand All @@ -27,19 +33,23 @@ ExternalProject_Add(tbb
-DTBB_EXAMPLES=OFF
-DTBB_BENCH=OFF
#CONFIGURE_COMMAND ""
BUILD_COMMAND make extra_inc=big_iron.inc ${ENABLE_STD_LIB}
BUILD_COMMAND ${TBB_BUILD_CMD}
INSTALL_COMMAND bash -c "/bin/cp -f */libtbb.${TBB_LIB_SUFFIX}* ${CMAKE_SOURCE_DIR}/deps/lib/"
BUILD_BYPRODUCTS ${CMAKE_SOURCE_DIR}/deps/lib/libtbb.${TBB_LIB_SUFFIX}
)

ExternalProject_Get_Property(tbb SOURCE_DIR)
add_library(TBB STATIC IMPORTED)
set(TBB_INCLUDE_DIR ${SOURCE_DIR}/include)
set(TBB_LIBRARY ${CMAKE_SOURCE_DIR}/deps/lib/libtbb.${TBB_LIB_SUFFIX})
file(MAKE_DIRECTORY ${TBB_INCLUDE_DIR}) # Must exist.
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/deps/lib/) # Must exist.

set_property(TARGET TBB PROPERTY IMPORTED_LOCATION ${TBB_LIBRARY})
set_property(TARGET TBB PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIR})
if (WITH_TBB)
add_library(TBB STATIC IMPORTED)
set_property(TARGET TBB PROPERTY IMPORTED_LOCATION ${TBB_LIBRARY})
set_property(TARGET TBB PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIR})
else()
add_library(TBB INTERFACE)
target_include_directories(TBB INTERFACE ${TBB_INCLUDE_DIR})
endif()
add_dependencies(TBB tbb)
unset(SOURCE_DIR)
2 changes: 1 addition & 1 deletion test/unittests/libstorage/test_CachedStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <libstorage/CachedStorage.h>
#include <libstorage/StorageException.h>
#include <libstorage/Table.h>
#include <tbb/parallel_for.h>
// #include <tbb/parallel_for.h>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int.hpp>
#include <boost/test/unit_test.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/libstorage/test_Entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "Common.h"
#include <libdevcrypto/Common.h>
#include <libstorage/Table.h>
#include <tbb/parallel_for.h>
// #include <tbb/parallel_for.h>
#include <boost/test/unit_test.hpp>

using namespace dev;
Expand Down
1 change: 0 additions & 1 deletion test/unittests/libstorage/test_MemoryTable2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <libstorage/MemoryTable2.h>
#include <libstorage/Storage.h>
#include <libstorage/Table.h>
#include <tbb/parallel_for.h>
#include <boost/test/unit_test.hpp>
#include <string>
#include <thread>
Expand Down
2 changes: 1 addition & 1 deletion tools/build_chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ while getopts "v:V:f" option;do
esac
done
default_version=2.10.0
default_version=2.11.0
download_version=\${default_version}
sm_crypto=\$(cat "\${SHELL_FOLDER}"/node*/config.ini | grep sm_crypto_channel= | cut -d = -f 2 | head -n 1)
download_link=https://github.com/FISCO-BCOS/console/releases/download/v\${download_version}/\${package_name}
Expand Down

0 comments on commit 989e3cf

Please sign in to comment.