From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 178792B06B for ; Fri, 7 Sep 2018 03:32:26 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ly0R6rEGKvKw for ; Fri, 7 Sep 2018 03:32:26 -0400 (EDT) Received: from smtp14.mail.ru (smtp14.mail.ru [94.100.181.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 5F87E2B069 for ; Fri, 7 Sep 2018 03:32:25 -0400 (EDT) From: Kirill Yukhin Subject: [tarantool-patches] [PATCH] Fix libgomp linking for static build Date: Fri, 7 Sep 2018 10:30:16 +0300 Message-Id: In-Reply-To: <20180906175907.dom562rutbpalfnl@tarantool.org> References: <20180906175907.dom562rutbpalfnl@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: alexander.turenko@tarantool.org Cc: tarantool-patches@freelists.org, Kirill Yukhin Since addition of -fopenmp to compiler also means addition of -lgomp to the link stage, pass -fno-openmp to the linking stage in case of static build. In that case OMP functions are statically linked into libmisc. --- cmake/compiler.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index b3a0702..1c15616 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -282,9 +282,13 @@ endmacro(enable_tnt_compile_flags) if (HAVE_OPENMP) add_compile_flags("C;CXX" "-fopenmp") + if (BUILD_STATIC) + # libgomp was already linked into libmisc. Avoid linking + # against DSO version of libgomp. + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-openmp") + endif() endif() - if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCC) set(HAVE_BUILTIN_CTZ 1) set(HAVE_BUILTIN_CTZLL 1) -- 2.16.2