From aba3f0d788e1f512a79a682e4d2f8d7261f718c9 Mon Sep 17 00:00:00 2001 From: Rajat Singhal Date: Fri, 3 Apr 2020 09:04:01 +0530 Subject: [PATCH 1/4] [build/gcc] Upgrade min GCC version to 8.0.0 --- build.sh | 6 +++--- setup.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 4850d09dc8..62e290ae54 100755 --- a/build.sh +++ b/build.sh @@ -7,7 +7,7 @@ pushd "$SCRIPT_DIR" >/dev/null set -e set -x -MIN_GCC_VERSION=6.0.0 +MIN_GCC_VERSION=8.0.0 gccBuild=false function version_less_than_equal_to() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$1"; } @@ -55,8 +55,8 @@ if $gccBuild; then fi if version_less_than_equal_to $gcc_ver $MIN_GCC_VERSION; then - export CC="gcc-6" - export CXX="g++-6" + export CC="gcc-8" + export CXX="g++-8" else export CC="gcc" export CXX="g++" diff --git a/setup.sh b/setup.sh index 5d05a5998a..13383d5e3b 100755 --- a/setup.sh +++ b/setup.sh @@ -7,7 +7,7 @@ pushd "$SCRIPT_DIR" >/dev/null downloadHighPolySuv=true gccBuild=false MIN_CMAKE_VERSION=3.10.0 -MIN_GCC_VERSION=6.0.0 +MIN_GCC_VERSION=8.0.0 function version_less_than_equal_to() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$1"; } # Parse command line arguments @@ -39,11 +39,11 @@ if $gccBuild; then if version_less_than_equal_to $gcc_ver $MIN_GCC_VERSION; then if [ "$(uname)" == "Darwin" ]; then # osx brew update - brew install gcc-6 g++-6 + brew install gcc-8 g++-8 else sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get -y update - sudo apt-get install -y gcc-6 g++-6 + sudo apt-get install -y gcc-8 g++-8 fi else echo "Already have good version of gcc: $gcc_ver" From a53a43e666da9fbb63ad47fc7fb2fff270c05d98 Mon Sep 17 00:00:00 2001 From: Rajat Singhal Date: Fri, 3 Apr 2020 09:04:40 +0530 Subject: [PATCH 2/4] [build/gcc/cmake] Use libc++ for Clang only --- cmake/cmake-modules/CommonSetup.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/cmake-modules/CommonSetup.cmake b/cmake/cmake-modules/CommonSetup.cmake index c2c924c260..3a3916715e 100644 --- a/cmake/cmake-modules/CommonSetup.cmake +++ b/cmake/cmake-modules/CommonSetup.cmake @@ -55,7 +55,7 @@ macro(CommonSetup) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__CLANG__") else () set(CMAKE_CXX_FLAGS "\ - -std=c++17 -stdlib=libc++ -ggdb -Wall -Wextra -Wstrict-aliasing -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy \ + -std=c++17 -ggdb -Wall -Wextra -Wstrict-aliasing -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy \ -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default \ -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef \ -Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused -Wno-documentation -fdiagnostics-show-option \ @@ -63,6 +63,8 @@ macro(CommonSetup) ${RPC_LIB_DEFINES} ${CMAKE_CXX_FLAGS}") if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + # libc++ is a Clang-only option + set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") set(CXX_EXP_LIB "-lc++fs -ferror-limit=10") else() set(CXX_EXP_LIB "-lstdc++fs -fmax-errors=10 -Wnoexcept -Wstrict-null-sentinel") From 1383fbf421cae72ac5b0460f4bfbeb8c82ab2949 Mon Sep 17 00:00:00 2001 From: Rajat Singhal Date: Fri, 3 Apr 2020 09:05:18 +0530 Subject: [PATCH 3/4] [build] Add build_gcc_debug to clean.sh --- clean.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clean.sh b/clean.sh index 136d670e68..42713ba829 100755 --- a/clean.sh +++ b/clean.sh @@ -8,7 +8,7 @@ set -e set +x rm -rf build_debug -rm -rf build_release +rm -rf build_gcc_debug rm -rf cmake/output -popd >/dev/null \ No newline at end of file +popd >/dev/null From 04b068bbb40821c39a66abcf7bf4fcd17b925b83 Mon Sep 17 00:00:00 2001 From: madratman Date: Fri, 3 Apr 2020 00:58:03 -0700 Subject: [PATCH 4/4] [linux/build/gcc] apt install gcc multilib (for bits/c++config.hpp), add apt installed libcxx includes and links --- cmake/cmake-modules/CommonSetup.cmake | 7 +++++-- setup.sh | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/cmake-modules/CommonSetup.cmake b/cmake/cmake-modules/CommonSetup.cmake index 3a3916715e..ef48dc3fb4 100644 --- a/cmake/cmake-modules/CommonSetup.cmake +++ b/cmake/cmake-modules/CommonSetup.cmake @@ -66,8 +66,11 @@ macro(CommonSetup) # libc++ is a Clang-only option set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") set(CXX_EXP_LIB "-lc++fs -ferror-limit=10") - else() - set(CXX_EXP_LIB "-lstdc++fs -fmax-errors=10 -Wnoexcept -Wstrict-null-sentinel") + else() # gcc + set(CXX_EXP_LIB "-nostdinc++ -I/usr/include/c++/8 -I/usr/include/x86_64-linux-gnu/c++/8 -nodefaultlibs + -l/usr/lib/x86_64-linux-gnu/libc++.so -l/usr/lib/x86_64-linux-gnu/libc++abi.so + -lm -lc -lgcc_s -lgcc + -lstdc++fs -fmax-errors=10 -Wnoexcept -Wstrict-null-sentinel") endif () endif () diff --git a/setup.sh b/setup.sh index 13383d5e3b..8f2b65ca3d 100755 --- a/setup.sh +++ b/setup.sh @@ -43,7 +43,7 @@ if $gccBuild; then else sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get -y update - sudo apt-get install -y gcc-8 g++-8 + sudo apt-get install -y gcc-8 g++-8 gcc-8-multilib g++-8-multilib fi else echo "Already have good version of gcc: $gcc_ver"