diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 69019957ff9..2a188f66eca 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,7 +1,66 @@ +# env: +# ANKA_WORKDIR: "/data/job" +# ANKA_MOJAVE_TEMPLATE: "10.14.4_6C_14G_40G" +# ANKA_TEMPLATE_TAG: "clean::cicd::git-ssh::nas::brew" +# CHECKSUMABLE: "scripts/eosio_build*" +# MAC_TAG: "eosio_2-3" + steps: + + # - trigger: "mac-anka-fleet" + # label: ":anka: Ensure Mojave Anka Template Tag Exists" + # branches: "*" + # async: false + # build: + # branch: "master" + # env: + # REPO: "${BUILDKITE_REPO}" + # REPO_BRANCH: "${BUILDKITE_BRANCH}" + # CHECKSUMABLE: "${CHECKSUMABLE}" + # TEMPLATE: "${ANKA_MOJAVE_TEMPLATE}" + # TEMPLATE_TAG: "${ANKA_TEMPLATE_TAG}" + # TAG_COMMANDS: "CLONED_REPO_DIR/scripts/eosio_build.sh -y -P -f" # CLONED_REPO_DIR IS REQUIRED and is where the repo is always cloned into + # PROJECT_TAG: "${MAC_TAG}" + + # - wait + + # - label: ":darwin: [Darwin] Mojave Build" + # command: + # - "./scripts/eosio_build.sh -y -P" + # - "tar -pczf /Network/NAS/MAC_FLEET/BUILDKITE/artifacts/${ANKA_MOJAVE_TEMPLATE}-${BUILDKITE_PIPELINE_SLUG}-${BUILDKITE_BUILD_ID}.tar.gz build" + # plugins: + # chef/anka#v0.4.3: + # vm-name: $ANKA_MOJAVE_TEMPLATE + # vm-registry-tag: "${ANKA_TEMPLATE_TAG}::${MAC_TAG}" + # workdir: $ANKA_WORKDIR + # always-pull: true + # debug: true + # wait-network: true + # agents: + # - "queue=mac-anka-node-fleet" + # timeout: 120 + + + - command: | # macOS Mojave Build + echo "--- Creating symbolic link to job directory :file_folder:" + sleep 5 + ln -s "$(pwd)" /data/job + cd /data/job + echo "+++ Building :hammer:" + ./scripts/eosio_build.sh -y -P + echo "--- Compressing build directory :compression:" + tar -pczf build.tar.gz build + if [[ ! -f build.tar.gz ]]; then echo 'ERROR: No build.tar.gz artifact found!' && exit 1; fi + label: ":darwin: Mojave Build" + agents: + - "role=builder-v2-2" + - "os=mojave" + artifact_paths: "build.tar.gz" + timeout: 120 + - command: | # Amazon Linux 2 Build echo "+++ :hammer: Building" - ./scripts/eosio_build.sh -y + ./scripts/eosio_build.sh -y -P echo "--- :compression: Compressing build directory" tar -pczf build.tar.gz build if [[ ! -f build.tar.gz ]]; then echo 'ERROR: No build.tar.gz artifact found!' && exit 1; fi @@ -17,14 +76,14 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:amazonlinux2_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:amazonlinux2_2-3" propagate-environment: true workdir: /data/job - timeout: 60 + timeout: 120 - command: | # CentOS 7 Build echo "+++ :hammer: Building" - ./scripts/eosio_build.sh -y + ./scripts/eosio_build.sh -y -P echo "--- :compression: Compressing build directory" tar -pczf build.tar.gz build if [[ ! -f build.tar.gz ]]; then echo 'ERROR: No build.tar.gz artifact found!' && exit 1; fi @@ -40,14 +99,14 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:centos7_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:centos7_2-3" propagate-environment: true workdir: /data/job - timeout: 60 + timeout: 120 - command: | # Ubuntu 16.04 Build echo "+++ :hammer: Building" - ./scripts/eosio_build.sh -y + ./scripts/eosio_build.sh -y -P echo "--- :compression: Compressing build directory" tar -pczf build.tar.gz build if [[ ! -f build.tar.gz ]]; then echo 'ERROR: No build.tar.gz artifact found!' && exit 1; fi @@ -63,14 +122,14 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu16_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu16_2-3" propagate-environment: true workdir: /data/job - timeout: 60 + timeout: 120 - command: | # Ubuntu 18.04 Build echo "+++ :hammer: Building" - ./scripts/eosio_build.sh -y + ./scripts/eosio_build.sh -y -P echo "--- :compression: Compressing build directory" tar -pczf build.tar.gz build if [[ ! -f build.tar.gz ]]; then echo 'ERROR: No build.tar.gz artifact found!' && exit 1; fi @@ -86,27 +145,10 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu18_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu18_2-3" propagate-environment: true workdir: /data/job - timeout: 60 - - - command: | # macOS Mojave Build - echo "--- Creating symbolic link to job directory :file_folder:" - sleep 5 - ln -s "$(pwd)" /data/job - cd /data/job - echo "+++ Building :hammer:" - ./scripts/eosio_build.sh -y - echo "--- Compressing build directory :compression:" - tar -pczf build.tar.gz build - if [[ ! -f build.tar.gz ]]; then echo 'ERROR: No build.tar.gz artifact found!' && exit 1; fi - label: ":darwin: Mojave Build" - agents: - - "role=builder-v2-1" - - "os=mojave" - artifact_paths: "build.tar.gz" - timeout: 60 + timeout: 120 - wait @@ -127,7 +169,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:amazonlinux2_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:amazonlinux2_2-3" propagate-environment: true workdir: /data/job timeout: 60 @@ -148,7 +190,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:amazonlinux2_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:amazonlinux2_2-3" propagate-environment: true workdir: /data/job timeout: 60 @@ -170,7 +212,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:centos7_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:centos7_2-3" propagate-environment: true workdir: /data/job timeout: 60 @@ -191,7 +233,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:centos7_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:centos7_2-3" propagate-environment: true workdir: /data/job timeout: 60 @@ -213,7 +255,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu16_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu16_2-3" propagate-environment: true workdir: /data/job timeout: 60 @@ -234,7 +276,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu16_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu16_2-3" propagate-environment: true workdir: /data/job timeout: 60 @@ -256,7 +298,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu18_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu18_2-3" propagate-environment: true workdir: /data/job timeout: 60 @@ -277,11 +319,49 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu18_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu18_2-3" propagate-environment: true workdir: /data/job timeout: 60 + # - label: ":darwin: [Darwin] Mojave Tests" + # command: + # - "./scripts/parallel-test.sh /Network/NAS/MAC_FLEET/BUILDKITE/artifacts/${ANKA_MOJAVE_TEMPLATE}-${BUILDKITE_PIPELINE_SLUG}-${BUILDKITE_BUILD_ID}.tar.gz" + # artifact_paths: + # - "build/mongod.log" + # - "build/genesis.json" + # - "build/config.ini" + # agents: + # - "queue=mac-anka-node-fleet" + # plugins: + # chef/anka#v0.4.3: + # vm-name: $ANKA_MOJAVE_TEMPLATE + # vm-registry-tag: "${ANKA_TEMPLATE_TAG}::${MAC_TAG}" + # workdir: $ANKA_WORKDIR + # always-pull: true + # debug: true + # wait-network: true + # timeout: 120 + + # - label: ":darwin: [Darwin] Mojave Tests" + # command: + # - "./scripts/serial-test.sh /Network/NAS/MAC_FLEET/BUILDKITE/artifacts/${ANKA_MOJAVE_TEMPLATE}-${BUILDKITE_PIPELINE_SLUG}-${BUILDKITE_BUILD_ID}.tar.gz" + # artifact_paths: + # - "build/mongod.log" + # - "build/genesis.json" + # - "build/config.ini" + # agents: + # - "queue=mac-anka-node-fleet" + # plugins: + # chef/anka#v0.4.3: + # vm-name: $ANKA_MOJAVE_TEMPLATE + # vm-registry-tag: "${ANKA_TEMPLATE_TAG}::${MAC_TAG}" + # workdir: $ANKA_WORKDIR + # always-pull: true + # debug: true + # wait-network: true + # timeout: 120 + # Mojave Tests - command: | echo "--- :arrow_down: Downloading Build Directory" @@ -291,10 +371,9 @@ steps: ./scripts/parallel-test.sh label: ":darwin: Mojave Tests" agents: - - "role=tester-v2-1" + - "role=tester-v2-2" - "os=mojave" timeout: 60 - - command: | echo "--- :arrow_down: Downloading Build Directory" buildkite-agent artifact download "build.tar.gz" . --step ":darwin: Mojave Build" @@ -303,10 +382,11 @@ steps: ./scripts/serial-test.sh label: ":darwin: Mojave NP Tests" agents: - - "role=tester-v2-1" + - "role=tester-v2-2" - "os=mojave" timeout: 60 + - wait - command: | # CentOS 7 Package Builder @@ -336,7 +416,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:centos7_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:centos7_2-3" propagate-environment: true workdir: /data/job env: @@ -364,7 +444,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu16_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu16_2-3" propagate-environment: true workdir: /data/job env: @@ -392,7 +472,7 @@ steps: region: "us-west-2" docker#v2.1.0: debug: true - image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu18_2-2" + image: "436617320021.dkr.ecr.us-west-2.amazonaws.com/ci:ubuntu18_2-3" propagate-environment: true workdir: /data/job env: @@ -410,7 +490,7 @@ steps: bash generate_package.sh brew label: ":darwin: Mojave Package Builder" agents: - - "role=builder-v2-1" + - "role=builder-v2-2" - "os=mojave" artifact_paths: - "build/packages/*.tar.gz" @@ -435,4 +515,4 @@ steps: label: "Git Submodule Regression Check" agents: queue: "automation-large-builder-fleet" - timeout: 5 \ No newline at end of file + timeout: 5 diff --git a/.pipelinebranch b/.pipelinebranch index 089fa42ccc2..e763e7d7fdc 100644 --- a/.pipelinebranch +++ b/.pipelinebranch @@ -1 +1 @@ -use-protocol-features-sync-nodes +protocol-features-sync-nodes diff --git a/CMakeLists.txt b/CMakeLists.txt index 17c3df72451..4d708ac5d44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.5 ) +cmake_minimum_required( VERSION 3.8 ) project( EOSIO ) include(CTest) # suppresses DartConfiguration.tcl error @@ -25,7 +25,7 @@ include( InstallDirectoryPermissions ) include( MASSigning ) set( BLOCKCHAIN_NAME "EOSIO" ) -set( CMAKE_CXX_STANDARD 14 ) +set( CMAKE_CXX_STANDARD 17 ) set( CMAKE_CXX_EXTENSIONS ON ) set( CXX_STANDARD_REQUIRED ON) @@ -49,15 +49,15 @@ set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" ) # http://stackoverflow.com/a/18369825 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) - message(FATAL_ERROR "GCC version must be at least 6.0!") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) + message(FATAL_ERROR "GCC version must be at least 7.0!") endif() if ("${CMAKE_GENERATOR}" STREQUAL "Ninja") add_compile_options(-fdiagnostics-color=always) endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) - message(FATAL_ERROR "Clang version must be at least 4.0!") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + message(FATAL_ERROR "Clang version must be at least 5.0!") endif() if ("${CMAKE_GENERATOR}" STREQUAL "Ninja") add_compile_options(-fcolor-diagnostics) @@ -112,12 +112,10 @@ FIND_PACKAGE(Boost 1.67 REQUIRED COMPONENTS unit_test_framework iostreams) -# Some new stdlibc++s will #error on ; a problem for boost pre-1.69 -if( APPLE AND UNIX ) - add_definitions(-DBOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW) -endif() +add_definitions(-DBOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW) -set(THREADS_PREFER_PTHREAD_FLAG 1) +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +set(THREADS_PREFER_PTHREAD_FLAG TRUE) find_package(Threads) link_libraries(Threads::Threads) @@ -159,11 +157,11 @@ else( WIN32 ) # Apple AND Linux if( APPLE ) # Apple Specific Options Here message( STATUS "Configuring EOSIO on OS X" ) - set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations" ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated-declarations" ) else( APPLE ) # Linux Specific Options Here message( STATUS "Configuring EOSIO on Linux" ) - set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall" ) + set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall" ) if ( FULL_STATIC_BUILD ) set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") endif ( FULL_STATIC_BUILD ) diff --git a/libraries/wasm-jit/CMakeLists.txt b/libraries/wasm-jit/CMakeLists.txt index fc691f83a95..8fcdec4e9ce 100644 --- a/libraries/wasm-jit/CMakeLists.txt +++ b/libraries/wasm-jit/CMakeLists.txt @@ -36,6 +36,7 @@ include_directories(${WAVM_INCLUDE_DIR}) # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") # endif() +set(CMAKE_CXX_STANDARD 11) option(WAVM_METRICS_OUTPUT "controls printing the timings of some operations to stdout" OFF) if(WAVM_METRICS_OUTPUT) add_definitions("-DWAVM_METRICS_OUTPUT=1") diff --git a/plugins/wallet_plugin/include/eosio/wallet_plugin/se_wallet.hpp b/plugins/wallet_plugin/include/eosio/wallet_plugin/se_wallet.hpp index e5c70f1a307..9e33b194a37 100644 --- a/plugins/wallet_plugin/include/eosio/wallet_plugin/se_wallet.hpp +++ b/plugins/wallet_plugin/include/eosio/wallet_plugin/se_wallet.hpp @@ -32,10 +32,10 @@ class se_wallet final : public wallet_api { string create_key(string key_type) override; bool remove_key(string key) override; - optional try_sign_digest(const digest_type digest, const public_key_type public_key) override; + fc::optional try_sign_digest(const digest_type digest, const public_key_type public_key) override; private: std::unique_ptr my; }; -}} \ No newline at end of file +}} diff --git a/plugins/wallet_plugin/include/eosio/wallet_plugin/wallet.hpp b/plugins/wallet_plugin/include/eosio/wallet_plugin/wallet.hpp index 480e7a32a44..900577d082c 100644 --- a/plugins/wallet_plugin/include/eosio/wallet_plugin/wallet.hpp +++ b/plugins/wallet_plugin/include/eosio/wallet_plugin/wallet.hpp @@ -181,7 +181,7 @@ class soft_wallet final : public wallet_api /* Attempts to sign a digest via the given public_key */ - optional try_sign_digest( const digest_type digest, const public_key_type public_key ) override; + fc::optional try_sign_digest( const digest_type digest, const public_key_type public_key ) override; std::shared_ptr my; void encrypt_keys(); diff --git a/plugins/wallet_plugin/include/eosio/wallet_plugin/wallet_api.hpp b/plugins/wallet_plugin/include/eosio/wallet_plugin/wallet_api.hpp index 0627eceff33..61929b04733 100644 --- a/plugins/wallet_plugin/include/eosio/wallet_plugin/wallet_api.hpp +++ b/plugins/wallet_plugin/include/eosio/wallet_plugin/wallet_api.hpp @@ -101,7 +101,7 @@ class wallet_api /** Returns a signature given the digest and public_key, if this wallet can sign via that public key */ - virtual optional try_sign_digest( const digest_type digest, const public_key_type public_key ) = 0; + virtual fc::optional try_sign_digest( const digest_type digest, const public_key_type public_key ) = 0; }; }} diff --git a/plugins/wallet_plugin/include/eosio/wallet_plugin/yubihsm_wallet.hpp b/plugins/wallet_plugin/include/eosio/wallet_plugin/yubihsm_wallet.hpp index e1c0da99118..49caa9c184b 100644 --- a/plugins/wallet_plugin/include/eosio/wallet_plugin/yubihsm_wallet.hpp +++ b/plugins/wallet_plugin/include/eosio/wallet_plugin/yubihsm_wallet.hpp @@ -32,10 +32,10 @@ class yubihsm_wallet final : public wallet_api { string create_key(string key_type) override; bool remove_key(string key) override; - optional try_sign_digest(const digest_type digest, const public_key_type public_key) override; + fc::optional try_sign_digest(const digest_type digest, const public_key_type public_key) override; private: std::unique_ptr my; }; -}} \ No newline at end of file +}} diff --git a/plugins/wallet_plugin/se_wallet.cpp b/plugins/wallet_plugin/se_wallet.cpp index 8b43d569881..2f9ccfffc06 100644 --- a/plugins/wallet_plugin/se_wallet.cpp +++ b/plugins/wallet_plugin/se_wallet.cpp @@ -186,10 +186,10 @@ struct se_wallet_impl { return pub; } - optional try_sign_digest(const digest_type d, const public_key_type public_key) { + fc::optional try_sign_digest(const digest_type d, const public_key_type public_key) { auto it = _keys.find(public_key); if(it == _keys.end()) - return optional{}; + return fc::optional{}; fc::ecdsa_sig sig = ECDSA_SIG_new(); CFErrorRef error = nullptr; @@ -370,8 +370,8 @@ bool se_wallet::remove_key(string key) { return my->remove_key(key); } -optional se_wallet::try_sign_digest(const digest_type digest, const public_key_type public_key) { +fc::optional se_wallet::try_sign_digest(const digest_type digest, const public_key_type public_key) { return my->try_sign_digest(digest, public_key); } -}} \ No newline at end of file +}} diff --git a/plugins/wallet_plugin/wallet.cpp b/plugins/wallet_plugin/wallet.cpp index 53d57697ccd..a40027cb0a9 100644 --- a/plugins/wallet_plugin/wallet.cpp +++ b/plugins/wallet_plugin/wallet.cpp @@ -120,18 +120,18 @@ class soft_wallet_impl string get_wallet_filename() const { return _wallet_filename; } - optional try_get_private_key(const public_key_type& id)const + fc::optional try_get_private_key(const public_key_type& id)const { auto it = _keys.find(id); if( it != _keys.end() ) return it->second; - return optional(); + return fc::optional(); } - optional try_sign_digest( const digest_type digest, const public_key_type public_key ) { + fc::optional try_sign_digest( const digest_type digest, const public_key_type public_key ) { auto it = _keys.find(public_key); if( it == _keys.end() ) - return optional{}; + return fc::optional{}; return it->second.sign(digest); } @@ -401,7 +401,7 @@ private_key_type soft_wallet::get_private_key( public_key_type pubkey )const return my->get_private_key( pubkey ); } -optional soft_wallet::try_sign_digest( const digest_type digest, const public_key_type public_key ) { +fc::optional soft_wallet::try_sign_digest( const digest_type digest, const public_key_type public_key ) { return my->try_sign_digest(digest, public_key); } diff --git a/plugins/wallet_plugin/wallet_manager.cpp b/plugins/wallet_plugin/wallet_manager.cpp index b5287173670..43fa37bc61a 100644 --- a/plugins/wallet_plugin/wallet_manager.cpp +++ b/plugins/wallet_plugin/wallet_manager.cpp @@ -237,7 +237,7 @@ wallet_manager::sign_transaction(const chain::signed_transaction& txn, const fla bool found = false; for (const auto& i : wallets) { if (!i.second->is_locked()) { - optional sig = i.second->try_sign_digest(stxn.sig_digest(id, stxn.context_free_data), pk); + fc::optional sig = i.second->try_sign_digest(stxn.sig_digest(id, stxn.context_free_data), pk); if (sig) { stxn.signatures.push_back(*sig); found = true; @@ -260,7 +260,7 @@ wallet_manager::sign_digest(const chain::digest_type& digest, const public_key_t try { for (const auto& i : wallets) { if (!i.second->is_locked()) { - optional sig = i.second->try_sign_digest(digest, key); + fc::optional sig = i.second->try_sign_digest(digest, key); if (sig) return *sig; } diff --git a/plugins/wallet_plugin/yubihsm_wallet.cpp b/plugins/wallet_plugin/yubihsm_wallet.cpp index cda0d208333..0f367457fa0 100644 --- a/plugins/wallet_plugin/yubihsm_wallet.cpp +++ b/plugins/wallet_plugin/yubihsm_wallet.cpp @@ -139,10 +139,10 @@ struct yubihsm_wallet_impl { }); } - optional try_sign_digest(const digest_type d, const public_key_type public_key) { + fc::optional try_sign_digest(const digest_type d, const public_key_type public_key) { auto it = _keys.find(public_key); if(it == _keys.end()) - return optional{}; + return fc::optional{}; size_t der_sig_sz = 128; uint8_t der_sig[der_sig_sz]; @@ -265,7 +265,7 @@ bool yubihsm_wallet::remove_key(string key) { return true; } -optional yubihsm_wallet::try_sign_digest(const digest_type digest, const public_key_type public_key) { +fc::optional yubihsm_wallet::try_sign_digest(const digest_type digest, const public_key_type public_key) { return my->try_sign_digest(digest, public_key); } diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 15e03f095cc..7e21aae62b7 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -382,14 +382,14 @@ void print_action( const fc::variant& at ) { } //resolver for ABI serializer to decode actions in proposed transaction in multisig contract -auto abi_serializer_resolver = [](const name& account) -> optional { - static unordered_map > abi_cache; +auto abi_serializer_resolver = [](const name& account) -> fc::optional { + static unordered_map > abi_cache; auto it = abi_cache.find( account ); if ( it == abi_cache.end() ) { auto result = call(get_abi_func, fc::mutable_variant_object("account_name", account)); auto abi_results = result.as(); - optional abis; + fc::optional abis; if( abi_results.abi.valid() ) { abis.emplace( *abi_results.abi, abi_serializer_max_time ); } else { @@ -483,7 +483,7 @@ void print_result( const fc::variant& result ) { try { cerr << " us\n"; if( status == "failed" ) { - auto soft_except = processed["except"].as>(); + auto soft_except = processed["except"].as>(); if( soft_except ) { edump((soft_except->to_detail_string())); } diff --git a/scripts/eosio_build.sh b/scripts/eosio_build.sh index 32395919051..5c09ea6bae1 100755 --- a/scripts/eosio_build.sh +++ b/scripts/eosio_build.sh @@ -48,6 +48,9 @@ txtrst=$(tput sgr0) SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" REPO_ROOT="${SCRIPT_DIR}/.." BUILD_DIR="${REPO_ROOT}/build" +ENABLE_MONGO=false + +export BUILD_DIR=$BUILD_DIR # Use current directory's tmp directory if noexec is enabled for /tmp if (mount | grep "/tmp " | grep --quiet noexec); then @@ -58,6 +61,8 @@ else # noexec wasn't found TEMP_DIR="/tmp" fi +export TMP_LOCATION=$TEMP_DIR + function usage() { cat >&2 < (default: SYS) -y Noninteractive mode (this script) + -P Build with pinned clang 8 and libcxx + -f Force rebuilding of dependencies + -m Build MongoDB dependencies EOT exit 1 } if [ $# -ne 0 ]; then - while getopts ":cdo:s:p:b:hy" opt; do + while getopts ":cdo:s:p:b:mfPhy" opt; do case "${opt}" in o ) options=( "Debug" "Release" "RelWithDebInfo" "MinSizeRel" ) @@ -107,6 +115,9 @@ if [ $# -ne 0 ]; then p) PREFIX=$OPTARG ;; + P) + PIN_COMPILER=true + ;; h) usage exit 1 @@ -114,6 +125,13 @@ if [ $# -ne 0 ]; then y) NONINTERACTIVE=1 ;; + f) + FORCE_BUILD=1 + ;; + m) + BUILD_MONGO=1 + ENABLE_MONGO=1 + ;; \? ) printf "\\nInvalid Option: %s\\n" "-${OPTARG}" 1>&2 usage @@ -170,11 +188,26 @@ export BOOST_LINK_LOCATION=${OPT_LOCATION}/boost export LLVM_VERSION=release_40 export LLVM_ROOT=${OPT_LOCATION}/llvm export LLVM_DIR=${LLVM_ROOT}/lib/cmake/llvm +export CLANG8_ROOT=${OPT_LOCATION}/clang8 +export PINNED_COMPILER_BRANCH=release_80 +export PINNED_COMPILER_LLVM_COMMIT=18e41dc +export PINNED_COMPILER_CLANG_COMMIT=a03da8b +export PINNED_COMPILER_LLD_COMMIT=d60a035 +export PINNED_COMPILER_POLLY_COMMIT=1bc06e5 +export PINNED_COMPILER_CLANG_TOOLS_EXTRA_COMMIT=6b34834 +export PINNED_COMPILER_LIBCXX_COMMIT=1853712 +export PINNED_COMPILER_LIBCXXABI_COMMIT=d7338a4 +export PINNED_COMPILER_LIBUNWIND_COMMIT=57f6739 +export PINNED_COMPILER_COMPILER_RT_COMMIT=5bc7979 export DOXYGEN_VERSION=1_8_14 export DOXYGEN_ROOT=${SRC_LOCATION}/doxygen-${DOXYGEN_VERSION} export TINI_VERSION=0.18.0 export DISK_MIN=5 +export FORCE_BUILD=$FORCE_BUILD +export BUILD_MONGO=$BUILD_MONGO +mkdir -p $BUILD_DIR +sed -e "s~@~$OPT_LOCATION~g" $SCRIPT_DIR/pinned_toolchain.cmake &> $BUILD_DIR/pinned_toolchain.cmake cd $REPO_ROOT STALE_SUBMODS=$(( $(git submodule status --recursive | grep -c "^[+\-]") )) @@ -184,6 +217,63 @@ if [ $STALE_SUBMODS -gt 0 ]; then exit 1 fi +BUILD_CLANG8=false +if [ ! -z $CXX ]; then + CPP_COMP=$CXX + CC_COMP=$CC +else + CPP_COMP=c++ + CC_COMP=cc +fi + +NO_CPP17=false + +WHICH_CPP=`which $CPP_COMP` +COMPILER_TYPE=`readlink $WHICH_CPP` +if [[ $COMPILER_TYPE == "clang++" ]]; then + if [[ `c++ --version | cut -d ' ' -f 1 | head -n 1` == "Apple" ]]; then + ### Apple clang version 10 + if [[ `c++ --version | cut -d ' ' -f 4 | cut -d '.' -f 1 | head -n 1` -lt 10 ]]; then + NO_CPP17=true + fi + else + ### clang version 5 + if [[ `c++ --version | cut -d ' ' -f 4 | cut -d '.' -f 1 | head -n 1` -lt 5 ]]; then + NO_CPP17=true + fi + fi +else + ### gcc version 7 + if [[ `c++ -dumpversion | cut -d '.' -f 1` -lt 7 ]]; then + NO_CPP17=true + fi +fi + +if [ $PIN_COMPILER ]; then + BUILD_CLANG8=true + CPP_COMP=${OPT_LOCATION}/clang8/bin/clang++ + CC_COMP=${OPT_LOCATION}/clang8/bin/clang +elif $NO_CPP17; then + if [ $NONINTERACTIVE -eq 0 ]; then + BUILD_CLANG8=true + CPP_COMP=${OPT_LOCATION}/clang8/bin/clang++ + CC_COMP=${OPT_LOCATION}/clang8/bin/clang + else + printf "Error no C++17 support.\\nEnter Y/y or N/n to continue with downloading and building a viable compiler or exit now.\\nIf you already have a C++17 compiler installed or would like to install your own, export CXX to point to the compiler of your choosing." + read -p "Enter Y/y or N/n to continue with downloading and building a viable compiler or exit now. " yn + case $yn in + [Yy]* ) BUILD_CLANG8=true; CPP_COMP=${OPT_LOCATION}/clang8/bin/clang++; CC_COMP=${OPT_LOCATION}/clang8/bin/clang; break;; + [Nn]* ) exit 1;; + * ) echo "Improper input"; exit 1;; + esac + fi +fi + +CXX=$CPP_COMP +CC=$CC_COMP + +export PIN_COMPILER=$PIN_COMPILER + # Setup directories mkdir -p $SRC_LOCATION mkdir -p $OPT_LOCATION @@ -225,39 +315,25 @@ if [ "$ARCH" == "Linux" ]; then case "$OS_NAME" in "Amazon Linux AMI"|"Amazon Linux") FILE="${REPO_ROOT}/scripts/eosio_build_amazon.sh" - CXX_COMPILER=g++ - C_COMPILER=gcc ;; "CentOS Linux") FILE="${REPO_ROOT}/scripts/eosio_build_centos.sh" - CXX_COMPILER=g++ - C_COMPILER=gcc ;; "elementary OS") FILE="${REPO_ROOT}/scripts/eosio_build_ubuntu.sh" - CXX_COMPILER=clang++-4.0 - C_COMPILER=clang-4.0 ;; "Fedora") export CPATH=/usr/include/llvm4.0:$CPATH # llvm4.0 for fedora package path inclusion FILE="${REPO_ROOT}/scripts/eosio_build_fedora.sh" - CXX_COMPILER=g++ - C_COMPILER=gcc ;; "Linux Mint") FILE="${REPO_ROOT}/scripts/eosio_build_ubuntu.sh" - CXX_COMPILER=clang++-4.0 - C_COMPILER=clang-4.0 ;; "Ubuntu") FILE="${REPO_ROOT}/scripts/eosio_build_ubuntu.sh" - CXX_COMPILER=clang++-4.0 - C_COMPILER=clang-4.0 ;; "Debian GNU/Linux") FILE="${REPO_ROOT}/scripts/eosio_build_ubuntu.sh" - CXX_COMPILER=clang++-4.0 - C_COMPILER=clang-4.0 ;; *) printf "\\nUnsupported Linux Distribution. Exiting now.\\n\\n" @@ -273,8 +349,6 @@ if [ "$ARCH" == "Darwin" ]; then # HOME/lib/cmake: mongo_db_plugin.cpp:25:10: fatal error: 'bsoncxx/builder/basic/kvp.hpp' file not found LOCAL_CMAKE_FLAGS="-DCMAKE_PREFIX_PATH=/usr/local/opt/gettext;$HOME/lib/cmake ${LOCAL_CMAKE_FLAGS}" FILE="${REPO_ROOT}/scripts/eosio_build_darwin.sh" - CXX_COMPILER=clang++ - C_COMPILER=clang OPENSSL_ROOT_DIR=/usr/local/opt/openssl fi @@ -291,15 +365,25 @@ printf "======================= Starting EOSIO Build =======================\\n" printf "## CMAKE_BUILD_TYPE=%s\\n" "${CMAKE_BUILD_TYPE}" printf "## ENABLE_COVERAGE_TESTING=%s\\n" "${ENABLE_COVERAGE_TESTING}" -mkdir -p $BUILD_DIR cd $BUILD_DIR -$CMAKE -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" -DCMAKE_CXX_COMPILER="${CXX_COMPILER}" \ - -DCMAKE_C_COMPILER="${C_COMPILER}" -DCORE_SYMBOL_NAME="${CORE_SYMBOL_NAME}" \ - -DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" -DBUILD_MONGO_DB_PLUGIN=true \ - -DENABLE_COVERAGE_TESTING="${ENABLE_COVERAGE_TESTING}" -DBUILD_DOXYGEN="${DOXYGEN}" \ - -DCMAKE_PREFIX_PATH=$PREFIX \ - -DCMAKE_INSTALL_PREFIX=$OPT_LOCATION/eosio $LOCAL_CMAKE_FLAGS "${REPO_ROOT}" + +if [ $PIN_COMPILER ]; then + $CMAKE -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" -DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake \ + -DCORE_SYMBOL_NAME="${CORE_SYMBOL_NAME}" \ + -DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" -DBUILD_MONGO_DB_PLUGIN=$ENABLE_MONGO \ + -DENABLE_COVERAGE_TESTING="${ENABLE_COVERAGE_TESTING}" -DBUILD_DOXYGEN="${DOXYGEN}" \ + -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_PREFIX_PATH=$OPT_LOCATION/llvm4\ + -DCMAKE_INSTALL_PREFIX=$OPT_LOCATION/eosio $LOCAL_CMAKE_FLAGS "${REPO_ROOT}" +else + $CMAKE -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" -DCMAKE_CXX_COMPILER="${CXX}" \ + -DCMAKE_C_COMPILER="${CC}" -DCORE_SYMBOL_NAME="${CORE_SYMBOL_NAME}" \ + -DOPENSSL_ROOT_DIR="${OPENSSL_ROOT_DIR}" -DBUILD_MONGO_DB_PLUGIN=$ENABLE_MONGO \ + -DENABLE_COVERAGE_TESTING="${ENABLE_COVERAGE_TESTING}" -DBUILD_DOXYGEN="${DOXYGEN}" \ + -DCMAKE_PREFIX_PATH=$PREFIX \ + -DCMAKE_INSTALL_PREFIX=$OPT_LOCATION/eosio $LOCAL_CMAKE_FLAGS "${REPO_ROOT}" +fi + if [ $? -ne 0 ]; then exit -1; fi make -j"${JOBS}" if [ $? -ne 0 ]; then exit -1; fi diff --git a/scripts/eosio_build_amazon.sh b/scripts/eosio_build_amazon.sh index 1fb2af1ebc9..5d0438ca314 100755 --- a/scripts/eosio_build_amazon.sh +++ b/scripts/eosio_build_amazon.sh @@ -8,11 +8,13 @@ DISK_AVAIL_KB=$( df . | tail -1 | awk '{print $4}' ) DISK_TOTAL=$(( DISK_TOTAL_KB / 1048576 )) DISK_AVAIL=$(( DISK_AVAIL_KB / 1048576 )) +PINNED_TOOLCHAIN=-DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake + if [[ "${OS_NAME}" == "Amazon Linux AMI" ]]; then # Amazonlinux1 DEP_ARRAY=( sudo procps util-linux which gcc72 gcc72-c++ autoconf automake libtool make doxygen graphviz \ bzip2 bzip2-devel openssl-devel gmp gmp-devel libstdc++72 python27 python27-devel python36 python36-devel \ - libedit-devel ncurses-devel swig wget file libcurl-devel libusb1-devel + libedit-devel ncurses-devel swig curl file libcurl-devel libusb1-devel ) else # Amazonlinux2 DEP_ARRAY=( @@ -118,9 +120,21 @@ fi printf "\\n" +### clean up force build before starting +if [ $FORCE_BUILD ];then + rm -rf \ + ${SRC_LOCATION}/cmake-$CMAKE_VERSION \ + ${SRC_LOCATION}/llvm ${OPT_LOCATION}/llvm4 \ + ${TMP_LOCATION}/clang8 ${OPT_LOCATION}/clang8 \ + ${SRC_LOCATION}/zlib ${OPT_LOCATION}/zlib \ + ${SRC_LOCATION}/boost \ + ${SRC_LOCATION}/mongodb-linux-x86_64-amazon-$MONGODB_VERSION \ + ${SRC_LOCATION}/mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + ${SRC_LOCATION}/mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION +fi printf "Checking CMAKE installation...\\n" -if [ ! -e $CMAKE ]; then +if [ ! -e $CMAKE ] || [ $FORCE_BUILD ]; then printf "Installing CMAKE...\\n" curl -LO https://cmake.org/files/v$CMAKE_VERSION_MAJOR.$CMAKE_VERSION_MINOR/cmake-$CMAKE_VERSION.tar.gz \ && tar -xzf cmake-$CMAKE_VERSION.tar.gz \ @@ -141,112 +155,201 @@ if [ $? -ne 0 ]; then exit -1; fi printf "\\n" -printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" -BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) -if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ]; then - printf "Installing Boost library...\\n" - curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ - && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ - && cd $BOOST_ROOT \ - && ./bootstrap.sh --prefix=$BOOST_ROOT \ - && ./b2 -q -j"${JOBS}" install \ - && cd .. \ - && rm -f boost_$BOOST_VERSION.tar.bz2 \ - && rm -rf $BOOST_LINK_LOCATION \ - && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ - || exit 1 - printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" -else - printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi +if [ $PIN_COMPILER ]; then + printf "Checking Clang 8 support...\\n" + if [ ! -d $CLANG8_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing Clang 8...\\n" + cd ${TMP_LOCATION} \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/llvm.git clang8 && cd clang8 \ + && git checkout $PINNED_COMPILER_LLVM_COMMIT \ + && cd tools \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/lld.git \ + && cd lld && git checkout $PINNED_COMPILER_LLD_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/polly.git \ + && cd polly && git checkout $PINNED_COMPILER_POLLY_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang.git clang && cd clang/tools \ + && git checkout $PINNED_COMPILER_CLANG_VERSION \ + && mkdir extra && cd extra \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang-tools-extra.git \ + && cd clang-tools-extra && git checkout $PINNED_COMPILER_CLANG_TOOLS_EXTRA_COMMIT && cd .. \ + && cd ../../../../projects \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxx.git \ + && cd libcxx && git checkout $PINNED_COMPILER_LIBCXX_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxxabi.git \ + && cd libcxxabi && git checkout $PINNED_COMPILER_LIBCXXABI_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libunwind.git \ + && cd libunwind && git checkout $PINNED_COMPILER_LIBUNWIND_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/compiler-rt.git \ + && cd compiler-rt && git checkout $PINNED_COMPILER_COMPILER_RT_COMMIT && cd ../ \ + && cd ${TMP_LOCATION}/clang8 \ + && mkdir build && cd build \ + && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${CLANG8_ROOT}" -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_ENABLE_LIBCXX=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_INCLUDE_DOCS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release .. \ + && make -j"${JOBS}" \ + && make install \ + && rm -rf ${TMP_LOCATION}/clang8 \ + && cd ../.. \ + || exit 1 + printf " - Clang 8 successfully installed @ ${CLANG8_ROOT}\\n" + else + printf " - Clang 8 found @ ${CLANG8_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -printf "\\n" + printf "\\n" + printf "Checking LLVM 4 installation...\\n" + if [ ! -d $OPT_LOCATION/llvm4 ] || [ $FORCE_BUILD ]; then + printf "Installing LLVM 4...\\n" + cd $SRC_LOCATION \ + && git clone https://github.com/llvm-mirror/llvm --single-branch --branch $LLVM_VERSION && cd llvm \ + && mkdir -p build && cd build \ + && $CMAKE -DCMAKE_INSTALL_PREFIX=$OPT_LOCATION/llvm4 -DLLVM_TARGETS_TO_BUILD=host -DLLVM_BUILD_TOOLS=false -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake .. \ + && make -j"${JOBS}" install \ + || exit -1 + printf "Installed LLVM 4 @ ${OPT_LOCATION}/llvm4" + fi -printf "Checking MongoDB installation...\\n" -if [ ! -d $MONGODB_ROOT ]; then - printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" - curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && tar -xzf mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && mv $SRC_LOCATION/mongodb-linux-x86_64-amazon-$MONGODB_VERSION $MONGODB_ROOT \ - && touch $MONGODB_LOG_LOCATION/mongod.log \ - && rm -f mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ - && mkdir -p $MONGODB_DATA_LOCATION \ - && rm -rf $MONGODB_LINK_LOCATION \ - && rm -rf $BIN_LOCATION/mongod \ - && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ - && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ - || exit 1 - printf " - MongoDB successfully installed @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" -else - printf " - MongoDB found with correct version @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C driver installation...\\n" -if [ ! -d $MONGO_C_DRIVER_ROOT ]; then - printf "Installing MongoDB C driver...\\n" - curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ - && mkdir -p cmake-build \ - && cd cmake-build \ - && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ - && make -j"${JOBS}" \ - && make install \ - && cd ../.. \ - && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" -else - printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C++ driver installation...\\n" -if [ ! -d $MONGO_CXX_DRIVER_ROOT ]; then - printf "Installing MongoDB C++ driver...\\n" - curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ - && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ - && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ - && make -j"${JOBS}" VERBOSE=1 \ - && make install \ - && cd ../.. \ - && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + cd $SRC_LOCATION + printf "Checking zlib library installation...\\n" + if [ ! -d $OPT_LOCATION/zlib ] || [ $FORCE_BUILD ]; then + printf "Installing zlib...\\n" + curl -LO https://www.zlib.net/zlib-1.2.11.tar.gz && tar -xf zlib-1.2.11.tar.gz \ + && cd zlib-1.2.11 && mkdir build && cd build \ + && ../configure --prefix=$OPT_LOCATION/zlib \ + && make -j"${JOBS}" install \ + || exit -1 + fi + cd $SRC_LOCATION + export PATH=$OPT_LOCATION/clang8/bin:$PATH + printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" + BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) + if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then + printf "Installing Boost library...\\n" + curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ + && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ + && cd $BOOST_ROOT \ + && ./bootstrap.sh --prefix=$BOOST_ROOT \ + && ./b2 toolset=clang cxxflags="-stdlib=libc++ -D__STRICT_ANSI__ -nostdinc++ -I${CLANG8_ROOT}/include/c++/v1" linkflags="-stdlib=libc++" link=static threading=multi --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -q -j"${JOBS}" -sZLIB_LIBRARY_PATH="${OPT_LOCATION}/zlib/lib" -sZLIB_INCLUDE="${OPT_LOCATION}/zlib/include" -sZLIB_SOURCE="${SRC_LOCATION}/zlib-1.2.11" install \ + && cd .. \ + && rm -f boost_$BOOST_VERSION.tar.bz2 \ + && rm -rf $BOOST_LINK_LOCATION \ + && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ + || exit 1 + printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + else + printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + printf "\\n" else - printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi + printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" + BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) + if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then + printf "Installing Boost library...\\n" + curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ + && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ + && cd $BOOST_ROOT \ + && ./bootstrap.sh --prefix=$BOOST_ROOT \ + && ./b2 -q -j"${JOBS}" install \ + && cd .. \ + && rm -f boost_$BOOST_VERSION.tar.bz2 \ + && rm -rf $BOOST_LINK_LOCATION \ + && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ + || exit 1 + printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + else + printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -printf "\\n" + printf "\\n" + if [ $BUILD_MONGO ]; then + printf "Checking MongoDB installation...\\n" + if [ ! -d $MONGODB_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" + curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && tar -xzf mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && mv $SRC_LOCATION/mongodb-linux-x86_64-amazon-$MONGODB_VERSION $MONGODB_ROOT \ + && touch $MONGODB_LOG_LOCATION/mongod.log \ + && rm -f mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ + && mkdir -p $MONGODB_DATA_LOCATION \ + && rm -rf $MONGODB_LINK_LOCATION \ + && rm -rf $BIN_LOCATION/mongod \ + && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ + && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ + || exit 1 + printf " - MongoDB successfully installed @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" + else + printf " - MongoDB found with correct version @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C driver installation...\\n" + if [ ! -d $MONGO_C_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB C driver...\\n" + curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + && mkdir -p cmake-build \ + && cd cmake-build \ + && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ + && make -j"${JOBS}" \ + && make install \ + && cd ../.. \ + && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C++ driver installation...\\n" + if [ ! -d $MONGO_CXX_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB C++ driver...\\n" + curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ + && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ + && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ + && make -j"${JOBS}" VERBOSE=1 \ + && make install \ + && cd ../.. \ + && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -printf "Checking LLVM 4 support...\\n" -if [ ! -d $LLVM_ROOT ]; then - printf "Installing LLVM 4...\\n" - cd ../opt \ - && git clone --depth 1 --single-branch --branch $LLVM_VERSION https://github.com/llvm-mirror/llvm.git llvm && cd llvm \ - && mkdir build \ - && cd build \ - && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}" -DLLVM_TARGETS_TO_BUILD="host" -DLLVM_BUILD_TOOLS=false -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE="Release" .. \ - && make -j"${JOBS}" \ - && make install \ - && cd ../.. \ - || exit 1 - printf " - LLVM successfully installed @ ${LLVM_ROOT}\\n" -else - printf " - LLVM found @ ${LLVM_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi + printf "\\n" + fi + printf "Checking LLVM 4 support...\\n" + if [ ! -d $LLVM_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing LLVM 4...\\n" + cd ../opt \ + && git clone --depth 1 --single-branch --branch $LLVM_VERSION https://github.com/llvm-mirror/llvm.git llvm && cd llvm \ + && mkdir build \ + && cd build \ + && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}" -DLLVM_TARGETS_TO_BUILD="host" -DLLVM_BUILD_TOOLS=false -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE="Release" .. \ + && make -j"${JOBS}" \ + && make install \ + && cd ../.. \ + || exit 1 + printf " - LLVM successfully installed @ ${LLVM_ROOT}\\n" + else + printf " - LLVM found @ ${LLVM_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -cd .. -printf "\\n" + + cd .. + printf "\\n" +fi function print_instructions() { return 0 diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index 3988aef50a4..140705f4d6d 100755 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -25,6 +25,8 @@ printf "Disk space total: ${DISK_TOTAL%.*}G\\n" printf "Disk space available: ${DISK_AVAIL%.*}G\\n" printf "Concurrent Jobs (make -j): ${JOBS}\\n" +PINNED_TOOLCHAIN=-DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake + if [ "${MEM_MEG}" -lt 7000 ]; then printf "\\nYour system must have 7 or more Gigabytes of physical memory installed.\\n" printf "Exiting now.\\n\\n" @@ -169,8 +171,21 @@ fi printf "\\n" +### clean up force build before starting +if [ $FORCE_BUILD ];then + rm -rf \ + ${SRC_LOCATION}/cmake-$CMAKE_VERSION \ + ${SRC_LOCATION}/llvm ${OPT_LOCATION}/llvm4 \ + ${TMP_LOCATION}/clang8 ${OPT_LOCATION}/clang8 \ + ${SRC_LOCATION}/zlib ${OPT_LOCATION}/zlib \ + ${SRC_LOCATION}/boost ${BOOST_ROOT} \ + ${SRC_LOCATION}/mongodb-linux-x86_64-amazon-$MONGODB_VERSION \ + ${SRC_LOCATION}/mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + ${SRC_LOCATION}/mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION +fi + printf "Checking CMAKE installation...\\n" -if [ ! -e $CMAKE ]; then +if [ ! -e $CMAKE ] || [ $FORCE_BUILD ]; then printf "Installing CMAKE...\\n" curl -LO https://cmake.org/files/v$CMAKE_VERSION_MAJOR.$CMAKE_VERSION_MINOR/cmake-$CMAKE_VERSION.tar.gz \ && tar -xzf cmake-$CMAKE_VERSION.tar.gz \ @@ -192,112 +207,200 @@ printf "\\n" export CPATH="${CPATH}:${PYTHON3PATH}/root/usr/include/python3.6m" # m on the end causes problems with boost finding python3 -printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" -BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) -if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ]; then - printf "Installing Boost library...\\n" - curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ - && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ - && cd $BOOST_ROOT \ - && ./bootstrap.sh --prefix=$BOOST_ROOT \ - && ./b2 -q -j"${JOBS}" install \ - && cd .. \ - && rm -f boost_$BOOST_VERSION.tar.bz2 \ - && rm -rf $BOOST_LINK_LOCATION \ - && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ - || exit 1 - printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" -else - printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi - - -printf "\\n" - - -printf "Checking MongoDB installation...\\n" -if [ ! -d $MONGODB_ROOT ]; then - printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" - curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && tar -xzf mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && mv $SRC_LOCATION/mongodb-linux-x86_64-amazon-$MONGODB_VERSION $MONGODB_ROOT \ - && touch $MONGODB_LOG_LOCATION/mongod.log \ - && rm -f mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ - && mkdir -p $MONGODB_DATA_LOCATION \ - && rm -rf $MONGODB_LINK_LOCATION \ - && rm -rf $BIN_LOCATION/mongod \ - && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ - && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ - || exit 1 - printf " - MongoDB successfully installed @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" -else - printf " - MongoDB found with correct version @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C driver installation...\\n" -if [ ! -d $MONGO_C_DRIVER_ROOT ]; then - printf "Installing MongoDB C driver...\\n" - curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ - && mkdir -p cmake-build \ - && cd cmake-build \ - && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ - && make -j"${JOBS}" \ - && make install \ - && cd ../.. \ - && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" +if [ $PIN_COMPILER ]; then + printf "Checking Clang 8 support...\\n" + if [ ! -d $CLANG8_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing Clang 8...\\n" + cd ${TMP_LOCATION} \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/llvm.git clang8 && cd clang8 \ + && git checkout $PINNED_COMPILER_LLVM_COMMIT \ + && cd tools \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/lld.git \ + && cd lld && git checkout $PINNED_COMPILER_LLD_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/polly.git \ + && cd polly && git checkout $PINNED_COMPILER_POLLY_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang.git clang && cd clang/tools \ + && git checkout $PINNED_COMPILER_CLANG_VERSION \ + && mkdir extra && cd extra \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang-tools-extra.git \ + && cd clang-tools-extra && git checkout $PINNED_COMPILER_CLANG_TOOLS_EXTRA_COMMIT && cd .. \ + && cd ../../../../projects \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxx.git \ + && cd libcxx && git checkout $PINNED_COMPILER_LIBCXX_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxxabi.git \ + && cd libcxxabi && git checkout $PINNED_COMPILER_LIBCXXABI_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libunwind.git \ + && cd libunwind && git checkout $PINNED_COMPILER_LIBUNWIND_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/compiler-rt.git \ + && cd compiler-rt && git checkout $PINNED_COMPILER_COMPILER_RT_COMMIT && cd ../ \ + && cd ${TMP_LOCATION}/clang8 \ + && mkdir build && cd build \ + && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${CLANG8_ROOT}" -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_ENABLE_LIBCXX=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_INCLUDE_DOCS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release .. \ + && make -j"${JOBS}" \ + && make install \ + && rm -rf ${TMP_LOCATION}/clang8 \ + && cd ../.. \ + || exit 1 + + printf " - Clang 8 successfully installed @ ${CLANG8_ROOT}\\n" + else + printf " - Clang 8 found @ ${CLANG8_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + printf "\\n" + + printf "Checking LLVM 4 installation...\\n" + if [ ! -d $OPT_LOCATION/llvm4 ] || [ $FORCE_BUILD ]; then + printf "Installing LLVM 4...\\n" + cd $SRC_LOCATION \ + && git clone https://github.com/llvm-mirror/llvm --single-branch --branch $LLVM_VERSION && cd llvm \ + && mkdir -p build && cd build \ + && $CMAKE -DCMAKE_INSTALL_PREFIX=$OPT_LOCATION/llvm4 -DLLVM_TARGETS_TO_BUILD=host -DLLVM_BUILD_TOOLS=false -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake .. \ + && make -j"${JOBS}" install \ + || exit -1 + printf "Installed LLVM 4 @ ${OPT_LOCATION}/llvm4" + fi + + cd $SRC_LOCATION + printf "Checking zlib library installation...\\n" + if [ ! -d $OPT_LOCATION/zlib ] || [ $FORCE_BUILD ]; then + printf "Installing zlib...\\n" + curl -LO https://www.zlib.net/zlib-1.2.11.tar.gz && tar -xf zlib-1.2.11.tar.gz \ + && cd zlib-1.2.11 && mkdir build && cd build \ + && ../configure --prefix=$OPT_LOCATION/zlib \ + && make -j"${JOBS}" install \ + || exit -1 + fi + cd $SRC_LOCATION + export PATH=$OPT_LOCATION/clang8/bin:$PATH + printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" + BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) + if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then + printf "Installing Boost library...\\n" + curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ + && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ + && cd $BOOST_ROOT \ + && ./bootstrap.sh --prefix=$BOOST_ROOT \ + && ./b2 toolset=clang cxxflags="-stdlib=libc++ -D__STRICT_ANSI__ -nostdinc++ -I${CLANG8_ROOT}/include/c++/v1" linkflags="-stdlib=libc++" link=static threading=multi --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -q -j"${JOBS}" -sZLIB_LIBRARY_PATH="${OPT_LOCATION}/zlib/lib" -sZLIB_INCLUDE="${OPT_LOCATION}/zlib/include" -sZLIB_SOURCE="${SRC_LOCATION}/zlib-1.2.11" install \ + && cd .. \ + && rm -f boost_$BOOST_VERSION.tar.bz2 \ + && rm -rf $BOOST_LINK_LOCATION \ + && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ + || exit 1 + printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + else + printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + printf "\\n" else - printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" + printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" + BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) + if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then + printf "Installing Boost library...\\n" + curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ + && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ + && cd $BOOST_ROOT \ + && ./bootstrap.sh --prefix=$BOOST_ROOT \ + && ./b2 -q -j"${JOBS}" install \ + && cd .. \ + && rm -f boost_$BOOST_VERSION.tar.bz2 \ + && rm -rf $BOOST_LINK_LOCATION \ + && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ + || exit 1 + printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + else + printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + + printf "\\n" + + if [ $BUILD_MONGO ]; then + printf "Checking MongoDB installation...\\n" + if [ ! -d $MONGODB_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" + curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && tar -xzf mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && mv $SRC_LOCATION/mongodb-linux-x86_64-amazon-$MONGODB_VERSION $MONGODB_ROOT \ + && touch $MONGODB_LOG_LOCATION/mongod.log \ + && rm -f mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ + && mkdir -p $MONGODB_DATA_LOCATION \ + && rm -rf $MONGODB_LINK_LOCATION \ + && rm -rf $BIN_LOCATION/mongod \ + && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ + && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ + || exit 1 + printf " - MongoDB successfully installed @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" + else + printf " - MongoDB found with correct version @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C driver installation...\\n" + if [ ! -d $MONGO_C_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB C driver...\\n" + curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + && mkdir -p cmake-build \ + && cd cmake-build \ + && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ + && make -j"${JOBS}" \ + && make install \ + && cd ../.. \ + && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C++ driver installation...\\n" + if [ ! -d $MONGO_CXX_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB C++ driver...\\n" + curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ + && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ + && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ + && make -j"${JOBS}" VERBOSE=1 \ + && make install \ + && cd ../.. \ + && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + printf "\\n" + fi + + printf "Checking LLVM 4 support...\\n" + if [ ! -d $LLVM_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing LLVM 4...\\n" + cd ../opt \ + && git clone --depth 1 --single-branch --branch $LLVM_VERSION https://github.com/llvm-mirror/llvm.git llvm && cd llvm \ + && mkdir build \ + && cd build \ + && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}" -DLLVM_TARGETS_TO_BUILD="host" -DLLVM_BUILD_TOOLS=false -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE="Release" .. \ + && make -j"${JOBS}" \ + && make install \ + && cd ../.. \ + || exit 1 + printf " - LLVM successfully installed @ ${LLVM_ROOT}\\n" + else + printf " - LLVM found @ ${LLVM_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + cd .. + printf "\\n" fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C++ driver installation...\\n" -if [ ! -d $MONGO_CXX_DRIVER_ROOT ]; then - printf "Installing MongoDB C++ driver...\\n" - curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ - && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ - && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ - && make -j"${JOBS}" VERBOSE=1 \ - && make install \ - && cd ../.. \ - && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" -else - printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi - - -printf "\\n" - - -printf "Checking LLVM 4 support...\\n" -if [ ! -d $LLVM_ROOT ]; then - printf "Installing LLVM 4...\\n" - cd ../opt \ - && git clone --depth 1 --single-branch --branch $LLVM_VERSION https://github.com/llvm-mirror/llvm.git llvm && cd llvm \ - && mkdir build \ - && cd build \ - && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}" -DLLVM_TARGETS_TO_BUILD="host" -DLLVM_BUILD_TOOLS=false -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE="Release" .. \ - && make -j"${JOBS}" \ - && make install \ - && cd ../.. \ - || exit 1 - printf " - LLVM successfully installed @ ${LLVM_ROOT}\\n" -else - printf " - LLVM found @ ${LLVM_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi - - -cd .. -printf "\\n" function print_instructions() { printf "source ${PYTHON3PATH}/enable\\n" diff --git a/scripts/eosio_build_darwin.sh b/scripts/eosio_build_darwin.sh index 947dbb848c6..64b6222e34f 100755 --- a/scripts/eosio_build_darwin.sh +++ b/scripts/eosio_build_darwin.sh @@ -161,11 +161,22 @@ fi printf "\\n" +### clean up force build before starting +if [ $FORCE_BUILD ];then + rm -rf \ + ${SRC_LOCATION}/llvm ${OPT_LOCATION}/llvm4 \ + ${TMP_LOCATION}/clang8 ${OPT_LOCATION}/clang8 \ + ${SRC_LOCATION}/zlib ${OPT_LOCATION}/zlib \ + ${SRC_LOCATION}/boost \ + ${SRC_LOCATION}/mongodb-linux-x86_64-amazon-$MONGODB_VERSION \ + ${SRC_LOCATION}/mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + ${SRC_LOCATION}/mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION +fi export CPATH="$(python-config --includes | awk '{print $1}' | cut -dI -f2):$CPATH" # Boost has trouble finding pyconfig.h printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) -if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ]; then +if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then printf "Installing Boost library...\\n" curl -LO https://dl.bintray.com/boostorg/release/$BOOST_VERSION_MAJOR.$BOOST_VERSION_MINOR.$BOOST_VERSION_PATCH/source/boost_$BOOST_VERSION.tar.bz2 \ && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ @@ -187,65 +198,66 @@ if [ $? -ne 0 ]; then exit -1; fi printf "\\n" +if [ $BUILD_MONGO ]; then + printf "Checking MongoDB installation...\\n" + if [ ! -d $MONGODB_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" + curl -OL https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-$MONGODB_VERSION.tgz \ + && tar -xzf mongodb-osx-ssl-x86_64-$MONGODB_VERSION.tgz \ + && mv $SRC_LOCATION/mongodb-osx-x86_64-$MONGODB_VERSION $MONGODB_ROOT \ + && touch $MONGODB_LOG_LOCATION/mongod.log \ + && rm -f mongodb-osx-ssl-x86_64-$MONGODB_VERSION.tgz \ + && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ + && mkdir -p $MONGODB_DATA_LOCATION \ + && rm -rf $MONGODB_LINK_LOCATION \ + && rm -rf $BIN_LOCATION/mongod \ + && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ + && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ + || exit 1 + printf " - MongoDB successfully installed @ ${MONGODB_ROOT}\\n" + else + printf " - MongoDB found with correct version @ ${MONGODB_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C driver installation...\\n" + if [ ! -d $MONGO_C_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB C driver...\\n" + curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + && mkdir -p cmake-build \ + && cd cmake-build \ + && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=DARWIN -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ + && make -j"${JOBS}" \ + && make install \ + && cd ../.. \ + && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C++ driver installation...\\n" + if [ "$(grep "Version:" $PREFIX/lib/pkgconfig/libmongocxx-static.pc 2>/dev/null | tr -s ' ' | awk '{print $2}')" != $MONGO_CXX_DRIVER_VERSION ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB C++ driver...\\n" + curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ + && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ + && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ + && make -j"${JOBS}" VERBOSE=1 \ + && make install \ + && cd ../.. \ + && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB installation...\\n" -if [ ! -d $MONGODB_ROOT ]; then - printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" - curl -OL https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-$MONGODB_VERSION.tgz \ - && tar -xzf mongodb-osx-ssl-x86_64-$MONGODB_VERSION.tgz \ - && mv $SRC_LOCATION/mongodb-osx-x86_64-$MONGODB_VERSION $MONGODB_ROOT \ - && touch $MONGODB_LOG_LOCATION/mongod.log \ - && rm -f mongodb-osx-ssl-x86_64-$MONGODB_VERSION.tgz \ - && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ - && mkdir -p $MONGODB_DATA_LOCATION \ - && rm -rf $MONGODB_LINK_LOCATION \ - && rm -rf $BIN_LOCATION/mongod \ - && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ - && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ - || exit 1 - printf " - MongoDB successfully installed @ ${MONGODB_ROOT}\\n" -else - printf " - MongoDB found with correct version @ ${MONGODB_ROOT}.\\n" + printf "\\n" fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C driver installation...\\n" -if [ ! -d $MONGO_C_DRIVER_ROOT ]; then - printf "Installing MongoDB C driver...\\n" - curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ - && mkdir -p cmake-build \ - && cd cmake-build \ - && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=DARWIN -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ - && make -j"${JOBS}" \ - && make install \ - && cd ../.. \ - && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" -else - printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C++ driver installation...\\n" -if [ "$(grep "Version:" $PREFIX/lib/pkgconfig/libmongocxx-static.pc 2>/dev/null | tr -s ' ' | awk '{print $2}')" != $MONGO_CXX_DRIVER_VERSION ]; then - printf "Installing MongoDB C++ driver...\\n" - curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ - && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ - && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ - && make -j"${JOBS}" VERBOSE=1 \ - && make install \ - && cd ../.. \ - && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" -else - printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi - -printf "\\n" # We install llvm into /usr/local/opt using brew install llvm@4 @@ -262,6 +274,48 @@ fi cd .. printf "\\n" +if $PIN_COMPILER; then + printf "Checking Clang 8 support...\\n" + if [ ! -d $CLANG8_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing Clang 8...\\n" + cd ${TMP_LOCATION} \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/llvm.git clang8 \ + && cd clang8 && git checkout $PINNED_COMPILER_LLVM_COMMIT \ + && cd tools \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/lld.git \ + && cd lld && git checkout $PINNED_COMPILER_LLD_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/polly.git \ + && cd polly && git checkout $PINNED_COMPILER_POLLY_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang.git clang && cd clang/tools \ + && git checkout $PINNED_COMPILER_CLANG_VERSION \ + && mkdir extra && cd extra \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang-tools-extra.git \ + && cd clang-tools-extra && git checkout $PINNED_COMPILER_CLANG_TOOLS_EXTRA_COMMIT && cd .. \ + && cd ../../../../projects \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxx.git \ + && cd libcxx && git checkout $PINNED_COMPILER_LIBCXX_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxxabi.git \ + && cd libcxxabi && git checkout $PINNED_COMPILER_LIBCXXABI_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libunwind.git \ + && cd libunwind && git checkout $PINNED_COMPILER_LIBUNWIND_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/compiler-rt.git \ + && cd compiler-rt && git checkout $PINNED_COMPILER_COMPILER_RT_COMMIT && cd ../ \ + && cd ${TMP_LOCATION}/clang8 \ + && mkdir build && cd build \ + && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${CLANG8_ROOT}" -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_ENABLE_LIBCXX=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_INCLUDE_DOCS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD=all -DCMAKE_BUILD_TYPE=Release .. \ + && make -j"${JOBS}" \ + && make install \ + && cd ../.. \ + || exit 1 + printf " - Clang 8 successfully installed @ ${CLANG8_ROOT}\\n" + else + printf " - Clang 8 found @ ${CLANG8_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + printf "\\n" +fi + function print_instructions() { return 0 } diff --git a/scripts/eosio_build_fedora.sh b/scripts/eosio_build_fedora.sh index b1429b01931..46b5c4c041f 100755 --- a/scripts/eosio_build_fedora.sh +++ b/scripts/eosio_build_fedora.sh @@ -10,6 +10,8 @@ if [ "${OS_VER}" -lt 25 ]; then exit 1; fi +PINNED_TOOLCHAIN=-DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake + # procps-ng includes free command if [[ -z "$( rpm -qi "procps-ng" 2>/dev/null | grep Name )" ]]; then yum install -y procps-ng; fi MEM_MEG=$( free -m | sed -n 2p | tr -s ' ' | cut -d\ -f2 ) @@ -43,10 +45,15 @@ printf "Disk space available: ${DISK_AVAIL%.*}G\\n" # llvm is symlinked from /usr/lib64/llvm4.0 into user's home DEP_ARRAY=( git sudo procps-ng which gcc gcc-c++ autoconf automake libtool make \ - bzip2-devel wget bzip2 compat-openssl10 graphviz doxygen \ + bzip2-devel curl bzip2 compat-openssl10 graphviz doxygen \ openssl-devel gmp-devel libstdc++-devel python2 python2-devel python3 python3-devel \ - libedit ncurses-devel swig llvm4.0 llvm4.0-devel llvm4.0-libs llvm4.0-static libcurl-devel libusb-devel + libedit ncurses-devel swig libcurl-devel libusb-devel ) + +if [ ! $PIN_COMPILER ]; then + DEP_ARRAY+=(llvm4.0 llvm4.0-devel llvm4.0-libs llvm4.0-static) +fi + COUNT=1 DISPLAY="" DEP="" @@ -109,9 +116,21 @@ fi printf "\\n" +### clean up force build before starting +if [ $FORCE_BUILD ];then + rm -rf \ + ${SRC_LOCATION}/cmake-$CMAKE_VERSION \ + ${SRC_LOCATION}/llvm ${OPT_LOCATION}/llvm4 \ + ${TMP_LOCATION}/clang8 ${OPT_LOCATION}/clang8 \ + ${SRC_LOCATION}/zlib ${OPT_LOCATION}/zlib \ + ${SRC_LOCATION}/boost \ + ${SRC_LOCATION}/mongodb-linux-x86_64-amazon-$MONGODB_VERSION \ + ${SRC_LOCATION}/mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + ${SRC_LOCATION}/mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION +fi printf "Checking CMAKE installation...\\n" -if [ ! -e $CMAKE ]; then +if [ ! -e $CMAKE ] || [ $FORCE_BUILD ]; then printf "Installing CMAKE...\\n" curl -LO https://cmake.org/files/v$CMAKE_VERSION_MAJOR.$CMAKE_VERSION_MINOR/cmake-$CMAKE_VERSION.tar.gz \ && tar -xzf cmake-$CMAKE_VERSION.tar.gz \ @@ -128,108 +147,195 @@ else fi if [ $? -ne 0 ]; then exit -1; fi - printf "\\n" +if [ $PIN_COMPILER ]; then + printf "Checking Clang 8 support...\\n" + if [ ! -d $CLANG8_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing Clang 8...\\n" + cd ${TMP_LOCATION} \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/llvm.git clang8 && cd clang8 \ + && git checkout $PINNED_COMPILER_LLVM_COMMIT \ + && cd tools \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/lld.git \ + && cd lld && git checkout $PINNED_COMPILER_LLD_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/polly.git \ + && cd polly && git checkout $PINNED_COMPILER_POLLY_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang.git clang && cd clang/tools \ + && git checkout $PINNED_COMPILER_CLANG_VERSION \ + && mkdir extra && cd extra \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang-tools-extra.git \ + && cd clang-tools-extra && git checkout $PINNED_COMPILER_CLANG_TOOLS_EXTRA_COMMIT && cd .. \ + && cd ../../../../projects \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxx.git \ + && cd libcxx && git checkout $PINNED_COMPILER_LIBCXX_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxxabi.git \ + && cd libcxxabi && git checkout $PINNED_COMPILER_LIBCXXABI_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libunwind.git \ + && cd libunwind && git checkout $PINNED_COMPILER_LIBUNWIND_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/compiler-rt.git \ + && cd compiler-rt && git checkout $PINNED_COMPILER_COMPILER_RT_COMMIT && cd ../ \ + && cd ${TMP_LOCATION}/clang8 \ + && mkdir build && cd build \ + && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${CLANG8_ROOT}" -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_ENABLE_LIBCXX=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_INCLUDE_DOCS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release .. \ + && make -j"${JOBS}" \ + && make install \ + && rm -rf ${TMP_LOCATION}/clang8 \ + && cd ../.. \ + || exit 1 -printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" -BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) -if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ]; then - printf "Installing Boost library...\\n" - curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ - && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ - && cd $BOOST_ROOT \ - && ./bootstrap.sh --prefix=$BOOST_ROOT \ - && ./b2 -q -j"${JOBS}" install \ - && cd .. \ - && rm -f boost_$BOOST_VERSION.tar.bz2 \ - && rm -rf $BOOST_LINK_LOCATION \ - && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ - || exit 1 - printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" -else - printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi - + printf " - Clang 8 successfully installed @ ${CLANG8_ROOT}\\n" + else + printf " - Clang 8 found @ ${CLANG8_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -printf "\\n" + printf "\\n" + printf "Checking LLVM 4 installation...\\n" + if [ ! -d $OPT_LOCATION/llvm4 ] || [ $FORCE_BUILD ]; then + printf "Installing LLVM 4...\\n" + cd $SRC_LOCATION \ + && git clone https://github.com/llvm-mirror/llvm --single-branch --branch $LLVM_VERSION && cd llvm \ + && mkdir -p build && cd build \ + && $CMAKE -DCMAKE_INSTALL_PREFIX=$OPT_LOCATION/llvm4 -DLLVM_TARGETS_TO_BUILD=host -DLLVM_BUILD_TOOLS=false -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake .. \ + && make -j"${JOBS}" install \ + || exit -1 + printf "Installed LLVM 4 @ ${OPT_LOCATION}/llvm4" + fi -printf "Checking MongoDB installation...\\n" -if [ ! -d $MONGODB_ROOT ]; then - printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" - curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && tar -xzf mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && mv $SRC_LOCATION/mongodb-linux-x86_64-amazon-$MONGODB_VERSION $MONGODB_ROOT \ - && touch $MONGODB_LOG_LOCATION/mongod.log \ - && rm -f mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ - && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ - && mkdir -p $MONGODB_DATA_LOCATION \ - && rm -rf $MONGODB_LINK_LOCATION \ - && rm -rf $BIN_LOCATION/mongod \ - && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ - && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ - || exit 1 - printf " - MongoDB successfully installed @ ${MONGODB_ROOT}\\n" + cd $SRC_LOCATION + printf "Checking zlib library installation...\\n" + if [ ! -d $OPT_LOCATION/zlib ] || [ $FORCE_BUILD ]; then + printf "Installing zlib...\\n" + curl -LO https://www.zlib.net/zlib-1.2.11.tar.gz && tar -xf zlib-1.2.11.tar.gz \ + && cd zlib-1.2.11 && mkdir build && cd build \ + && ../configure --prefix=$OPT_LOCATION/zlib \ + && make -j"${JOBS}" install \ + || exit -1 + fi + cd $SRC_LOCATION + export PATH=$OPT_LOCATION/clang8/bin:$PATH + printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" + BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) + if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then + printf "Installing Boost library...\\n" + curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ + && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ + && cd $BOOST_ROOT \ + && ./bootstrap.sh --prefix=$BOOST_ROOT \ + && ./b2 toolset=clang cxxflags="-stdlib=libc++ -D__STRICT_ANSI__ -nostdinc++ -I${CLANG8_ROOT}/include/c++/v1" linkflags="-stdlib=libc++" link=static threading=multi --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -q -j"${JOBS}" -sZLIB_LIBRARY_PATH="${OPT_LOCATION}/zlib/lib" -sZLIB_INCLUDE="${OPT_LOCATION}/zlib/include" -sZLIB_SOURCE="${SRC_LOCATION}/zlib-1.2.11" install \ + && cd .. \ + && rm -f boost_$BOOST_VERSION.tar.bz2 \ + && rm -rf $BOOST_LINK_LOCATION \ + && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ + || exit 1 + printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + else + printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + printf "\\n" else - printf " - MongoDB found with correct version @ ${MONGODB_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C driver installation...\\n" -if [ ! -d $MONGO_C_DRIVER_ROOT ]; then - printf "Installing MongoDB C driver...\\n" - curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ - && mkdir -p cmake-build \ - && cd cmake-build \ - && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ - && make -j"${JOBS}" \ - && make install \ - && cd ../.. \ - && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" -else - printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C++ driver installation...\\n" -if [ ! -d $MONGO_CXX_DRIVER_ROOT ]; then - printf "Installing MongoDB C++ driver...\\n" - curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ - && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ - && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ - && make -j"${JOBS}" VERBOSE=1 \ - && make install \ - && cd ../.. \ - && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" -else - printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi + printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" + BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) + if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then + printf "Installing Boost library...\\n" + curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ + && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ + && cd $BOOST_ROOT \ + && ./bootstrap.sh --prefix=$BOOST_ROOT \ + && ./b2 -q -j"${JOBS}" install \ + && cd .. \ + && rm -f boost_$BOOST_VERSION.tar.bz2 \ + && rm -rf $BOOST_LINK_LOCATION \ + && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ + || exit 1 + printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + else + printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -printf "\\n" + printf "\\n" + if [ $BUILD_MONGO ]; then + printf "Checking MongoDB installation...\\n" + if [ ! -d $MONGODB_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" + curl -OL https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && tar -xzf mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && mv $SRC_LOCATION/mongodb-linux-x86_64-amazon-$MONGODB_VERSION $MONGODB_ROOT \ + && touch $MONGODB_LOG_LOCATION/mongod.log \ + && rm -f mongodb-linux-x86_64-amazon-$MONGODB_VERSION.tgz \ + && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ + && mkdir -p $MONGODB_DATA_LOCATION \ + && rm -rf $MONGODB_LINK_LOCATION \ + && rm -rf $BIN_LOCATION/mongod \ + && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ + && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ + || exit 1 + printf " - MongoDB successfully installed @ ${MONGODB_ROOT}\\n" + else + printf " - MongoDB found with correct version @ ${MONGODB_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C driver installation...\\n" + if [ ! -d $MONGO_C_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB C driver...\\n" + curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + && mkdir -p cmake-build \ + && cd cmake-build \ + && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ + && make -j"${JOBS}" \ + && make install \ + && cd ../.. \ + && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C++ driver installation...\\n" + if [ ! -d $MONGO_CXX_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB C++ driver...\\n" + curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ + && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ + && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ + && make -j"${JOBS}" VERBOSE=1 \ + && make install \ + && cd ../.. \ + && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -printf "Checking LLVM 4 support...\\n" -if [ ! -d $LLVM_ROOT ]; then - ln -s /usr/lib64/llvm4.0 $LLVM_ROOT \ - || exit 1 - printf " - LLVM successfully linked from /usr/lib64/llvm4.0 to ${LLVM_ROOT}\\n" -else - printf " - LLVM found @ ${LLVM_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi + printf "\\n" + fi -cd .. -printf "\\n" + printf "Checking LLVM 4 support...\\n" + if [ ! -d $LLVM_ROOT ] || [ $FORCE_BUILD ]; then + ln -s /usr/lib64/llvm4.0 $LLVM_ROOT \ + || exit 1 + printf " - LLVM successfully linked from /usr/lib64/llvm4.0 to ${LLVM_ROOT}\\n" + else + printf " - LLVM found @ ${LLVM_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + cd .. + printf "\\n" +fi function print_instructions() { return 0 diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 6b78c58f92e..6284d8e5a5a 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -25,6 +25,8 @@ printf "Disk install: ${DISK_INSTALL}\\n" printf "Disk space total: ${DISK_TOTAL%.*}G\\n" printf "Disk space available: ${DISK_AVAIL%.*}G\\n" +PINNED_TOOLCHAIN=-DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake + if [ "${MEM_MEG}" -lt 7000 ]; then printf "Your system must have 7 or more Gigabytes of physical memory installed.\\n" printf "Exiting now.\\n" @@ -68,13 +70,18 @@ if [ "${DISK_AVAIL%.*}" -lt "${DISK_MIN}" ]; then exit 1 fi -# llvm-4.0 is installed into /usr/lib/llvm-4.0 -# clang is necessary for building on ubuntu + DEP_ARRAY=( - git llvm-4.0 clang-4.0 libclang-4.0-dev make automake libbz2-dev libssl-dev doxygen graphviz \ - libgmp3-dev autotools-dev build-essential libicu-dev python2.7 python2.7-dev python3 python3-dev \ - autoconf libtool curl zlib1g-dev sudo ruby libusb-1.0-0-dev libcurl4-gnutls-dev pkg-config + git make automake libbz2-dev libssl-dev doxygen graphviz \ + libgmp3-dev autotools-dev build-essential libicu-dev python2.7 python2.7-dev python3 python3-dev \ + autoconf libtool curl zlib1g-dev sudo ruby libusb-1.0-0-dev libcurl4-gnutls-dev pkg-config ) + +# llvm-4.0 is installed into /usr/lib/llvm-4.0 +if [ ! $PIN_COMPILER ]; then + DEP_ARRAY+=(llvm-4.0 libclang-4.0-dev) +fi + COUNT=1 DISPLAY="" DEP="" @@ -133,9 +140,21 @@ fi printf "\\n" +### clean up force build before starting +if [ $FORCE_BUILD ];then + rm -rf \ + ${SRC_LOCATION}/cmake-$CMAKE_VERSION \ + ${SRC_LOCATION}/llvm ${OPT_LOCATION}/llvm4 \ + ${TMP_LOCATION}/clang8 ${OPT_LOCATION}/clang8 \ + ${SRC_LOCATION}/zlib ${OPT_LOCATION}/zlib \ + ${SRC_LOCATION}/boost \ + ${SRC_LOCATION}/mongodb-linux-x86_64-amazon-$MONGODB_VERSION \ + ${SRC_LOCATION}/mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + ${SRC_LOCATION}/mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION +fi printf "Checking CMAKE installation...\\n" -if [ ! -e $CMAKE ]; then +if [ ! -e $CMAKE ] || [ $FORCE_BUILD ]; then printf "Installing CMAKE...\\n" curl -LO https://cmake.org/files/v$CMAKE_VERSION_MAJOR.$CMAKE_VERSION_MINOR/cmake-$CMAKE_VERSION.tar.gz \ && tar -xzf cmake-$CMAKE_VERSION.tar.gz \ @@ -155,102 +174,198 @@ if [ $? -ne 0 ]; then exit -1; fi printf "\\n" +if [ $PIN_COMPILER ]; then + printf "Checking Clang 8 support...\\n" + if [ ! -d $CLANG8_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing Clang 8...\\n" + cd ${TMP_LOCATION} \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/llvm.git clang8 && cd clang8 \ + && git checkout $PINNED_COMPILER_LLVM_COMMIT \ + && cd tools \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/lld.git \ + && cd lld && git checkout $PINNED_COMPILER_LLD_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/polly.git \ + && cd polly && git checkout $PINNED_COMPILER_POLLY_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang.git clang && cd clang/tools \ + && git checkout $PINNED_COMPILER_CLANG_VERSION \ + && mkdir extra && cd extra \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang-tools-extra.git \ + && cd clang-tools-extra && git checkout $PINNED_COMPILER_CLANG_TOOLS_EXTRA_COMMIT && cd .. \ + && cd ../../../../projects \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxx.git \ + && cd libcxx && git checkout $PINNED_COMPILER_LIBCXX_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libcxxabi.git \ + && cd libcxxabi && git checkout $PINNED_COMPILER_LIBCXXABI_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/libunwind.git \ + && cd libunwind && git checkout $PINNED_COMPILER_LIBUNWIND_COMMIT && cd ../ \ + && git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/compiler-rt.git \ + && cd compiler-rt && git checkout $PINNED_COMPILER_COMPILER_RT_COMMIT && cd ../ \ + && cd ${TMP_LOCATION}/clang8 \ + && mkdir build && cd build \ + && $CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${CLANG8_ROOT}" -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_ENABLE_LIBCXX=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_INCLUDE_DOCS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_BUILD_TYPE=Release .. \ + && make -j"${JOBS}" \ + && make install \ + && rm -rf ${TMP_LOCATION}/clang8 \ + && cd ../.. \ + || exit 1 -printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" -BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) -if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ]; then - printf "Installing Boost library...\\n" - curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ - && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ - && cd $BOOST_ROOT \ - && ./bootstrap.sh --prefix=$BOOST_ROOT \ - && ./b2 -q -j"${JOBS}" install \ - && cd .. \ - && rm -f boost_$BOOST_VERSION.tar.bz2 \ - && rm -rf $BOOST_LINK_LOCATION \ - && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ - || exit 1 - printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" -else - printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi + printf " - Clang 8 successfully installed @ ${CLANG8_ROOT}\\n" + else + printf " - Clang 8 found @ ${CLANG8_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "\\n" -printf "\\n" + printf "Checking LLVM 4 installation...\\n" + if [ ! -d $OPT_LOCATION/llvm4 ] || [ $FORCE_BUILD ]; then + printf "Installing LLVM 4...\\n" + cd $SRC_LOCATION \ + && git clone https://github.com/llvm-mirror/llvm --single-branch --branch $LLVM_VERSION && cd llvm \ + && mkdir -p build && cd build \ + && $CMAKE -DCMAKE_INSTALL_PREFIX=$OPT_LOCATION/llvm4 -DLLVM_TARGETS_TO_BUILD=host -DLLVM_BUILD_TOOLS=false -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$BUILD_DIR/pinned_toolchain.cmake .. \ + && make -j"${JOBS}" install \ + || exit -1 + printf "Installed LLVM 4 @ ${OPT_LOCATION}/llvm4" + fi + cd $SRC_LOCATION + printf "Checking zlib library installation...\\n" + if [ ! -d $OPT_LOCATION/zlib || $FORCE_BUILD ]; then + printf "Installing zlib...\\n" + curl -LO https://www.zlib.net/zlib-1.2.11.tar.gz && tar -xf zlib-1.2.11.tar.gz \ + && cd zlib-1.2.11 && mkdir build && cd build \ + && ../configure --prefix=$OPT_LOCATION/zlib \ + && make -j"${JOBS}" install \ + || exit -1 + fi -printf "Checking MongoDB installation...\\n" -if [ ! -d $MONGODB_ROOT ]; then - printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" - curl -OL http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu$OS_MAJ$OS_MIN-$MONGODB_VERSION.tgz \ - && tar -xzf mongodb-linux-x86_64-ubuntu$OS_MAJ$OS_MIN-$MONGODB_VERSION.tgz \ - && mv $SRC_LOCATION/mongodb-linux-x86_64-ubuntu$OS_MAJ$OS_MIN-$MONGODB_VERSION $MONGODB_ROOT \ - && touch $MONGODB_LOG_LOCATION/mongod.log \ - && rm -f mongodb-linux-x86_64-ubuntu$OS_MAJ$OS_MIN-$MONGODB_VERSION.tgz \ - && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ - && mkdir -p $MONGODB_DATA_LOCATION \ - && rm -rf $MONGODB_LINK_LOCATION \ - && rm -rf $BIN_LOCATION/mongod \ - && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ - && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ - || exit 1 - printf " - MongoDB successfully installed @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" -else - printf " - MongoDB found with correct version @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C driver installation...\\n" -if [ ! -d $MONGO_C_DRIVER_ROOT ]; then - printf "Installing MongoDB C driver...\\n" - curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ - && mkdir -p cmake-build \ - && cd cmake-build \ - && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON .. \ - && make -j"${JOBS}" \ - && make install \ - && cd ../.. \ - && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" -else - printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi -printf "Checking MongoDB C++ driver installation...\\n" -if [ ! -d $MONGO_CXX_DRIVER_ROOT ]; then - printf "Installing MongoDB C++ driver...\\n" - curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ - && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION/build \ - && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX .. \ - && make -j"${JOBS}" VERBOSE=1 \ - && make install \ - && cd ../.. \ - && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ - || exit 1 - printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + cd $SRC_LOCATION + export PATH=$OPT_LOCATION/clang8/bin:$PATH + printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" + BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) + if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then + printf "Installing Boost library...\\n" + curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ + && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ + && cd $BOOST_ROOT \ + && ./bootstrap.sh --prefix=$BOOST_ROOT \ + && ./b2 toolset=clang cxxflags="-stdlib=libc++ -D__STRICT_ANSI__ -nostdinc++ -I${CLANG8_ROOT}/include/c++/v1" linkflags="-stdlib=libc++" link=static threading=multi --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -q -j"${JOBS}" -sZLIB_LIBRARY_PATH="${OPT_LOCATION}/zlib/lib" -sZLIB_INCLUDE="${OPT_LOCATION}/zlib/include" -sZLIB_SOURCE="${SRC_LOCATION}/zlib-1.2.11" install \ + && cd .. \ + && rm -f boost_$BOOST_VERSION.tar.bz2 \ + && rm -rf $BOOST_LINK_LOCATION \ + && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ + || exit 1 + printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + else + printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + + printf "\\n" else - printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi + printf "Checking Boost library (${BOOST_VERSION}) installation...\\n" + BOOSTVERSION=$( grep "#define BOOST_VERSION" "$BOOST_ROOT/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) + if [ "${BOOSTVERSION}" != "${BOOST_VERSION_MAJOR}0${BOOST_VERSION_MINOR}0${BOOST_VERSION_PATCH}" ] || [ $FORCE_BUILD ]; then + printf "Installing Boost library...\\n" + curl -LO https://dl.bintray.com/boostorg/release/${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_PATCH}/source/boost_$BOOST_VERSION.tar.bz2 \ + && tar -xjf boost_$BOOST_VERSION.tar.bz2 \ + && cd $BOOST_ROOT \ + && ./bootstrap.sh --prefix=$BOOST_ROOT \ + && ./b2 -q -j"${JOBS}" install \ + && cd .. \ + && rm -f boost_$BOOST_VERSION.tar.bz2 \ + && rm -rf $BOOST_LINK_LOCATION \ + && ln -s $BOOST_ROOT $BOOST_LINK_LOCATION \ + || exit 1 + printf " - Boost library successfully installed @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + else + printf " - Boost library found with correct version @ ${BOOST_ROOT} (Symlinked to ${BOOST_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "\\n" -printf "\\n" + if [ $BUILD_MONGO ]; then + printf "Checking MongoDB installation...\\n" + if [ ! -d $MONGODB_ROOT ] || [ $FORCE_BUILD ]; then + printf "Installing MongoDB into ${MONGODB_ROOT}...\\n" + curl -OL http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu$OS_MAJ$OS_MIN-$MONGODB_VERSION.tgz \ + && tar -xzf mongodb-linux-x86_64-ubuntu$OS_MAJ$OS_MIN-$MONGODB_VERSION.tgz \ + && mv $SRC_LOCATION/mongodb-linux-x86_64-ubuntu$OS_MAJ$OS_MIN-$MONGODB_VERSION $MONGODB_ROOT \ + && touch $MONGODB_LOG_LOCATION/mongod.log \ + && rm -f mongodb-linux-x86_64-ubuntu$OS_MAJ$OS_MIN-$MONGODB_VERSION.tgz \ + && cp -f $REPO_ROOT/scripts/mongod.conf $MONGODB_CONF \ + && mkdir -p $MONGODB_DATA_LOCATION \ + && rm -rf $MONGODB_LINK_LOCATION \ + && rm -rf $BIN_LOCATION/mongod \ + && ln -s $MONGODB_ROOT $MONGODB_LINK_LOCATION \ + && ln -s $MONGODB_LINK_LOCATION/bin/mongod $BIN_LOCATION/mongod \ + || exit 1 + printf " - MongoDB successfully installed @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" + else + printf " - MongoDB found with correct version @ ${MONGODB_ROOT} (Symlinked to ${MONGODB_LINK_LOCATION}).\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C driver installation...\\n" + if [ ! -d $MONGO_C_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + if [ ! $BUILD_CLANG8 ]; then + PINNED_TOOLCHAIN="" + fi + printf "Installing MongoDB C driver...\\n" + curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/$MONGO_C_DRIVER_VERSION/mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + && cd mongo-c-driver-$MONGO_C_DRIVER_VERSION \ + && mkdir -p cmake-build \ + && cd cmake-build \ + && $CMAKE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_BSON=ON -DENABLE_SSL=OPENSSL -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_STATIC=ON $PINNED_TOOLCHAIN .. \ + && make -j"${JOBS}" \ + && make install \ + && cd ../.. \ + && rm mongo-c-driver-$MONGO_C_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C driver successfully installed @ ${MONGO_C_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C driver found with correct version @ ${MONGO_C_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi + printf "Checking MongoDB C++ driver installation...\\n" + if [ ! -d $MONGO_CXX_DRIVER_ROOT ] || [ $FORCE_BUILD ]; then + if [ ! $BUILD_CLANG8 ]; then + PINNED_TOOLCHAIN="" + fi + printf "Installing MongoDB C++ driver...\\n" + curl -L https://github.com/mongodb/mongo-cxx-driver/archive/r$MONGO_CXX_DRIVER_VERSION.tar.gz -o mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + && tar -xzf mongo-cxx-driver-r${MONGO_CXX_DRIVER_VERSION}.tar.gz \ + && cd mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION \ + && sed '111 s/count/static_cast(count)/' src/mongocxx/options/change_stream.cpp &> src/mongocxx/options/change_stream.cpp \ + && cd build \ + && $CMAKE -DBUILD_SHARED_LIBS=OFF -DCXX_CMAKE_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX $PINNED_TOOLCHAIN .. \ + && make -j"${JOBS}" VERBOSE=1 \ + && make install \ + && cd ../.. \ + && rm -f mongo-cxx-driver-r$MONGO_CXX_DRIVER_VERSION.tar.gz \ + || exit 1 + printf " - MongoDB C++ driver successfully installed @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + else + printf " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi -printf "Checking LLVM 4 support...\\n" -if [ ! -d $LLVM_ROOT ]; then - ln -s /usr/lib/llvm-4.0 $LLVM_ROOT \ - || exit 1 - printf " - LLVM successfully linked from /usr/lib/llvm-4.0 to ${LLVM_ROOT}\\n" -else - printf " - LLVM found @ ${LLVM_ROOT}.\\n" -fi -if [ $? -ne 0 ]; then exit -1; fi + printf "\\n" + fi + printf "Checking LLVM 4 support...\\n" + if [ ! -d $LLVM_ROOT ] || [ $FORCE_BUILD ]; then + ln -s /usr/lib/llvm-4.0 $LLVM_ROOT \ + || exit 1 + printf " - LLVM successfully linked from /usr/lib/llvm-4.0 to ${LLVM_ROOT}\\n" + else + printf " - LLVM found @ ${LLVM_ROOT}.\\n" + fi + if [ $? -ne 0 ]; then exit -1; fi +fi cd .. printf "\\n" diff --git a/scripts/parallel-test.sh b/scripts/parallel-test.sh index fd53ca55198..cf555637437 100755 --- a/scripts/parallel-test.sh +++ b/scripts/parallel-test.sh @@ -3,9 +3,7 @@ set -e # exit on failure of any "simple" command (excludes &&, ||, or | chains) # prepare environment PATH=$PATH:~/opt/mongodb/bin echo "Extracting build directory..." -tar -zxf build.tar.gz -echo "Starting MongoDB..." -~/bin/mongod --fork --dbpath ~/data/mongodb -f ~/etc/mongod.conf --logpath "$(pwd)"/mongod.log +[[ -z "${1}" ]] && tar -zxf build.tar.gz || tar -xzf $1 cd /data/job/build # run tests echo "Running tests..." @@ -26,7 +24,6 @@ mv $(pwd)/Testing/$(ls $(pwd)/Testing/ | grep '20' | tail -n 1)/Test.xml $XML_FI buildkite-agent artifact upload config.ini buildkite-agent artifact upload genesis.json cd .. -buildkite-agent artifact upload mongod.log cd build buildkite-agent artifact upload $XML_FILENAME echo "Done uploading artifacts." @@ -35,4 +32,4 @@ if [[ "$EXIT_STATUS" != 0 ]]; then echo "Failing due to non-zero exit status from ctest: $EXIT_STATUS" echo ' ^^^ scroll up for more information ^^^' exit $EXIT_STATUS -fi \ No newline at end of file +fi diff --git a/scripts/pinned_toolchain.cmake b/scripts/pinned_toolchain.cmake new file mode 100644 index 00000000000..cdb517c5e1f --- /dev/null +++ b/scripts/pinned_toolchain.cmake @@ -0,0 +1,15 @@ +set(OPT_PATH @) +set(CMAKE_C_COMPILER_WORKS 1) +set(CMAKE_CXX_COMPILER_WORKS 1) +set(CMAKE_C_COMPILER ${OPT_PATH}/clang8/bin/clang) +set(CMAKE_CXX_COMPILER ${OPT_PATH}/clang8/bin/clang++) + +set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${OPT_PATH}/clang8/include/c++/v1 /usr/local/include /usr/include) + +set(CMAKE_CXX_FLAGS_INIT "-nostdinc++") + +set(CMAKE_EXE_LINKER_FLAGS_INIT "-stdlib=libc++ -nostdlib++") +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-stdlib=libc++ -nostdlib++") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "-stdlib=libc++ -nostdlib++") + +set(CMAKE_CXX_STANDARD_LIBRARIES "${OPT_PATH}/clang8/lib/libc++.a ${OPT_PATH}/clang8/lib/libc++abi.a") diff --git a/scripts/serial-test.sh b/scripts/serial-test.sh index 1d36e081712..109efb6e9d1 100755 --- a/scripts/serial-test.sh +++ b/scripts/serial-test.sh @@ -3,9 +3,9 @@ set -e # exit on failure of any "simple" command (excludes &&, ||, or | chains) # prepare environment PATH=$PATH:~/opt/mongodb/bin echo "Extracting build directory..." -tar -zxf build.tar.gz -echo "Starting MongoDB..." -~/bin/mongod --fork --dbpath ~/data/mongodb -f ~/etc/mongod.conf --logpath "$(pwd)"/mongod.log +[[ -z "${1}" ]] && tar -zxf build.tar.gz || tar -xzf $1 +#echo "Starting MongoDB..." +#~/bin/mongod --fork --dbpath ~/data/mongodb -f ~/etc/mongod.conf --logpath "$(pwd)"/mongod.log cd /data/job/build # run tests echo "Running tests..." @@ -24,7 +24,7 @@ mv $(pwd)/Testing/$(ls $(pwd)/Testing/ | grep '20' | tail -n 1)/Test.xml $XML_FI buildkite-agent artifact upload config.ini buildkite-agent artifact upload genesis.json cd .. -buildkite-agent artifact upload mongod.log +#buildkite-agent artifact upload mongod.log cd build buildkite-agent artifact upload $XML_FILENAME echo "Done uploading artifacts." @@ -33,4 +33,4 @@ if [[ "$EXIT_STATUS" != 0 ]]; then echo "Failing due to non-zero exit status from ctest: $EXIT_STATUS" echo ' ^^^ scroll up for more information ^^^' exit $EXIT_STATUS -fi \ No newline at end of file +fi diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index dfb2a029e26..b0a08280336 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -42,7 +42,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contracts.hpp.in ${CMAKE_CURRENT_BINA ### BUILD UNIT TEST EXECUTABLE ### file(GLOB UNIT_TESTS "*.cpp") # find all unit test suites add_executable( unit_test ${UNIT_TESTS}) # build unit tests as one executable + target_link_libraries( unit_test eosio_chain chainbase eosio_testing fc appbase ${PLATFORM_SPECIFIC_LIBS} ) + target_compile_options(unit_test PUBLIC -DDISABLE_EOSLIB_SERIALIZE) target_include_directories( unit_test PUBLIC ${CMAKE_SOURCE_DIR}/libraries/testing/include