Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Yukhin <kyukhin@tarantool.org>
To: alexander.turenko@tarantool.org
Cc: tarantool-patches@freelists.org, Kirill Yukhin <kyukhin@tarantool.org>
Subject: [tarantool-patches] [PATCH] Fix libgomp linking for static build
Date: Fri,  7 Sep 2018 10:30:16 +0300	[thread overview]
Message-ID: <b119974d7b43883e625be87bc5a97bed29e7c013.1536305427.git.kyukhin@tarantool.org> (raw)
In-Reply-To: <20180906175907.dom562rutbpalfnl@tarantool.org>

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

  reply	other threads:[~2018-09-07  7:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29  6:08 [tarantool-patches] [PATCH v4] Tarantool static build ability Georgy Kirichenko
2018-08-29 11:19 ` [tarantool-patches] " Alexander Turenko
2018-08-29 11:22 ` Alexander Turenko
2018-09-06 17:59 ` Kirill Yukhin
2018-09-07  7:30   ` Kirill Yukhin [this message]
2018-09-07  9:06     ` [tarantool-patches] Re: [PATCH] Fix libgomp linking for static build Kirill Yukhin
2018-09-07  9:17   ` [tarantool-patches] " Kirill Yukhin
2018-09-07 17:10     ` [tarantool-patches] " Alexander Turenko
2018-09-10  7:05     ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b119974d7b43883e625be87bc5a97bed29e7c013.1536305427.git.kyukhin@tarantool.org \
    --to=kyukhin@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH] Fix libgomp linking for static build' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox