From e77f18bebc2ec08d0b83d623339a8d00c294895d Mon Sep 17 00:00:00 2001 From: Teon Banek Date: Tue, 20 Mar 2018 11:12:20 +0100 Subject: [PATCH] Statically link libgcc and libstdc++ Summary: This should allow us to distributed Memgraph executables on machines which have different versions of libstdc++. Reviewers: mferencevic, buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1307 --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 917691dc0..95742733e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall \ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer") +# Statically link libgcc and libstdc++, the GCC allows this according to: +# https://www.gnu.org/licenses/gcc-exception-faq.html +# Last checked for gcc-7.3, we are using gcc-6.3 on build machines (license is +# valid there also). +# ** If we change versions, recheck this! ** +# ** Static linking is allowed only for executables! ** +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") + # Use gold linker to speedup build set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")