Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@freelists.org, tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 2/2] build: pass path to toolchain for luajit and curl
Date: Sat, 26 Oct 2019 04:01:59 +0300	[thread overview]
Message-ID: <434bf54dd0197a89680ddf18b3fc95b6f1c5df28.1572050052.git.alexander.turenko@tarantool.org> (raw)
In-Reply-To: <cover.1572050052.git.alexander.turenko@tarantool.org>

This allows to overcome problems when CMake chooses one toolchain to
build tarantool, but a library (libluajit.a or libcurl.a) is built using
another (incompatible) toolchain.

Fixes #4587.
---
 cmake/BuildLibCURL.cmake | 12 ++++++++++++
 cmake/luajit.cmake       | 12 ++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake
index dc1b40750..12062ec8b 100644
--- a/cmake/BuildLibCURL.cmake
+++ b/cmake/BuildLibCURL.cmake
@@ -45,9 +45,21 @@ macro(curl_build)
         CONFIGURE_COMMAND
             cd <SOURCE_DIR> && ./buildconf &&
             cd <BINARY_DIR> && <SOURCE_DIR>/configure
+                # Pass the same toolchain as is used to build
+                # tarantool itself, because they can be
+                # incompatible.
                 CC=${CMAKE_C_COMPILER}
+                LD=${CMAKE_LINKER}
+                AR=${CMAKE_AR}
+                RANLIB=${CMAKE_RANLIB}
+                NM=${CMAKE_NM}
+                STRIP=${CMAKE_STRIP}
+
+                # Pass -isysroot=<SDK_PATH> option on Mac OS, see
+                # above.
                 CPPFLAGS=${LIBCURL_CPPFLAGS}
                 CFLAGS=${LIBCURL_CFLAGS}
+
                 --prefix <INSTALL_DIR>
                 --enable-static
                 --enable-shared
diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake
index eca2bf36b..10df633d5 100644
--- a/cmake/luajit.cmake
+++ b/cmake/luajit.cmake
@@ -223,12 +223,24 @@ macro(luajit_build)
     foreach(def ${defs})
         set(luajit_xcflags ${luajit_xcflags} -D${def})
     endforeach()
+
+    # Pass the same toolchain that is used for building of
+    # tarantool itself, because tools from different toolchains
+    # can be incompatible. A compiler and a linker are already set
+    # above.
+    set (luajit_ld ${CMAKE_LINKER})
+    set (luajit_ar ${CMAKE_AR} rcus)
+    set (luajit_strip ${CMAKE_STRIP})
+
     set (luajit_buildoptions
         BUILDMODE=static
         HOST_CC="${luajit_hostcc}"
         TARGET_CC="${luajit_cc}"
         TARGET_CFLAGS="${luajit_cflags}"
+        TARGET_LD="${luajit_ld}"
         TARGET_LDFLAGS="${luajit_ldflags}"
+        TARGET_AR="${luajit_ar}"
+        TARGET_STRIP="${luajit_strip}"
         TARGET_SYS="${CMAKE_SYSTEM_NAME}"
         CCOPT="${luajit_ccopt}"
         CCDEBUG="${luajit_ccdebug}"
-- 
2.22.0

  parent reply	other threads:[~2019-10-26  1:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26  1:01 [Tarantool-patches] [PATCH v2 0/2] Fix build problems on FreeBSD and Mac OS Alexander Turenko
2019-10-26  1:01 ` [Tarantool-patches] [PATCH v2 1/2] build: fix OpenSSL linking problems on FreeBSD Alexander Turenko
2019-10-26  1:01 ` Alexander Turenko [this message]
2019-10-28  7:16 ` [Tarantool-patches] [PATCH v2 0/2] Fix build problems on FreeBSD and Mac OS 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=434bf54dd0197a89680ddf18b3fc95b6f1c5df28.1572050052.git.alexander.turenko@tarantool.org \
    --to=alexander.turenko@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/2] build: pass path to toolchain for luajit and curl' \
    /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