From ea126174020a918f778c9687102c557678b97c83 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 14:24:36 -0400 Subject: [PATCH 01/22] removed python2 --- scripts/eosio_build_amazonlinux2_deps | 1 - scripts/eosio_build_centos7_deps | 2 -- scripts/eosio_build_darwin_deps | 1 - scripts/eosio_build_ubuntu_deps | 2 -- 4 files changed, 6 deletions(-) diff --git a/scripts/eosio_build_amazonlinux2_deps b/scripts/eosio_build_amazonlinux2_deps index c599e9b1ae4..abe8b2343d6 100755 --- a/scripts/eosio_build_amazonlinux2_deps +++ b/scripts/eosio_build_amazonlinux2_deps @@ -15,7 +15,6 @@ libcurl-devel,rpm -qa libusbx-devel,rpm -qa python3,rpm -qa python3-devel,rpm -qa -python-devel,rpm -qa libedit-devel,rpm -qa doxygen,rpm -qa graphviz,rpm -qa diff --git a/scripts/eosio_build_centos7_deps b/scripts/eosio_build_centos7_deps index 7f32fada681..19c8b966c28 100644 --- a/scripts/eosio_build_centos7_deps +++ b/scripts/eosio_build_centos7_deps @@ -11,8 +11,6 @@ openssl-devel,rpm -qa gmp-devel,rpm -qa ocaml,rpm -qa libicu-devel,rpm -qa -python,rpm -qa -python-devel,rpm -qa rh-python36,rpm -qa gettext-devel,rpm -qa file,rpm -qa diff --git a/scripts/eosio_build_darwin_deps b/scripts/eosio_build_darwin_deps index b2cf9a8c6f5..f45bc65c959 100755 --- a/scripts/eosio_build_darwin_deps +++ b/scripts/eosio_build_darwin_deps @@ -7,7 +7,6 @@ gmp,/usr/local/opt/gmp/include/gmpxx.h llvm@4,/usr/local/opt/llvm@4 pkgconfig,/usr/local/bin/pkg-config python,/usr/local/opt/python3 -python@2,/usr/local/opt/python2 doxygen,/usr/local/bin/doxygen libusb,/usr/local/lib/libusb-1.0.0.dylib openssl,/usr/local/opt/openssl/lib/libssl.a \ No newline at end of file diff --git a/scripts/eosio_build_ubuntu_deps b/scripts/eosio_build_ubuntu_deps index bfb6b776148..658ee058189 100644 --- a/scripts/eosio_build_ubuntu_deps +++ b/scripts/eosio_build_ubuntu_deps @@ -9,8 +9,6 @@ graphviz,dpkg -s libgmp3-dev,dpkg -s autotools-dev,dpkg -s libicu-dev,dpkg -s -python2.7,dpkg -s -python2.7-dev,dpkg -s python3,dpkg -s python3-dev,dpkg -s autoconf,dpkg -s From 84cd42d2878d2ed46b3fa1ab527e5283923386d5 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 16:01:59 -0400 Subject: [PATCH 02/22] build-essential is needed to install cmake, clang8, etc --- scripts/.build_vars | 3 +++ scripts/eosio_build_ubuntu.sh | 12 ++++++++---- scripts/helpers/eosio.sh | 15 +++++++-------- scripts/helpers/general.sh | 7 ++++--- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/scripts/.build_vars b/scripts/.build_vars index 585c521c935..da9c84a665b 100644 --- a/scripts/.build_vars +++ b/scripts/.build_vars @@ -6,6 +6,9 @@ export BIN_DIR=${EOSIO_INSTALL_DIR}/bin export LIB_DIR=${EOSIO_INSTALL_DIR}/lib export DATA_DIR=${EOSIO_INSTALL_DIR}/data +# Used to cleanup build-essential, unless the user has it already when they execute build scripts +export PINNED_BUILD_ESSENTIALS=false + # CMAKE export CMAKE_VERSION_MAJOR=3 export CMAKE_VERSION_MINOR=13 diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 0c267b976b4..31ce69bfaf4 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -11,14 +11,15 @@ echo "Disk space available: ${DISK_AVAIL}G" [[ "${DISK_AVAIL}" -lt "${DISK_MIN}" ]] && echo " - You must have at least ${DISK_MIN}GB of available storage to install EOSIO." && exit 1 # system clang and build essential for Ubuntu 18 (16 too old) -( [[ $PIN_COMPILER == false ]] && [[ "$(echo ${VERSION_ID})" == "18.04" ]] ) && ensure-build-essential && EXTRA_DEPS=(clang,dpkg\ -s) +ensure-build-essential # We need build-essential regardless to build cmake, clang, llvm, etc +# Handle clang/compiler; Must come before PIN_COMPILER/BUILD_CLANG +ensure-compiler +( [[ $PIN_COMPILER == false ]] && [[ "$(echo ${VERSION_ID})" == "18.04" ]] ) && EXTRA_DEPS=(clang,dpkg\ -s) # Ensure packages exist ([[ $PIN_COMPILER == false ]] && [[ $BUILD_CLANG == false ]]) && EXTRA_DEPS+=(llvm-4.0,dpkg\ -s) $ENABLE_COVERAGE_TESTING && EXTRA_DEPS+=(lcov,dpkg\ -s) ensure-apt-packages "${REPO_ROOT}/scripts/eosio_build_ubuntu_deps" $(echo ${EXTRA_DEPS[@]}) echo "" -# Handle clang/compiler -ensure-compiler # CMAKE Installation ensure-cmake # CLANG Installation @@ -89,4 +90,7 @@ if $INSTALL_MONGO; then else echo " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}." fi -fi \ No newline at end of file +fi + +# Cleanup build-essential as they were only needed for installing source packages +( $PINNED_BUILD_ESSENTIAL && $PIN_COMPILER ) && apt autoremove build-essential -y >/dev/null \ No newline at end of file diff --git a/scripts/helpers/eosio.sh b/scripts/helpers/eosio.sh index 3bea7b5f72b..62bb3c4ca86 100755 --- a/scripts/helpers/eosio.sh +++ b/scripts/helpers/eosio.sh @@ -146,14 +146,13 @@ function prompt-mongo-install() { } function ensure-compiler() { - DEFAULT_CXX=clang++ - DEFAULT_CC=clang if [[ $NAME == "CentOS Linux" ]]; then - DEFAULT_CXX=g++ - DEFAULT_CC=gcc + export CXX=${CXX:-'g++'} + export CC=${CC:-'gcc'} fi - export CXX=${CXX:-$DEFAULT_CXX} - export CC=${CC:-$DEFAULT_CC} + export CXX=${CXX:-'clang++'} + export CC=${CC:-'clang'} + echo "Using Compiler: CXX: $CXX & CC: $CC" if $PIN_COMPILER || [[ -f $CLANG_ROOT/bin/clang++ ]]; then export PIN_COMPILER=true export BUILD_CLANG=true @@ -161,7 +160,7 @@ function ensure-compiler() { export CC_COMP=$CLANG_ROOT/bin/clang export PATH=$CLANG_ROOT/bin:$PATH elif [[ $PIN_COMPILER == false ]]; then - which $CXX &>/dev/null || ( echo "${COLOR_RED}Unable to find compiler: Pass in the -P option if you wish for us to install it or install a C++17 compiler and set \$CXX and \$CC to the proper binary locations. ${COLOR_NC}"; exit 1 ) + which $CXX &>/dev/null || ( echo "${COLOR_RED}Unable to find $CXX compiler: Pass in the -P option if you wish for us to install it or install a C++17 compiler and set \$CXX and \$CC to the proper binary locations. ${COLOR_NC}"; exit 1 ) # readlink on mac differs from linux readlink (mac doesn't have -f) [[ $ARCH == "Linux" ]] && READLINK_COMMAND="readlink -f" || READLINK_COMMAND="readlink" COMPILER_TYPE=$( eval $READLINK_COMMAND $(which $CXX) || true ) @@ -181,7 +180,7 @@ function ensure-compiler() { [[ $( $(which $CXX) -dumpversion | cut -d '.' -f 1 ) -lt 7 ]] && export NO_CPP17=true if [[ $NO_CPP17 == false ]]; then # https://github.com/EOSIO/eos/issues/7402 while true; do - echo "${COLOR_YELLOW}WARNING: Your GCC compiler is less performant than clang (https://github.com/EOSIO/eos/issues/7402). We suggest running the build script with -P or install your own clang and try again. ${CXX}!${COLOR_NC}" + echo "${COLOR_YELLOW}WARNING: Your GCC compiler ($CXX) is less performant than clang (https://github.com/EOSIO/eos/issues/7402). We suggest running the build script with -P or install your own clang and try again.${COLOR_NC}" [[ $NONINTERACTIVE == false ]] && printf "${COLOR_YELLOW}Do you wish to proceed anyway? (y/n)?${COLOR_NC}" && read -p " " PROCEED case $PROCEED in "" ) echo "What would you like to do?";; diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index b6e8fd57363..ed206fc34e5 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -169,7 +169,7 @@ function ensure-devtoolset() { } function ensure-build-essential() { - echo "${COLOR_CYAN}[Ensuring installation of build-essential with C++7]${COLOR_NC}" + echo "${COLOR_CYAN}[Ensuring installation of build-essential (needed for installing depedencies; we will remove it after)]${COLOR_NC}" BUILD_ESSENTIAL=$( dpkg -s build-essential | grep 'Package: build-essential' || true ) if [[ -z $BUILD_ESSENTIAL ]]; then while true; do @@ -177,8 +177,9 @@ function ensure-build-essential() { echo "" case $PROCEED in "" ) echo "What would you like to do?";; - 0 | true | [Yy]* ) - if install-package build-essential; then + 0 | true | [Yy]* ) + if install-package build-essential WETRUN; then + $PIN_COMPILER && export PINNED_BUILD_ESSENTIALS=true echo " - ${COLOR_GREEN}Installed build-essential${COLOR_NC}" else echo " - ${COLOR_GREEN}Install of build-essential failed. Please try a manual install.${COLOR_NC}" From 34a414a80acedaf60c3ea47e3b37d8103c70f485 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 16:47:24 -0400 Subject: [PATCH 03/22] fixed bats for ubuntu --- scripts/helpers/general.sh | 2 +- tests/bash-bats/eosio_build.sh | 3 ++- tests/bash-bats/helpers/functions.sh | 2 +- tests/bash-bats/modules/clang.sh | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index ed206fc34e5..8dff4074f32 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -178,7 +178,7 @@ function ensure-build-essential() { case $PROCEED in "" ) echo "What would you like to do?";; 0 | true | [Yy]* ) - if install-package build-essential WETRUN; then + if install-package build-essential; then $PIN_COMPILER && export PINNED_BUILD_ESSENTIALS=true echo " - ${COLOR_GREEN}Installed build-essential${COLOR_NC}" else diff --git a/tests/bash-bats/eosio_build.sh b/tests/bash-bats/eosio_build.sh index 50e3e066881..f5059b2dd00 100644 --- a/tests/bash-bats/eosio_build.sh +++ b/tests/bash-bats/eosio_build.sh @@ -26,12 +26,13 @@ TEST_LABEL="[eosio_build]" # No c++! run bash -c "printf \"y\ny\ny\nn\nn\n\" | ./${SCRIPT_LOCATION}" fi - [[ ! -z $(echo "${output}" | grep "Unable to find compiler") ]] || exit + [[ ! -z $(echo "${output}" | grep "Unable to find .* compiler") ]] || exit fi cd ./scripts # Also test that we can run the script from a directory other than the root run bash -c "./eosio_build.sh -y -P" [[ ! -z $(echo "${output}" | grep "PIN_COMPILER: true") ]] || exit + [[ ! -z $(echo "${output}" | grep "Installed build-essential") ]] || exit # Ensure build-essentials is installed so we can compile cmake, clang, boost, etc [[ "${output}" =~ -DCMAKE_TOOLCHAIN_FILE=\'.*/scripts/../build/pinned_toolchain.cmake\' ]] || exit [[ "${output}" =~ "Clang 8 successfully installed" ]] || exit # -P with prompts diff --git a/tests/bash-bats/helpers/functions.sh b/tests/bash-bats/helpers/functions.sh index 0aabbbe947b..43935f23413 100644 --- a/tests/bash-bats/helpers/functions.sh +++ b/tests/bash-bats/helpers/functions.sh @@ -22,6 +22,6 @@ function teardown() { # teardown is run once after each test, even if it fails uninstall-package devtoolset-8* WETRUN uninstall-package centos-release-scl uninstall-package gcc-c++ WETRUN - uninstall-package build-essential WETRUN + ( [[ $NAME == 'Ubuntu' ]] && [[ ! $( dpkg -s build-essential 2>/dev/null ) ]] ) && apt autoremove build-essential -y &>/dev/null } trap teardown EXIT \ No newline at end of file diff --git a/tests/bash-bats/modules/clang.sh b/tests/bash-bats/modules/clang.sh index 1f8dba4fb1e..4033dc4c66d 100755 --- a/tests/bash-bats/modules/clang.sh +++ b/tests/bash-bats/modules/clang.sh @@ -20,7 +20,7 @@ load ../helpers/functions # [[ ! -z $(echo "${output}" | grep "$CLANG_ROOT") ]] || exit # fi ## CLANG - uninstall-package build-essential WETRUN 1>/dev/null + apt autoremove build-essential -y 1>/dev/null run bash -c "./$SCRIPT_LOCATION -y -P" [[ ! -z $(echo "${output}" | grep "PIN_COMPILER: true") ]] || exit [[ ! -z $(echo "${output}" | grep "Clang 8 successfully installed") ]] || exit @@ -30,6 +30,6 @@ load ../helpers/functions export CXX=c2234 export CC=ewwqd run bash -c "./$SCRIPT_LOCATION -y" - [[ ! -z $(echo "${output}" | grep "Unable to find compiler") ]] || exit + [[ ! -z $(echo "${output}" | grep "Unable to find .* compiler") ]] || exit } \ No newline at end of file From f55bd24205b96eb31f0b799551d1b9970713dc8e Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 17:44:18 -0400 Subject: [PATCH 04/22] bats fixes --- scripts/eosio_build_ubuntu.sh | 2 +- scripts/helpers/eosio.sh | 1 - scripts/helpers/general.sh | 48 ++++++++++++++------------- tests/bash-bats/eosio_build.sh | 5 ++- tests/bash-bats/eosio_build_ubuntu.sh | 3 +- tests/bash-bats/helpers/functions.sh | 17 ++++++---- 6 files changed, 42 insertions(+), 34 deletions(-) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 31ce69bfaf4..62b1b9de7f8 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -93,4 +93,4 @@ if $INSTALL_MONGO; then fi # Cleanup build-essential as they were only needed for installing source packages -( $PINNED_BUILD_ESSENTIAL && $PIN_COMPILER ) && apt autoremove build-essential -y >/dev/null \ No newline at end of file +($PIN_COMPILER && $PINNED_BUILD_ESSENTIALS) && apt autoremove build-essential -y; true \ No newline at end of file diff --git a/scripts/helpers/eosio.sh b/scripts/helpers/eosio.sh index 62bb3c4ca86..c765705d944 100755 --- a/scripts/helpers/eosio.sh +++ b/scripts/helpers/eosio.sh @@ -152,7 +152,6 @@ function ensure-compiler() { fi export CXX=${CXX:-'clang++'} export CC=${CC:-'clang'} - echo "Using Compiler: CXX: $CXX & CC: $CC" if $PIN_COMPILER || [[ -f $CLANG_ROOT/bin/clang++ ]]; then export PIN_COMPILER=true export BUILD_CLANG=true diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index 8dff4074f32..5cb3ff3f705 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -169,29 +169,31 @@ function ensure-devtoolset() { } function ensure-build-essential() { - echo "${COLOR_CYAN}[Ensuring installation of build-essential (needed for installing depedencies; we will remove it after)]${COLOR_NC}" - BUILD_ESSENTIAL=$( dpkg -s build-essential | grep 'Package: build-essential' || true ) - if [[ -z $BUILD_ESSENTIAL ]]; then - while true; do - [[ $NONINTERACTIVE == false ]] && printf "${COLOR_YELLOW}Do you wish to install it? (y/n)?${COLOR_NC}" && read -p " " PROCEED - echo "" - case $PROCEED in - "" ) echo "What would you like to do?";; - 0 | true | [Yy]* ) - if install-package build-essential; then - $PIN_COMPILER && export PINNED_BUILD_ESSENTIALS=true - echo " - ${COLOR_GREEN}Installed build-essential${COLOR_NC}" - else - echo " - ${COLOR_GREEN}Install of build-essential failed. Please try a manual install.${COLOR_NC}" - exit 1 - fi - break;; - 1 | false | [Nn]* ) echo " - User aborted installation of build-essential."; break;; - * ) echo "Please type 'y' for yes or 'n' for no.";; - esac - done - else - echo " - ${BUILD_ESSENTIAL} found." + if [[ ! $(dpkg -s clang 2>/dev/null) ]]; then # Clang already exists, so no need for build essentials + echo "${COLOR_CYAN}[Ensuring installation of build-essential (needed for installing depedencies; we will remove it after)]${COLOR_NC}" + BUILD_ESSENTIAL=$( dpkg -s build-essential | grep 'Package: build-essential' || true ) + if [[ -z $BUILD_ESSENTIAL ]]; then + while true; do + [[ $NONINTERACTIVE == false ]] && printf "${COLOR_YELLOW}Do you wish to install it? (y/n)?${COLOR_NC}" && read -p " " PROCEED + echo "" + case $PROCEED in + "" ) echo "What would you like to do?";; + 0 | true | [Yy]* ) + if install-package build-essential; then + $PIN_COMPILER && export PINNED_BUILD_ESSENTIALS=true + echo " - ${COLOR_GREEN}Installed build-essential${COLOR_NC}" + else + echo " - ${COLOR_GREEN}Install of build-essential failed. Please try a manual install.${COLOR_NC}" + exit 1 + fi + break;; + 1 | false | [Nn]* ) echo " - User aborted installation of build-essential."; break;; + * ) echo "Please type 'y' for yes or 'n' for no.";; + esac + done + else + echo " - ${BUILD_ESSENTIAL} found." + fi fi } diff --git a/tests/bash-bats/eosio_build.sh b/tests/bash-bats/eosio_build.sh index f5059b2dd00..fe78e93c8cf 100644 --- a/tests/bash-bats/eosio_build.sh +++ b/tests/bash-bats/eosio_build.sh @@ -32,7 +32,10 @@ TEST_LABEL="[eosio_build]" cd ./scripts # Also test that we can run the script from a directory other than the root run bash -c "./eosio_build.sh -y -P" [[ ! -z $(echo "${output}" | grep "PIN_COMPILER: true") ]] || exit - [[ ! -z $(echo "${output}" | grep "Installed build-essential") ]] || exit # Ensure build-essentials is installed so we can compile cmake, clang, boost, etc + # Ensure build-essentials is installed so we can compile cmake, clang, boost, etc + if [[ $NAME == "Ubuntu" ]]; then + [[ ! -z $(echo "${output}" | grep "Installed build-essential") ]] || exit + fi [[ "${output}" =~ -DCMAKE_TOOLCHAIN_FILE=\'.*/scripts/../build/pinned_toolchain.cmake\' ]] || exit [[ "${output}" =~ "Clang 8 successfully installed" ]] || exit # -P with prompts diff --git a/tests/bash-bats/eosio_build_ubuntu.sh b/tests/bash-bats/eosio_build_ubuntu.sh index c87630c59ee..e18145369f1 100644 --- a/tests/bash-bats/eosio_build_ubuntu.sh +++ b/tests/bash-bats/eosio_build_ubuntu.sh @@ -28,7 +28,6 @@ export TEST_LABEL="[eosio_build_ubuntu]" # Testing clang already existing (no pinning of clang8) install-package clang WETRUN &>/dev/null run bash -c "printf \"y\n%.0s\" {1..100} | ./$SCRIPT_LOCATION -i /NEWPATH" - [[ ! -z $(echo "${output}" | grep "Executing: make -j${JOBS}") ]] || exit [[ ! -z $(echo "${output}" | grep "Starting EOSIO Dependency Install") ]] || exit [[ ! -z $(echo "${output}" | grep python.*found) ]] || exit @@ -42,5 +41,5 @@ export TEST_LABEL="[eosio_build_ubuntu]" [[ -z $(echo "${output}" | grep "- NOT found.") ]] || exit [[ -z $(echo "${output}" | grep lcov.*found.) ]] || exit [[ ! -z $(echo "${output}" | grep "EOSIO has been successfully built") ]] || exit - [[ "$(echo ${VERSION_ID})" == "16.04" ]] && uninstall-package clang WETRUN || uninstall-package build-essential WETRUN + [[ "$(echo ${VERSION_ID})" == "16.04" ]] && uninstall-package clang WETRUN || apt autoremove build-essential -y } diff --git a/tests/bash-bats/helpers/functions.sh b/tests/bash-bats/helpers/functions.sh index 43935f23413..f8edaea624a 100644 --- a/tests/bash-bats/helpers/functions.sh +++ b/tests/bash-bats/helpers/functions.sh @@ -17,11 +17,16 @@ setup-bats-dirs function teardown() { # teardown is run once after each test, even if it fails [[ -d "$HOME" ]] && rm -rf "$HOME" - uninstall-package which WETRUN - uninstall-package sudo WETRUN - uninstall-package devtoolset-8* WETRUN - uninstall-package centos-release-scl - uninstall-package gcc-c++ WETRUN - ( [[ $NAME == 'Ubuntu' ]] && [[ ! $( dpkg -s build-essential 2>/dev/null ) ]] ) && apt autoremove build-essential -y &>/dev/null + if [[ $ARCH == "Linux" ]]; then + uninstall-package which WETRUN + export SUDO_FORCE_REMOVE=yes + uninstall-package sudo WETRUN + uninstall-package devtoolset-8* WETRUN + uninstall-package centos-release-scl + uninstall-package gcc-c++ WETRUN + if [[ $NAME == 'Ubuntu' ]]; then + [[ ! $( dpkg -s build-essential 2>/dev/null ) ]] && apt autoremove build-essential -y &>/dev/null + fi + fi } trap teardown EXIT \ No newline at end of file From b39bdae93064cab12eef94de0dc8322fb44cba63 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 17:44:35 -0400 Subject: [PATCH 05/22] bats fixes --- tests/bash-bats/eosio_build_centos.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/bash-bats/eosio_build_centos.sh b/tests/bash-bats/eosio_build_centos.sh index f03ef6fe2ae..c58cee78e9d 100644 --- a/tests/bash-bats/eosio_build_centos.sh +++ b/tests/bash-bats/eosio_build_centos.sh @@ -35,7 +35,6 @@ export TEST_LABEL="[eosio_build_centos]" [[ ! -z $(echo "${output}" | grep "Starting EOSIO Dependency Install") ]] || exit [[ ! -z $(echo "${output}" | grep "Executing: eval /usr/bin/yum -y update") ]] || exit [[ ! -z $(echo "${output}" | grep "Python36 successfully enabled") ]] || exit - [[ ! -z $(echo "${output}" | grep "python.*found!") ]] || exit [[ -z $(echo "${output}" | grep "- NOT found.") ]] || exit [[ ! -z $(echo "${output}" | grep "Ensuring CMAKE") ]] || exit [[ ! -z $(echo "${output}" | grep /NEWPATH.*/src/boost) ]] || exit From fab96f115b5b41126b27c82c991a8a716eb3c971 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 20:12:45 -0400 Subject: [PATCH 06/22] g++ for ubuntu16 so it prompts to install clang8 --- scripts/eosio_build_ubuntu.sh | 9 +++++---- scripts/helpers/eosio.sh | 2 +- scripts/helpers/general.sh | 11 ++++------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 62b1b9de7f8..69e52161d6a 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -11,15 +11,16 @@ echo "Disk space available: ${DISK_AVAIL}G" [[ "${DISK_AVAIL}" -lt "${DISK_MIN}" ]] && echo " - You must have at least ${DISK_MIN}GB of available storage to install EOSIO." && exit 1 # system clang and build essential for Ubuntu 18 (16 too old) -ensure-build-essential # We need build-essential regardless to build cmake, clang, llvm, etc -# Handle clang/compiler; Must come before PIN_COMPILER/BUILD_CLANG -ensure-compiler -( [[ $PIN_COMPILER == false ]] && [[ "$(echo ${VERSION_ID})" == "18.04" ]] ) && EXTRA_DEPS=(clang,dpkg\ -s) +( [[ $PIN_COMPILER == false ]] && [[ $VERSION_ID == "18.04" ]] ) && EXTRA_DEPS=(clang,dpkg\ -s) +# We install clang8 for Ubuntu 16, but we still need something to compile cmake, boost, etc +[[ $VERSION_ID == "16.04" ]] && ensure-build-essential # Ensure packages exist ([[ $PIN_COMPILER == false ]] && [[ $BUILD_CLANG == false ]]) && EXTRA_DEPS+=(llvm-4.0,dpkg\ -s) $ENABLE_COVERAGE_TESTING && EXTRA_DEPS+=(lcov,dpkg\ -s) ensure-apt-packages "${REPO_ROOT}/scripts/eosio_build_ubuntu_deps" $(echo ${EXTRA_DEPS[@]}) echo "" +# Handle clang/compiler +ensure-compiler # CMAKE Installation ensure-cmake # CLANG Installation diff --git a/scripts/helpers/eosio.sh b/scripts/helpers/eosio.sh index c765705d944..c9d160c6b35 100755 --- a/scripts/helpers/eosio.sh +++ b/scripts/helpers/eosio.sh @@ -146,7 +146,7 @@ function prompt-mongo-install() { } function ensure-compiler() { - if [[ $NAME == "CentOS Linux" ]]; then + if [[ $NAME == "CentOS Linux" ]] || [[ $VERSION_ID == "16.04" ]]; then export CXX=${CXX:-'g++'} export CC=${CC:-'gcc'} fi diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index 5cb3ff3f705..15397a727bb 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -179,13 +179,10 @@ function ensure-build-essential() { case $PROCEED in "" ) echo "What would you like to do?";; 0 | true | [Yy]* ) - if install-package build-essential; then - $PIN_COMPILER && export PINNED_BUILD_ESSENTIALS=true - echo " - ${COLOR_GREEN}Installed build-essential${COLOR_NC}" - else - echo " - ${COLOR_GREEN}Install of build-essential failed. Please try a manual install.${COLOR_NC}" - exit 1 - fi + apt update + install-package build-essential + $PIN_COMPILER && export PINNED_BUILD_ESSENTIALS=true + echo " - ${COLOR_GREEN}Installed build-essential${COLOR_NC}" break;; 1 | false | [Nn]* ) echo " - User aborted installation of build-essential."; break;; * ) echo "Please type 'y' for yes or 'n' for no.";; From d00eb75caf367d388d92d82998715eb2910b7aa3 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 20:22:43 -0400 Subject: [PATCH 07/22] quick fix --- tests/bash-bats/eosio_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bash-bats/eosio_build.sh b/tests/bash-bats/eosio_build.sh index fe78e93c8cf..e550bf8141b 100644 --- a/tests/bash-bats/eosio_build.sh +++ b/tests/bash-bats/eosio_build.sh @@ -33,7 +33,7 @@ TEST_LABEL="[eosio_build]" run bash -c "./eosio_build.sh -y -P" [[ ! -z $(echo "${output}" | grep "PIN_COMPILER: true") ]] || exit # Ensure build-essentials is installed so we can compile cmake, clang, boost, etc - if [[ $NAME == "Ubuntu" ]]; then + if [[ $VERSION_ID == "16.04" ]]; then [[ ! -z $(echo "${output}" | grep "Installed build-essential") ]] || exit fi [[ "${output}" =~ -DCMAKE_TOOLCHAIN_FILE=\'.*/scripts/../build/pinned_toolchain.cmake\' ]] || exit From 5e111952af97b056710c43fb5ada6c0f728a402d Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 20:35:34 -0400 Subject: [PATCH 08/22] various fixes for ubuntu: --- tests/bash-bats/eosio_build_ubuntu.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/bash-bats/eosio_build_ubuntu.sh b/tests/bash-bats/eosio_build_ubuntu.sh index e18145369f1..3c3296d0b0e 100644 --- a/tests/bash-bats/eosio_build_ubuntu.sh +++ b/tests/bash-bats/eosio_build_ubuntu.sh @@ -10,23 +10,22 @@ export TEST_LABEL="[eosio_build_ubuntu]" # A helper function is available to show output and status: `debug` -# Testing Root user -./tests/bash-bats/modules/root-user.sh -# Testing Options -./tests/bash-bats/modules/dep_script_options.sh -# Testing CMAKE -./tests/bash-bats/modules/cmake.sh -# Testing Clang -./tests/bash-bats/modules/clang.sh -# Testing MongoDB -./tests/bash-bats/modules/mongodb.sh +# # Testing Root user +# ./tests/bash-bats/modules/root-user.sh +# # Testing Options +# ./tests/bash-bats/modules/dep_script_options.sh +# # Testing CMAKE +# ./tests/bash-bats/modules/cmake.sh +# # Testing Clang +# ./tests/bash-bats/modules/clang.sh +# # Testing MongoDB +# ./tests/bash-bats/modules/mongodb.sh ## Needed to load eosio_build_ files properly; it can be empty @test "${TEST_LABEL} > General" { set_system_vars # Obtain current machine's resources and set the necessary variables (like JOBS, etc) - # Testing clang already existing (no pinning of clang8) - install-package clang WETRUN &>/dev/null + [[ "$(echo ${VERSION_ID})" == "16.04" ]] && install-package build-essential WETRUN 1>/dev/null || install-package clang WETRUN 1>/dev/null run bash -c "printf \"y\n%.0s\" {1..100} | ./$SCRIPT_LOCATION -i /NEWPATH" [[ ! -z $(echo "${output}" | grep "Executing: make -j${JOBS}") ]] || exit [[ ! -z $(echo "${output}" | grep "Starting EOSIO Dependency Install") ]] || exit @@ -41,5 +40,5 @@ export TEST_LABEL="[eosio_build_ubuntu]" [[ -z $(echo "${output}" | grep "- NOT found.") ]] || exit [[ -z $(echo "${output}" | grep lcov.*found.) ]] || exit [[ ! -z $(echo "${output}" | grep "EOSIO has been successfully built") ]] || exit - [[ "$(echo ${VERSION_ID})" == "16.04" ]] && uninstall-package clang WETRUN || apt autoremove build-essential -y + [[ "$(echo ${VERSION_ID})" == "16.04" ]] && apt autoremove build-essential -y || uninstall-package clang WETRUN } From b7a0279387c5e1ba95cd47d5a17f41b07bbdcea2 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Mon, 24 Jun 2019 20:43:01 -0400 Subject: [PATCH 09/22] quick fix --- tests/bash-bats/eosio_build_ubuntu.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/bash-bats/eosio_build_ubuntu.sh b/tests/bash-bats/eosio_build_ubuntu.sh index 3c3296d0b0e..f5153719359 100644 --- a/tests/bash-bats/eosio_build_ubuntu.sh +++ b/tests/bash-bats/eosio_build_ubuntu.sh @@ -10,16 +10,16 @@ export TEST_LABEL="[eosio_build_ubuntu]" # A helper function is available to show output and status: `debug` -# # Testing Root user -# ./tests/bash-bats/modules/root-user.sh -# # Testing Options -# ./tests/bash-bats/modules/dep_script_options.sh -# # Testing CMAKE -# ./tests/bash-bats/modules/cmake.sh -# # Testing Clang -# ./tests/bash-bats/modules/clang.sh -# # Testing MongoDB -# ./tests/bash-bats/modules/mongodb.sh +# Testing Root user +./tests/bash-bats/modules/root-user.sh +# Testing Options +./tests/bash-bats/modules/dep_script_options.sh +# Testing CMAKE +./tests/bash-bats/modules/cmake.sh +# Testing Clang +./tests/bash-bats/modules/clang.sh +# Testing MongoDB +./tests/bash-bats/modules/mongodb.sh ## Needed to load eosio_build_ files properly; it can be empty @test "${TEST_LABEL} > General" { From 22aceb1ff1b4db00de00d63a9edbe6453f7af843 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 07:54:56 -0400 Subject: [PATCH 10/22] removed apt update --- scripts/helpers/general.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index 15397a727bb..25f56677588 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -179,7 +179,6 @@ function ensure-build-essential() { case $PROCEED in "" ) echo "What would you like to do?";; 0 | true | [Yy]* ) - apt update install-package build-essential $PIN_COMPILER && export PINNED_BUILD_ESSENTIALS=true echo " - ${COLOR_GREEN}Installed build-essential${COLOR_NC}" From 7a2579f023edb03f064846b9bffb8d1be811e0e3 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 07:59:35 -0400 Subject: [PATCH 11/22] build-essential for 18 if pinning --- scripts/eosio_build_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 69e52161d6a..0927e33b45d 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -13,7 +13,7 @@ echo "Disk space available: ${DISK_AVAIL}G" # system clang and build essential for Ubuntu 18 (16 too old) ( [[ $PIN_COMPILER == false ]] && [[ $VERSION_ID == "18.04" ]] ) && EXTRA_DEPS=(clang,dpkg\ -s) # We install clang8 for Ubuntu 16, but we still need something to compile cmake, boost, etc -[[ $VERSION_ID == "16.04" ]] && ensure-build-essential +[[ $VERSION_ID == "16.04" ]] || ( $PIN_COMPILER && [[ $VERSION_ID == "18.04" ]] ) && ensure-build-essential # Ensure packages exist ([[ $PIN_COMPILER == false ]] && [[ $BUILD_CLANG == false ]]) && EXTRA_DEPS+=(llvm-4.0,dpkg\ -s) $ENABLE_COVERAGE_TESTING && EXTRA_DEPS+=(lcov,dpkg\ -s) From 402b522f040cb6c5d89488057ecc0466920c4410 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 08:00:28 -0400 Subject: [PATCH 12/22] build-essential for 18 if pinning --- scripts/eosio_build_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 0927e33b45d..0b95dfb8cc6 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -12,7 +12,7 @@ echo "Disk space available: ${DISK_AVAIL}G" # system clang and build essential for Ubuntu 18 (16 too old) ( [[ $PIN_COMPILER == false ]] && [[ $VERSION_ID == "18.04" ]] ) && EXTRA_DEPS=(clang,dpkg\ -s) -# We install clang8 for Ubuntu 16, but we still need something to compile cmake, boost, etc +# We install clang8 for Ubuntu 16, but we still need something to compile cmake, boost, etc + pinned 18 still needs something to build source [[ $VERSION_ID == "16.04" ]] || ( $PIN_COMPILER && [[ $VERSION_ID == "18.04" ]] ) && ensure-build-essential # Ensure packages exist ([[ $PIN_COMPILER == false ]] && [[ $BUILD_CLANG == false ]]) && EXTRA_DEPS+=(llvm-4.0,dpkg\ -s) From c02dafd0daa22777d1c907af7354a1fcb2290f0b Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 08:10:02 -0400 Subject: [PATCH 13/22] python2 back --- scripts/eosio_build_amazonlinux2_deps | 1 + scripts/eosio_build_centos7_deps | 2 ++ scripts/eosio_build_darwin_deps | 1 + scripts/eosio_build_ubuntu_deps | 2 ++ 4 files changed, 6 insertions(+) diff --git a/scripts/eosio_build_amazonlinux2_deps b/scripts/eosio_build_amazonlinux2_deps index abe8b2343d6..c599e9b1ae4 100755 --- a/scripts/eosio_build_amazonlinux2_deps +++ b/scripts/eosio_build_amazonlinux2_deps @@ -15,6 +15,7 @@ libcurl-devel,rpm -qa libusbx-devel,rpm -qa python3,rpm -qa python3-devel,rpm -qa +python-devel,rpm -qa libedit-devel,rpm -qa doxygen,rpm -qa graphviz,rpm -qa diff --git a/scripts/eosio_build_centos7_deps b/scripts/eosio_build_centos7_deps index 19c8b966c28..b40dee8416d 100644 --- a/scripts/eosio_build_centos7_deps +++ b/scripts/eosio_build_centos7_deps @@ -12,6 +12,8 @@ gmp-devel,rpm -qa ocaml,rpm -qa libicu-devel,rpm -qa rh-python36,rpm -qa +python,rpm -qa +python-devel,rpm -qa gettext-devel,rpm -qa file,rpm -qa libusbx-devel,rpm -qa diff --git a/scripts/eosio_build_darwin_deps b/scripts/eosio_build_darwin_deps index f45bc65c959..b2cf9a8c6f5 100755 --- a/scripts/eosio_build_darwin_deps +++ b/scripts/eosio_build_darwin_deps @@ -7,6 +7,7 @@ gmp,/usr/local/opt/gmp/include/gmpxx.h llvm@4,/usr/local/opt/llvm@4 pkgconfig,/usr/local/bin/pkg-config python,/usr/local/opt/python3 +python@2,/usr/local/opt/python2 doxygen,/usr/local/bin/doxygen libusb,/usr/local/lib/libusb-1.0.0.dylib openssl,/usr/local/opt/openssl/lib/libssl.a \ No newline at end of file diff --git a/scripts/eosio_build_ubuntu_deps b/scripts/eosio_build_ubuntu_deps index 658ee058189..e9174618e19 100644 --- a/scripts/eosio_build_ubuntu_deps +++ b/scripts/eosio_build_ubuntu_deps @@ -11,6 +11,8 @@ autotools-dev,dpkg -s libicu-dev,dpkg -s python3,dpkg -s python3-dev,dpkg -s +python2.7,dpkg -s +python2.7-dev,dpkg -s autoconf,dpkg -s libtool,dpkg -s curl,dpkg -s From 12ecda860e1a42bf3d8180993f0e0ba7551ea5c0 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 09:13:19 -0400 Subject: [PATCH 14/22] build-essentials for 18.04 --- scripts/eosio_build_ubuntu.sh | 2 +- scripts/helpers/eosio.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 0b95dfb8cc6..b14897268fa 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -13,7 +13,7 @@ echo "Disk space available: ${DISK_AVAIL}G" # system clang and build essential for Ubuntu 18 (16 too old) ( [[ $PIN_COMPILER == false ]] && [[ $VERSION_ID == "18.04" ]] ) && EXTRA_DEPS=(clang,dpkg\ -s) # We install clang8 for Ubuntu 16, but we still need something to compile cmake, boost, etc + pinned 18 still needs something to build source -[[ $VERSION_ID == "16.04" ]] || ( $PIN_COMPILER && [[ $VERSION_ID == "18.04" ]] ) && ensure-build-essential +( [[ $VERSION_ID == "16.04" ]] || ( $PIN_COMPILER && [[ $VERSION_ID == "18.04" ]] ) ) && ensure-build-essential # Ensure packages exist ([[ $PIN_COMPILER == false ]] && [[ $BUILD_CLANG == false ]]) && EXTRA_DEPS+=(llvm-4.0,dpkg\ -s) $ENABLE_COVERAGE_TESTING && EXTRA_DEPS+=(lcov,dpkg\ -s) diff --git a/scripts/helpers/eosio.sh b/scripts/helpers/eosio.sh index c9d160c6b35..5d4b3e1ff60 100755 --- a/scripts/helpers/eosio.sh +++ b/scripts/helpers/eosio.sh @@ -146,7 +146,8 @@ function prompt-mongo-install() { } function ensure-compiler() { - if [[ $NAME == "CentOS Linux" ]] || [[ $VERSION_ID == "16.04" ]]; then + # Support build-essentials + if [[ $NAME == "CentOS Linux" ]] || [[ $VERSION_ID == "16.04" ]] || ( $PIN_COMPILER && [[ $VERSION_ID == "18.04" ]] ); then export CXX=${CXX:-'g++'} export CC=${CC:-'gcc'} fi From c565311b256aabda66d64736b091c1c9d1471ea7 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 09:22:12 -0400 Subject: [PATCH 15/22] build-essential for 18.04 --- tests/bash-bats/eosio_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bash-bats/eosio_build.sh b/tests/bash-bats/eosio_build.sh index e550bf8141b..fe78e93c8cf 100644 --- a/tests/bash-bats/eosio_build.sh +++ b/tests/bash-bats/eosio_build.sh @@ -33,7 +33,7 @@ TEST_LABEL="[eosio_build]" run bash -c "./eosio_build.sh -y -P" [[ ! -z $(echo "${output}" | grep "PIN_COMPILER: true") ]] || exit # Ensure build-essentials is installed so we can compile cmake, clang, boost, etc - if [[ $VERSION_ID == "16.04" ]]; then + if [[ $NAME == "Ubuntu" ]]; then [[ ! -z $(echo "${output}" | grep "Installed build-essential") ]] || exit fi [[ "${output}" =~ -DCMAKE_TOOLCHAIN_FILE=\'.*/scripts/../build/pinned_toolchain.cmake\' ]] || exit From 634d0248e25b35afb5fc2e1170386ea88bb4e61b Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 10:27:34 -0400 Subject: [PATCH 16/22] autoremove added to function --- scripts/eosio_build_ubuntu.sh | 2 +- scripts/helpers/general.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index b14897268fa..980f0aaf372 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -94,4 +94,4 @@ if $INSTALL_MONGO; then fi # Cleanup build-essential as they were only needed for installing source packages -($PIN_COMPILER && $PINNED_BUILD_ESSENTIALS) && apt autoremove build-essential -y; true \ No newline at end of file +($PIN_COMPILER && $PINNED_BUILD_ESSENTIALS) && uninstall-package build-essential autoremove \ No newline at end of file diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index 25f56677588..ab7ff61d960 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -97,12 +97,14 @@ function install-package() { function uninstall-package() { if [[ $ARCH == "Linux" ]]; then EXECUTION_FUNCTION="execute" + REMOVE="remove" [[ $2 == "WETRUN" ]] && EXECUTION_FUNCTION="execute-always" + ( [[ $2 == "autoremove" ]] || [[ $3 == "autoremove" ]] ) && REMOVE="autoremove" ( [[ $2 =~ "--" ]] || [[ $3 =~ "--" ]] ) && OPTIONS="${2}${3}" [[ $CURRENT_USER != "root" ]] && [[ ! -z $SUDO_LOCATION ]] && SUDO_COMMAND="$SUDO_LOCATION -E" # Check if the packages exist before uninstalling them. This speeds things up for tests. - ( ( [[ $NAME =~ "Amazon Linux" ]] || [[ $NAME == "CentOS Linux" ]] ) && [[ ! -z $(rpm -qa $1) ]] ) && eval $EXECUTION_FUNCTION $SUDO_COMMAND $YUM $OPTIONS remove -y $1 - ( [[ $NAME =~ "Ubuntu" ]] && $(dpkg -s $1 &>/dev/null) ) && eval $EXECUTION_FUNCTION $SUDO_COMMAND $APTGET $OPTIONS remove -y $1 + ( ( [[ $NAME =~ "Amazon Linux" ]] || [[ $NAME == "CentOS Linux" ]] ) && [[ ! -z $(rpm -qa $1) ]] ) && eval $EXECUTION_FUNCTION $SUDO_COMMAND $YUM $OPTIONS $REMOVE -y $1 + ( [[ $NAME =~ "Ubuntu" ]] && $(dpkg -s $1 &>/dev/null) ) && eval $EXECUTION_FUNCTION $SUDO_COMMAND $APTGET $OPTIONS $REMOVE -y $1 fi true } From d4c1c0eb024768657e93a4248322433e522a38a9 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 10:52:19 -0400 Subject: [PATCH 17/22] back to devtoolset-7 to try and address clang8 failures --- scripts/eosio_build_centos.sh | 14 +++++++------- scripts/eosio_build_ubuntu.sh | 2 +- scripts/helpers/general.sh | 8 ++++---- tests/bash-bats/eosio_build_centos.sh | 10 +++++----- tests/bash-bats/helpers/functions.sh | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index 44a96474fe0..5e68df2ff28 100755 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -12,17 +12,15 @@ echo "Disk space available: ${DISK_AVAIL}G" echo "" -# Repo necessary for rh-python3 and devtoolset-8 +# Repo necessary for rh-python3 and devtoolset-7 ensure-scl # GCC7 for Centos / Needed for CMAKE install even if we're pinning ensure-devtoolset -if [[ -d /opt/rh/devtoolset-8 ]]; then - echo "${COLOR_CYAN}[Enabling Centos devtoolset-8 (for newer GCC)]${COLOR_NC}" - execute-always source /opt/rh/devtoolset-8/enable - echo " - ${COLOR_GREEN}Centos devtoolset-8 successfully enabled!${COLOR_NC}" +if [[ -d /opt/rh/devtoolset-7 ]]; then + echo "${COLOR_CYAN}[Enabling Centos devtoolset-7 (for newer GCC)]${COLOR_NC}" + execute-always source /opt/rh/devtoolset-7/enable + echo " - ${COLOR_GREEN}Centos devtoolset-7 successfully enabled!${COLOR_NC}" fi -# Handle clang/compiler -ensure-compiler # Ensure packages exist ensure-yum-packages "${REPO_ROOT}/scripts/eosio_build_centos7_deps" export PYTHON3PATH="/opt/rh/rh-python36" @@ -32,6 +30,8 @@ if $DRYRUN || [ -d $PYTHON3PATH ]; then echo " ${COLOR_GREEN}- Python36 successfully enabled!${COLOR_NC}" echo "" fi +# Handle clang/compiler +ensure-compiler # CMAKE Installation ensure-cmake # CLANG Installation diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 980f0aaf372..f656b8fbb82 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -94,4 +94,4 @@ if $INSTALL_MONGO; then fi # Cleanup build-essential as they were only needed for installing source packages -($PIN_COMPILER && $PINNED_BUILD_ESSENTIALS) && uninstall-package build-essential autoremove \ No newline at end of file +($PIN_COMPILER && $PINNED_BUILD_ESSENTIALS) && uninstall-package build-essential autoremove; true \ No newline at end of file diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index ab7ff61d960..d262429199f 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -152,16 +152,16 @@ function ensure-scl() { } function ensure-devtoolset() { - echo "${COLOR_CYAN}[Ensuring installation of devtoolset-8]${COLOR_NC}" - DEVTOOLSET=$( rpm -qa | grep -E 'devtoolset-8-[0-9].*' || true ) + echo "${COLOR_CYAN}[Ensuring installation of devtoolset-7]${COLOR_NC}" + DEVTOOLSET=$( rpm -qa | grep -E 'devtoolset-7-[0-9].*' || true ) if [[ -z "${DEVTOOLSET}" ]]; then while true; do [[ $NONINTERACTIVE == false ]] && printf "${COLOR_YELLOW}Not Found: Do you wish to install it? (y/n)?${COLOR_NC}" && read -p " " PROCEED echo "" case $PROCEED in "" ) echo "What would you like to do?";; - 0 | true | [Yy]* ) install-package devtoolset-8; break;; - 1 | false | [Nn]* ) echo " - User aborted installation of devtoolset-8."; break;; + 0 | true | [Yy]* ) install-package devtoolset-7; break;; + 1 | false | [Nn]* ) echo " - User aborted installation of devtoolset-7."; break;; * ) echo "Please type 'y' for yes or 'n' for no.";; esac done diff --git a/tests/bash-bats/eosio_build_centos.sh b/tests/bash-bats/eosio_build_centos.sh index c58cee78e9d..fbd0acbf0fc 100644 --- a/tests/bash-bats/eosio_build_centos.sh +++ b/tests/bash-bats/eosio_build_centos.sh @@ -25,12 +25,12 @@ export TEST_LABEL="[eosio_build_centos]" set_system_vars # Obtain current machine's resources and set the necessary variables (like JOBS, etc) execute-always yum -y --enablerepo=extras install centos-release-scl &>/dev/null - install-package devtoolset-8 WETRUN &>/dev/null - # Ensure SCL and devtoolset-8 for c++ binary installation + install-package devtoolset-7 WETRUN &>/dev/null + # Ensure SCL and devtoolset-7 for c++ binary installation run bash -c "printf \"y\n%.0s\" {1..100}| ./${SCRIPT_LOCATION} -i /NEWPATH" [[ ! -z $(echo "${output}" | grep "centos-release-scl-2-3.el7.centos.noarch found") ]] || exit - [[ ! -z $(echo "${output}" | grep "devtoolset-8-8.0-2.el7.x86_64 found") ]] || exit - [[ ! -z $(echo "${output}" | grep "Executing: source /opt/rh/devtoolset-8/enable") ]] || exit + [[ ! -z $(echo "${output}" | grep "devtoolset-7-8.0-2.el7.x86_64 found") ]] || exit + [[ ! -z $(echo "${output}" | grep "Executing: source /opt/rh/devtoolset-7/enable") ]] || exit [[ ! -z $(echo "${output}" | grep "Executing: make -j${JOBS}") ]] || exit [[ ! -z $(echo "${output}" | grep "Starting EOSIO Dependency Install") ]] || exit [[ ! -z $(echo "${output}" | grep "Executing: eval /usr/bin/yum -y update") ]] || exit @@ -41,6 +41,6 @@ export TEST_LABEL="[eosio_build_centos]" [[ ! -z $(echo "${output}" | grep "Starting EOSIO Build") ]] || exit [[ ! -z $(echo "${output}" | grep "make -j${CPU_CORES}") ]] || exit [[ ! -z $(echo "${output}" | grep "EOSIO has been successfully built") ]] || exit - uninstall-package devtoolset-8* WETRUN &>/dev/null + uninstall-package devtoolset-7* WETRUN &>/dev/null uninstall-package centos-release-scl WETRUN &>/dev/null } \ No newline at end of file diff --git a/tests/bash-bats/helpers/functions.sh b/tests/bash-bats/helpers/functions.sh index f8edaea624a..fe720dc6f5f 100644 --- a/tests/bash-bats/helpers/functions.sh +++ b/tests/bash-bats/helpers/functions.sh @@ -21,7 +21,7 @@ function teardown() { # teardown is run once after each test, even if it fails uninstall-package which WETRUN export SUDO_FORCE_REMOVE=yes uninstall-package sudo WETRUN - uninstall-package devtoolset-8* WETRUN + uninstall-package devtoolset-7* WETRUN uninstall-package centos-release-scl uninstall-package gcc-c++ WETRUN if [[ $NAME == 'Ubuntu' ]]; then From 092965839456c25ba72b50cb11bfbace46245627 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 11:04:18 -0400 Subject: [PATCH 18/22] bats fixes --- tests/bash-bats/eosio_build.sh | 7 ++----- tests/bash-bats/eosio_build_centos.sh | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/bash-bats/eosio_build.sh b/tests/bash-bats/eosio_build.sh index fe78e93c8cf..fe1e8f8c8c2 100644 --- a/tests/bash-bats/eosio_build.sh +++ b/tests/bash-bats/eosio_build.sh @@ -19,14 +19,11 @@ TEST_LABEL="[eosio_build]" fi if [[ $ARCH == "Linux" ]]; then - if [[ $NAME == "CentOS Linux" ]]; then # Centos has the SCL prompt before checking for the compiler - # No c++! - run bash -c "printf \"y\ny\ny\nn\n\" | ./${SCRIPT_LOCATION}" - else + if [[ $NAME != "CentOS Linux" ]]; then # Centos has the SCL prompt before checking for the compiler # No c++! run bash -c "printf \"y\ny\ny\nn\nn\n\" | ./${SCRIPT_LOCATION}" + [[ ! -z $(echo "${output}" | grep "Unable to find .* compiler") ]] || exit fi - [[ ! -z $(echo "${output}" | grep "Unable to find .* compiler") ]] || exit fi cd ./scripts # Also test that we can run the script from a directory other than the root diff --git a/tests/bash-bats/eosio_build_centos.sh b/tests/bash-bats/eosio_build_centos.sh index fbd0acbf0fc..7e25f3af292 100644 --- a/tests/bash-bats/eosio_build_centos.sh +++ b/tests/bash-bats/eosio_build_centos.sh @@ -29,7 +29,7 @@ export TEST_LABEL="[eosio_build_centos]" # Ensure SCL and devtoolset-7 for c++ binary installation run bash -c "printf \"y\n%.0s\" {1..100}| ./${SCRIPT_LOCATION} -i /NEWPATH" [[ ! -z $(echo "${output}" | grep "centos-release-scl-2-3.el7.centos.noarch found") ]] || exit - [[ ! -z $(echo "${output}" | grep "devtoolset-7-8.0-2.el7.x86_64 found") ]] || exit + [[ ! -z $(echo "${output}" | grep "devtoolset-7.* found") ]] || exit [[ ! -z $(echo "${output}" | grep "Executing: source /opt/rh/devtoolset-7/enable") ]] || exit [[ ! -z $(echo "${output}" | grep "Executing: make -j${JOBS}") ]] || exit [[ ! -z $(echo "${output}" | grep "Starting EOSIO Dependency Install") ]] || exit From 4df0d856a7d9290e9754ad3eac75efccaa71dbd9 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 14:11:02 -0400 Subject: [PATCH 19/22] removed uninstall of build-essential --- scripts/.build_vars | 3 --- scripts/eosio_build_ubuntu.sh | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/.build_vars b/scripts/.build_vars index da9c84a665b..585c521c935 100644 --- a/scripts/.build_vars +++ b/scripts/.build_vars @@ -6,9 +6,6 @@ export BIN_DIR=${EOSIO_INSTALL_DIR}/bin export LIB_DIR=${EOSIO_INSTALL_DIR}/lib export DATA_DIR=${EOSIO_INSTALL_DIR}/data -# Used to cleanup build-essential, unless the user has it already when they execute build scripts -export PINNED_BUILD_ESSENTIALS=false - # CMAKE export CMAKE_VERSION_MAJOR=3 export CMAKE_VERSION_MINOR=13 diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index f656b8fbb82..6912919cc1e 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -91,7 +91,4 @@ if $INSTALL_MONGO; then else echo " - MongoDB C++ driver found with correct version @ ${MONGO_CXX_DRIVER_ROOT}." fi -fi - -# Cleanup build-essential as they were only needed for installing source packages -($PIN_COMPILER && $PINNED_BUILD_ESSENTIALS) && uninstall-package build-essential autoremove; true \ No newline at end of file +fi \ No newline at end of file From fa054057f476775cb4ab9e672007dfd7bddf82de Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Tue, 25 Jun 2019 14:13:49 -0400 Subject: [PATCH 20/22] various fixes --- scripts/eosio_build_centos7_deps | 2 +- scripts/eosio_build_ubuntu_deps | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/eosio_build_centos7_deps b/scripts/eosio_build_centos7_deps index b40dee8416d..7f32fada681 100644 --- a/scripts/eosio_build_centos7_deps +++ b/scripts/eosio_build_centos7_deps @@ -11,9 +11,9 @@ openssl-devel,rpm -qa gmp-devel,rpm -qa ocaml,rpm -qa libicu-devel,rpm -qa -rh-python36,rpm -qa python,rpm -qa python-devel,rpm -qa +rh-python36,rpm -qa gettext-devel,rpm -qa file,rpm -qa libusbx-devel,rpm -qa diff --git a/scripts/eosio_build_ubuntu_deps b/scripts/eosio_build_ubuntu_deps index e9174618e19..bfb6b776148 100644 --- a/scripts/eosio_build_ubuntu_deps +++ b/scripts/eosio_build_ubuntu_deps @@ -9,10 +9,10 @@ graphviz,dpkg -s libgmp3-dev,dpkg -s autotools-dev,dpkg -s libicu-dev,dpkg -s -python3,dpkg -s -python3-dev,dpkg -s python2.7,dpkg -s python2.7-dev,dpkg -s +python3,dpkg -s +python3-dev,dpkg -s autoconf,dpkg -s libtool,dpkg -s curl,dpkg -s From 9558d2e8ca848270e13559abdb82ac2c56cf8935 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Wed, 26 Jun 2019 11:20:04 -0400 Subject: [PATCH 21/22] removed PINNED_BUILD_ESSENTIALS --- scripts/helpers/eosio.sh | 2 +- scripts/helpers/general.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/helpers/eosio.sh b/scripts/helpers/eosio.sh index 5d4b3e1ff60..5f668009fbd 100755 --- a/scripts/helpers/eosio.sh +++ b/scripts/helpers/eosio.sh @@ -146,7 +146,7 @@ function prompt-mongo-install() { } function ensure-compiler() { - # Support build-essentials + # Support build-essentials on ubuntu if [[ $NAME == "CentOS Linux" ]] || [[ $VERSION_ID == "16.04" ]] || ( $PIN_COMPILER && [[ $VERSION_ID == "18.04" ]] ); then export CXX=${CXX:-'g++'} export CC=${CC:-'gcc'} diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index d262429199f..6ab81575b1b 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -182,7 +182,6 @@ function ensure-build-essential() { "" ) echo "What would you like to do?";; 0 | true | [Yy]* ) install-package build-essential - $PIN_COMPILER && export PINNED_BUILD_ESSENTIALS=true echo " - ${COLOR_GREEN}Installed build-essential${COLOR_NC}" break;; 1 | false | [Nn]* ) echo " - User aborted installation of build-essential."; break;; From b79cda07d7de7d5974837c0d07061d678a34b938 Mon Sep 17 00:00:00 2001 From: Nathan Pierce Date: Wed, 26 Jun 2019 13:35:27 -0400 Subject: [PATCH 22/22] quick fixes [skip ci] --- scripts/eosio_build_centos.sh | 2 +- scripts/helpers/general.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index 5e68df2ff28..e037f985106 100755 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -17,7 +17,7 @@ ensure-scl # GCC7 for Centos / Needed for CMAKE install even if we're pinning ensure-devtoolset if [[ -d /opt/rh/devtoolset-7 ]]; then - echo "${COLOR_CYAN}[Enabling Centos devtoolset-7 (for newer GCC)]${COLOR_NC}" + echo "${COLOR_CYAN}[Enabling Centos devtoolset-7 (so we can use GCC 7)]${COLOR_NC}" execute-always source /opt/rh/devtoolset-7/enable echo " - ${COLOR_GREEN}Centos devtoolset-7 successfully enabled!${COLOR_NC}" fi diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index 6ab81575b1b..3f9e64981b3 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -172,7 +172,7 @@ function ensure-devtoolset() { function ensure-build-essential() { if [[ ! $(dpkg -s clang 2>/dev/null) ]]; then # Clang already exists, so no need for build essentials - echo "${COLOR_CYAN}[Ensuring installation of build-essential (needed for installing depedencies; we will remove it after)]${COLOR_NC}" + echo "${COLOR_CYAN}[Ensuring installation of build-essential]${COLOR_NC}" BUILD_ESSENTIAL=$( dpkg -s build-essential | grep 'Package: build-essential' || true ) if [[ -z $BUILD_ESSENTIAL ]]; then while true; do