From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5A38D445320 for ; Wed, 5 Aug 2020 20:08:29 +0300 (MSK) Received: by mail-oi1-f181.google.com with SMTP id l204so11478715oib.3 for ; Wed, 05 Aug 2020 10:08:28 -0700 (PDT) MIME-Version: 1.0 References: <20200622181649.10100-1-huston.mavr@gmail.com> <20200727223734.cnxrdzik2cyt3ey4@tkn_work_nb> In-Reply-To: <20200727223734.cnxrdzik2cyt3ey4@tkn_work_nb> From: Mavr Huston Date: Wed, 5 Aug 2020 20:08:13 +0300 Message-ID: Content-Type: multipart/alternative; boundary="000000000000746bed05ac246bd4" Subject: Re: [Tarantool-patches] [PATCH] build: refactor static build process List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@gmail.com --000000000000746bed05ac246bd4 Content-Type: text/plain; charset="UTF-8" Hi, thanks for the review! libicu installs as ExternalProject_Add too, its missed in commit message; Problem with curses and ncurses was on macOS and linux, because libcurses is an entire copy of libncurses, and tarantool links with system libcurses instead of libncurses installed as tarantool dependency, but module FindCurses.cmkae provides workaround for this problem - CURSES_NEED_NCURSES flag.- to use ncurses instead of curses. (i will fix this part at commit message) About disable-shred flag, used at libcurl building - we want to link only with static libraries, so we prevent creating unused .so. I've renamed static_build_no_deps_* jobs after review to static_build_cmake_* Also about such path tarantool-prefix/* - it's a cmake ExternalProject_Add() default path (i've also added comment at .travis.mk) Useless comments "Init macOS test env" deleted. > if (BUILD_STATIC) > - set(LIBZ_LIB_NAME libz.a) > + find_library(LIBZ_LIBRARY NAMES libz.a) > else() > - set(LIBZ_LIB_NAME z) > + find_library(LIBZ_LIBRARY NAMES z) > endif() > - find_library(LIBZ_LIBRARY NAMES ${LIBZ_LIB_NAME}) Here we simplified code, by deleting useless variable. I've added commentaries to cmake/compiler.cmake about libunwind on macOS and about ignoring flag -static-libstdc++ on macOS I've fixed static-build for using system compiler: gcc/g++ on linux and clang/clang++ on macOS I've refactored IF (NOT APPLE) condition to IF (APPLE) at static-build/CMakeLists.txt I've mentioned macOS dependencies at static-build/README.md xcode-tools and others, also I've added example with CMAKE_TARANTOOL_ARGS. Added commentaries about _EP_INSTALL_DIR at static-build/CMakeLists.txt Also deleted unused use_unix_sockets_iproto = True Also deleted curl-features.test.lua, because after rebase on master it fails, due to missing curl_version_info symbol at tarantool binary. This symbol lost after #807c7fa584f21ee955b2a14623d70f7510a3650d (build: update curl submodule to 7.71.1 version ) After pass the review I'll squash this changes to base commit and update commit message. Here is a diff of changes: ===================================== diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5ec5dd9b9..c9aef3dc7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -534,14 +534,14 @@ static_build: script: - ${GITLAB_MAKE} test_static_build -static_build_no_deps_linux: +static_build_cmake_linux: <<: *docker_test_definition script: - - ${GITLAB_MAKE} test_static_build_no_deps_linux + - ${GITLAB_MAKE} test_static_build_cmake_linux -static_build_no_deps_osx_15: +static_build_cmake_osx_15: stage: test tags: - osx_15 script: - - ${GITLAB_MAKE} test_static_build_no_deps_osx + - ${GITLAB_MAKE} test_static_build_cmake_osx diff --git a/.travis.mk b/.travis.mk index 64862348f..482672429 100644 --- a/.travis.mk +++ b/.travis.mk @@ -149,8 +149,8 @@ test_static_build: deps_debian_static CMAKE_EXTRA_PARAMS=-DBUILD_STATIC=ON make -f .travis.mk test_debian_no_deps # New static build - -test_static_build_no_deps_linux: +# builddir used in this target - is a default build path from cmake ExternalProject_Add() +test_static_build_cmake_linux: cd static-build && cmake . && make -j && ctest -V cd test && /usr/bin/python test-run.py --force \ --builddir ${PWD}/static-build/tarantool-prefix/src/tarantool-build $(TEST_RUN_EXTRA_PARAMS) @@ -218,7 +218,6 @@ INIT_TEST_ENV_OSX=\ rm -rf /tmp/tnt test_osx_no_deps: build_osx - # Init macOS test env ${INIT_TEST_ENV_OSX}; \ cd test && ./test-run.py --vardir /tmp/tnt --force $(TEST_RUN_EXTRA_PARAMS) @@ -233,9 +232,9 @@ base_deps_osx: brew install --force ${STATIC_OSX_PKGS} || brew upgrade ${STATIC_OSX_PKGS} pip install --force-reinstall -r test-run/requirements.txt -test_static_build_no_deps_osx: base_deps_osx +# builddir used in this target - is a default build path from cmake ExternalProject_Add() +test_static_build_cmake_osx: base_deps_osx cd static-build && cmake . && make -j && ctest -V - # Init macOS test env ${INIT_TEST_ENV_OSX}; \ cd test && ./test-run.py --vardir /tmp/tnt \ --builddir ${PWD}/static-build/tarantool-prefix/src/tarantool-build \ diff --git a/cmake/FindReadline.cmake b/cmake/FindReadline.cmake index 8422181d6..afe480679 100644 --- a/cmake/FindReadline.cmake +++ b/cmake/FindReadline.cmake @@ -14,6 +14,14 @@ if(BUILD_STATIC) if (NOT CURSES_INFO_LIBRARY) set(CURSES_INFO_LIBRARY "") endif() + + # From Modules/FindCurses.cmake: + # Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the + # ``find_package(Curses)`` call if NCurses functionality is required. + # This flag is set for linking with required library (installed + # via static-build/CMakeLists.txt). If this variable won't be set + # then tarantool binary links with system library curses which is an + # entire copy of ncurses set(CURSES_NEED_NCURSES TRUE) endif() diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 14f1e1186..db2ae6227 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -131,6 +131,8 @@ set(CMAKE_REQUIRED_INCLUDES "") if(BUILD_STATIC AND NOT TARGET_OS_DARWIN) set(UNWIND_LIB_NAME libunwind.a) else() + # libunwind can't be compiled on macOS. + # But there exists libunwind.dylib as a part of MacOSSDK set(UNWIND_LIB_NAME unwind) endif() find_library(UNWIND_LIBRARY PATH_SUFFIXES system NAMES ${UNWIND_LIB_NAME}) @@ -192,6 +194,9 @@ if (ENABLE_BACKTRACE) find_package_message(UNWIND_LIBRARIES "Found unwind" "${UNWIND_LIBRARIES}") endif() +# On macOS there is no '-static-libstdc++' flag and it's use will +# raise following error: +# error: argument unused during compilation: '-static-libstdc++' if(BUILD_STATIC AND NOT TARGET_OS_DARWIN) # Static linking for c++ routines add_compile_flags("C;CXX" "-static-libstdc++") diff --git a/static-build/CMakeLists.txt b/static-build/CMakeLists.txt index 86582af0a..53ceb609c 100644 --- a/static-build/CMakeLists.txt +++ b/static-build/CMakeLists.txt @@ -9,11 +9,18 @@ set(NCURSES_VERSION 6.2) set(READLINE_VERSION 8.0) set(UNWIND_VERSION 1.3-rc1) -find_program(C_COMPILER gcc) -find_program(CXX_COMPILER g++) +if (APPLE) + find_program(C_COMPILER clang) + find_program(CXX_COMPILER clang++) +else() + find_program(C_COMPILER gcc) + find_program(CXX_COMPILER g++) +endif() set(CMAKE_C_COMPILER ${C_COMPILER}) set(CMAKE_CXX_COMPILER ${CXX_COMPILER}) +# Install all libraries required by tarantool at current build dir + # # OpenSSL # @@ -80,7 +87,18 @@ ExternalProject_Add(readline # # ICONV # -if (NOT APPLE) +if (APPLE) + ExternalProject_Add(iconv + URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz + CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} + /configure + --prefix= + --disable-shared + --enable-static + --with-gnu-ld + STEP_TARGETS download + ) +else() # In linux iconv is embedded into glibc # So we find system header and copy it locally find_path(ICONV_INCLUDE_DIR iconv.h) @@ -101,20 +119,11 @@ if (NOT APPLE) add_custom_target(iconv DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/iconv-prefix/include/iconv.h" ) + # This is a hack for further getting install directory of library + # by ExternalProject_Get_Property set_target_properties(iconv PROPERTIES _EP_INSTALL_DIR ${ICONV_INSTALL_PREFIX} ) -else() - ExternalProject_Add(iconv - URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz - CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} - /configure - --prefix= - --disable-shared - --enable-static - --with-gnu-ld - STEP_TARGETS download - ) endif() # @@ -162,6 +171,8 @@ if (APPLE) endif() add_custom_target(unwind DEPENDS ${UNWIND_DEPENDENCIES}) + # This is a hack for further getting install directory of library + # by ExternalProject_Get_Property set_target_properties(unwind PROPERTIES _EP_INSTALL_DIR ${UNWIND_INSTALL_PREFIX} ) @@ -178,6 +189,8 @@ else() ) endif() +# Get install directories of builded libraries for building +# tarantool with custon CMAKE_PREFIX_PATH foreach(PROJ openssl icu zlib ncurses readline iconv unwind) ExternalProject_Get_Property(${PROJ} install_dir) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}:${install_dir}) @@ -197,16 +210,14 @@ ExternalProject_Add(tarantool -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=FALSE -DOPENSSL_USE_STATIC_LIBS=TRUE - -DCMAKE_BUILD_TYPE=Debug -DBUILD_STATIC=TRUE -DENABLE_DIST=TRUE -DENABLE_BACKTRACE=TRUE - -DPACKAGE:STRING=${PACKAGE_NAME} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${CMAKE_TARANTOOL_ARGS} - BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -j STEP_TARGETS build + BUILD_COMMAND $(MAKE) ) enable_testing() diff --git a/static-build/README.md b/static-build/README.md index 29fe085c3..0019e963f 100644 --- a/static-build/README.md +++ b/static-build/README.md @@ -13,6 +13,24 @@ yum install -y \ python-msgpack python-yaml python-argparse python-six python-gevent ``` +MacOS: + +Before you start please install default Xcode Tools by Apple: + +``` +sudo xcode-select --install +sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer +``` + +Install brew using command from +[Homebrew repository instructions](https://github.com/Homebrew/inst) + +After that run next script: + +```bash + brew install autoconf automake libtool cmake file://$${PWD}/tools/brew_taps/tntpython2.rbs + pip install --force-reinstall -r test-run/requirements.txt +``` ### Usage @@ -21,3 +39,20 @@ cmake . make -j ctest -V ``` + +## Customize your build + +If you want to customise build, you need to set `CMAKE_TARANTOOL_ARGS` variable + +### Usage + +There is three types of `CMAKE_BUILD_TYPE`: +* Debug - default +* Release +* RelWithDebInfo + +And you want to build tarantool with RelWithDebInfo: + +```bash +cmake -DCMAKE_TARANTOOL_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" . +``` diff --git a/static-build/test/static-build/curl-features.test.lua b/static-build/test/static-build/curl-features.test.lua deleted file mode 100755 index 57b1c4306..000000000 --- a/static-build/test/static-build/curl-features.test.lua +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env tarantool - -local tap = require('tap') -local ffi = require('ffi') -ffi.cdef([[ - struct curl_version_info_data { - int age; /* see description below */ - const char *version; /* human readable string */ - unsigned int version_num; /* numeric representation */ - const char *host; /* human readable string */ - int features; /* bitmask, see below */ - char *ssl_version; /* human readable string */ - long ssl_version_num; /* not used, always zero */ - const char *libz_version; /* human readable string */ - const char * const *protocols; /* protocols */ - - /* when 'age' is CURLVERSION_SECOND or higher, the members below exist */ - const char *ares; /* human readable string */ - int ares_num; /* number */ - - /* when 'age' is CURLVERSION_THIRD or higher, the members below exist */ - const char *libidn; /* human readable string */ - - /* when 'age' is CURLVERSION_FOURTH or higher (>= 7.16.1), the members - below exist */ - int iconv_ver_num; /* '_libiconv_version' if iconv support enabled */ - - const char *libssh_version; /* human readable string */ - - /* when 'age' is CURLVERSION_FIFTH or higher (>= 7.57.0), the members - below exist */ - unsigned int brotli_ver_num; /* Numeric Brotli version - (MAJOR << 24) | (MINOR << 12) | PATCH */ - const char *brotli_version; /* human readable string. */ - - /* when 'age' is CURLVERSION_SIXTH or higher (>= 7.66.0), the members - below exist */ - unsigned int nghttp2_ver_num; /* Numeric nghttp2 version - (MAJOR << 16) | (MINOR << 8) | PATCH */ - const char *nghttp2_version; /* human readable string. */ - - const char *quic_version; /* human readable quic (+ HTTP/3) library + - version or NULL */ - - /* when 'age' is CURLVERSION_SEVENTH or higher (>= 7.70.0), the members - below exist */ - const char *cainfo; /* the built-in default CURLOPT_CAINFO, might - be NULL */ - const char *capath; /* the built-in default CURLOPT_CAPATH, might - be NULL */ - }; - - struct curl_version_info_data *curl_version_info(int age); -]]) - -local info = ffi.C.curl_version_info(7) -local test = tap.test('curl-features') -test:plan(2) - -if test:ok(info.ssl_version ~= nil, 'Curl built with SSL support') then - test:diag('ssl_version: ' .. ffi.string(info.ssl_version)) -end -if test:ok(info.libz_version ~= nil, 'Curl built with LIBZ') then - test:diag('libz_version: ' .. ffi.string(info.libz_version)) -end - -os.exit(test:check() and 0 or 1) diff --git a/static-build/test/static-build/suite.ini b/static-build/test/static-build/suite.ini index 4da3d5d2f..92e349466 100644 --- a/static-build/test/static-build/suite.ini +++ b/static-build/test/static-build/suite.ini @@ -3,4 +3,3 @@ core = app description = Static build tests script = box.lua is_parallel = True -use_unix_sockets_iproto = True --000000000000746bed05ac246bd4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi, thanks for the review!

libicu installs as Exter= nalProject_Add too, its missed in commit message;

Problem with curse= s and ncurses was on macOS and linux, because libcurses
is an entire cop= y of libncurses, and tarantool links with system
libcurses instead of li= bncurses installed as tarantool dependency, but
module FindCurses.cmkae = provides workaround for this problem -
CURSES_NEED_NCURSES flag.- to use= ncurses instead of curses. (i will fix
this part at commit message)
=
About disable-shred flag, used at libcurl building - we want to link on= ly with
static libraries, so we prevent creating unused .so.

I= 9;ve renamed static_build_no_deps_* jobs after review to static_build_cmake= _*

Also about such path tarantool-prefix/* - it's a cmake Extern= alProject_Add()
default path (i've also added comment at .travis.mk)

Useless comments "Init macOS = test env" deleted.

> =C2=A0 =C2=A0 =C2=A0if (BUILD_STATIC)> - =C2=A0 =C2=A0 =C2=A0 =C2=A0set(LIBZ_LIB_NAME libz.a)
> + =C2= =A0 =C2=A0 =C2=A0 =C2=A0find_library(LIBZ_LIBRARY NAMES libz.a)
> =C2= =A0 =C2=A0 =C2=A0else()
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0set(LIBZ_LIB_N= AME z)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0find_library(LIBZ_LIBRARY NAMES= z)
> =C2=A0 =C2=A0 =C2=A0endif()
> - =C2=A0 =C2=A0find_library= (LIBZ_LIBRARY NAMES ${LIBZ_LIB_NAME})
Here we simplified code, by deleti= ng useless variable.

I've added commentaries to cmake/compiler.c= make about libunwind on macOS
and about ignoring flag -static-libstdc++ = on macOS

I've fixed static-build for using system compiler: =C2= =A0gcc/g++ on linux
and clang/clang++ on macOS

I've refactor= ed IF (NOT APPLE) condition to IF (APPLE) at
static-build/CMakeLists.txt=

I've mentioned macOS dependencies at static-build/README.md xco= de-tools and
others, also I've added example with CMAKE_TARANTOOL_AR= GS.

Added commentaries about _EP_INSTALL_DIR at static-build/CMakeLi= sts.txt

Also deleted unused use_unix_sockets_iproto =3D True

= Also deleted curl-features.test.lua, because after rebase on master it fail= s,
due to missing curl_version_info symbol at tarantool binary. This sym= bol lost
after #807c7fa584f21ee955b2a14623d70f7510a3650d (build: update = curl submodule
to 7.71.1 version )


After pass the review I= 9;ll squash this changes to base commit and update commit
message.
Here is a diff of changes:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5ec5dd9b9..c9aef3dc= 7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -534,14 +534= ,14 @@ static_build:
=C2=A0 =C2=A0script:
=C2=A0 =C2=A0 =C2=A0- ${GIT= LAB_MAKE} test_static_build
=C2=A0
-static_build_no_deps_linux:
+s= tatic_build_cmake_linux:
=C2=A0 =C2=A0<<: *docker_test_definition<= br>=C2=A0 =C2=A0script:
- =C2=A0 =C2=A0- ${GITLAB_MAKE} test_static_buil= d_no_deps_linux
+ =C2=A0 =C2=A0- ${GITLAB_MAKE} test_static_build_cmake_= linux
=C2=A0
-static_build_no_deps_osx_15:
+static_build_cmake_osx= _15:
=C2=A0 =C2=A0stage: test
=C2=A0 =C2=A0tags:
=C2=A0 =C2=A0 =C2= =A0- osx_15
=C2=A0 =C2=A0script:
- =C2=A0 =C2=A0- ${GITLAB_MAKE} test= _static_build_no_deps_osx
+ =C2=A0 =C2=A0- ${GITLAB_MAKE} test_static_bu= ild_cmake_osx
diff --git a/.travis.mk b= /.travis.mk
index 64862348f..482672429 = 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -149,8 +149,8 @@ test_static_bu= ild: deps_debian_static
=C2=A0 CMAKE_EXTRA_PARAMS=3D-DBUILD_STATIC=3DON = make -f .travis.mk test_debian_no_deps
= =C2=A0
=C2=A0# New static build
-
-test_static_build_no_deps_linux= :
+# builddir used in this target - is a default build path from cmake E= xternalProject_Add()
+test_static_build_cmake_linux:
=C2=A0 cd static= -build && cmake . && make -j && ctest -V
=C2=A0 = cd test && /usr/bin/python test-run.py --force \
=C2=A0 --build= dir ${PWD}/static-build/tarantool-prefix/src/tarantool-build $(TEST_RUN_EXT= RA_PARAMS)
@@ -218,7 +218,6 @@ INIT_TEST_ENV_OSX=3D\
=C2=A0 rm -rf /= tmp/tnt
=C2=A0
=C2=A0test_osx_no_deps: build_osx
- # Init macOS te= st env
=C2=A0 ${INIT_TEST_ENV_OSX}; \
=C2=A0 cd test && ./tes= t-run.py --vardir /tmp/tnt --force $(TEST_RUN_EXTRA_PARAMS)
=C2=A0
@@= -233,9 +232,9 @@ base_deps_osx:
=C2=A0 brew install --force ${STATIC_OS= X_PKGS} || brew upgrade ${STATIC_OSX_PKGS}
=C2=A0 pip install --force-re= install -r test-run/requirements.txt
=C2=A0
-test_static_build_no_dep= s_osx: base_deps_osx
+# builddir used in this target - is a default buil= d path from cmake ExternalProject_Add()
+test_static_build_cmake_osx: ba= se_deps_osx
=C2=A0 cd static-build && cmake . && make -j= && ctest -V
- # Init macOS test env
=C2=A0 ${INIT_TEST_ENV_O= SX}; \
=C2=A0 cd test && ./test-run.py --vardir /tmp/tnt \
= =C2=A0 --builddir ${PWD}/static-build/tarantool-prefix/src/tarantool-build= \
diff --git a/cmake/FindReadline.cmake b/cmake/FindReadline.cmake
i= ndex 8422181d6..afe480679 100644
--- a/cmake/FindReadline.cmake
+++ b= /cmake/FindReadline.cmake
@@ -14,6 +14,14 @@ if(BUILD_STATIC)
=C2=A0 = =C2=A0 =C2=A0if (NOT CURSES_INFO_LIBRARY)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0set(CURSES_INFO_LIBRARY "")
=C2=A0 =C2=A0 =C2=A0endif()<= br>+
+ =C2=A0 =C2=A0# From Modules/FindCurses.cmake:
+ =C2=A0 =C2=A0#= Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the
+ =C2=A0 =C2=A0# ``f= ind_package(Curses)`` call if NCurses functionality is required.
+ =C2= =A0 =C2=A0# This flag is set for linking with required library (installed+ =C2=A0 =C2=A0# via static-build/CMakeLists.txt). If this variable won&#= 39;t be set
+ =C2=A0 =C2=A0# then tarantool binary links with system lib= rary curses which is an
+ =C2=A0 =C2=A0# entire copy of ncurses
=C2= =A0 =C2=A0 =C2=A0set(CURSES_NEED_NCURSES TRUE)
=C2=A0endif()
=C2=A0diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index 14f1e11= 86..db2ae6227 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.= cmake
@@ -131,6 +131,8 @@ set(CMAKE_REQUIRED_INCLUDES "")
= =C2=A0if(BUILD_STATIC AND NOT TARGET_OS_DARWIN)
=C2=A0 =C2=A0 =C2=A0set(= UNWIND_LIB_NAME libunwind.a)
=C2=A0else()
+ =C2=A0 =C2=A0# libunwind = can't be compiled on macOS.
+ =C2=A0 =C2=A0# But there exists libunw= ind.dylib as a part of MacOSSDK
=C2=A0 =C2=A0 =C2=A0set(UNWIND_LIB_NAME = unwind)
=C2=A0endif()
=C2=A0find_library(UNWIND_LIBRARY PATH_SUFFIXES= system NAMES ${UNWIND_LIB_NAME})
@@ -192,6 +194,9 @@ if (ENABLE_BACKTRA= CE)
=C2=A0 =C2=A0 =C2=A0find_package_message(UNWIND_LIBRARIES "Foun= d unwind" "${UNWIND_LIBRARIES}")
=C2=A0endif()
=C2=A0<= br>+# On macOS there is no '-static-libstdc++' flag and it's us= e will
+# raise following error:
+# error: argument unused during com= pilation: '-static-libstdc++'
=C2=A0if(BUILD_STATIC AND NOT TARG= ET_OS_DARWIN)
=C2=A0 =C2=A0 =C2=A0# Static linking for c++ routines
= =C2=A0 =C2=A0 =C2=A0add_compile_flags("C;CXX" "-static-libst= dc++")
diff --git a/static-build/CMakeLists.txt b/static-build/CMak= eLists.txt
index 86582af0a..53ceb609c 100644
--- a/static-build/CMake= Lists.txt
+++ b/static-build/CMakeLists.txt
@@ -9,11 +9,18 @@ set(NCU= RSES_VERSION 6.2)
=C2=A0set(READLINE_VERSION 8.0)
=C2=A0set(UNWIND_VE= RSION 1.3-rc1)
=C2=A0
-find_program(C_COMPILER gcc)
-find_program(= CXX_COMPILER g++)
+if (APPLE)
+ =C2=A0 =C2=A0find_program(C_COMPILER = clang)
+ =C2=A0 =C2=A0find_program(CXX_COMPILER clang++)
+else()
+= =C2=A0 =C2=A0find_program(C_COMPILER gcc)
+ =C2=A0 =C2=A0find_program(C= XX_COMPILER g++)
+endif()
=C2=A0set(CMAKE_C_COMPILER ${C_COMPILER})=C2=A0set(CMAKE_CXX_COMPILER ${CXX_COMPILER})
=C2=A0
+# Install all= libraries required by tarantool at current build dir
+
=C2=A0#
= =C2=A0# OpenSSL
=C2=A0#
@@ -80,7 +87,18 @@ ExternalProject_Add(readli= ne
=C2=A0#
=C2=A0# ICONV
=C2=A0#
-if (NOT APPLE)
+if (APPLE)=
+ =C2=A0 =C2=A0ExternalProject_Add(iconv
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
+ =C2=A0= =C2=A0 =C2=A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
+ =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<SOURCE_DIR>/configure
+ =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--prefix=3D<INSTALL_DIR>
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--disable-shared
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0--enable-static
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0--with-gnu-ld
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0STEP_TARGETS do= wnload
+ =C2=A0 =C2=A0)
+else()
=C2=A0 =C2=A0 =C2=A0# In linux ico= nv is embedded into glibc
=C2=A0 =C2=A0 =C2=A0# So we find system header= and copy it locally
=C2=A0 =C2=A0 =C2=A0find_path(ICONV_INCLUDE_DIR ico= nv.h)
@@ -101,20 +119,11 @@ if (NOT APPLE)
=C2=A0 =C2=A0 =C2=A0add_cu= stom_target(iconv
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DEPENDS "${CMAK= E_CURRENT_BINARY_DIR}/iconv-prefix/include/iconv.h"
=C2=A0 =C2=A0 = =C2=A0)
+ =C2=A0 =C2=A0# This is a hack for further getting install dire= ctory of library
+ =C2=A0 =C2=A0# by ExternalProject_Get_Property
=C2= =A0 =C2=A0 =C2=A0set_target_properties(iconv
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0PROPERTIES _EP_INSTALL_DIR ${ICONV_INSTALL_PREFIX}
=C2=A0 =C2=A0 = =C2=A0)
-else()
- =C2=A0 =C2=A0ExternalProject_Add(iconv
- =C2=A0 = =C2=A0 =C2=A0 =C2=A0URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.g= z
- =C2=A0 =C2=A0 =C2=A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMP= ILER}
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<SOURCE_DIR>/conf= igure
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--prefix=3D<INSTALL_= DIR>
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--disable-shared
-= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--enable-static
- =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--with-gnu-ld
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0STEP_TARGETS download
- =C2=A0 =C2=A0)
=C2=A0endif()
=C2=A0
= =C2=A0#
@@ -162,6 +171,8 @@ if (APPLE)
=C2=A0 =C2=A0 =C2=A0endif()=C2=A0
=C2=A0 =C2=A0 =C2=A0add_custom_target(unwind DEPENDS ${UNWIND_DE= PENDENCIES})
+ =C2=A0 =C2=A0# This is a hack for further getting install= directory of library
+ =C2=A0 =C2=A0# by ExternalProject_Get_Property=C2=A0 =C2=A0 =C2=A0set_target_properties(unwind
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0PROPERTIES _EP_INSTALL_DIR ${UNWIND_INSTALL_PREFIX}
=C2=A0 = =C2=A0 =C2=A0)
@@ -178,6 +189,8 @@ else()
=C2=A0 =C2=A0 =C2=A0)
= =C2=A0endif()
=C2=A0
+# Get install directories of builded libraries = for building
+# tarantool with custon CMAKE_PREFIX_PATH
=C2=A0foreach= (PROJ openssl icu zlib ncurses readline iconv unwind)
=C2=A0 =C2=A0 =C2= =A0ExternalProject_Get_Property(${PROJ} install_dir)
=C2=A0 =C2=A0 =C2= =A0set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}:${install_dir})
@@ -197,16= +210,14 @@ ExternalProject_Add(tarantool
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0-DCMAKE_PREFIX_PATH=3D${CMAKE_PREFIX_PATH}
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0-DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=3DFALSE
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0-DOPENSSL_USE_STATIC_LIBS=3DTRUE
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0-DCMAKE_BUILD_TYPE=3DDebug
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-= DBUILD_STATIC=3DTRUE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DENABLE_DIST=3DT= RUE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-DENABLE_BACKTRACE=3DTRUE
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0-DPACKAGE:STRING=3D${PACKAGE_NAME}
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0-DCMAKE_C_COMPILER=3D${CMAKE_C_COMPILER}
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0-DCMAKE_CXX_COMPILER=3D${CMAKE_CXX_COMPILER}
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0${CMAKE_TARANTOOL_ARGS}
- =C2=A0 =C2=A0BU= ILD_COMMAND ${CMAKE_MAKE_PROGRAM} -j
=C2=A0 =C2=A0 =C2=A0STEP_TARGETS bu= ild
+ =C2=A0 =C2=A0BUILD_COMMAND $(MAKE)
=C2=A0)
=C2=A0
=C2=A0e= nable_testing()
diff --git a/static-build/README.md b/static-build/READM= E.md
index 29fe085c3..0019e963f 100644
--- a/static-build/README.md+++ b/static-build/README.md
@@ -13,6 +13,24 @@ yum install -y \
= =C2=A0 =C2=A0 =C2=A0python-msgpack python-yaml python-argparse python-six p= ython-gevent
=C2=A0```
=C2=A0
+MacOS:
+
+Before you start pl= ease install default Xcode Tools by Apple:
+
+```
+sudo xcode-sele= ct --install
+sudo xcode-select -switch /Applications/Xcode.app/Contents= /Developer
+```
+
+Install brew using command from
+[Homebrew r= epository instructions](https:= //github.com/Homebrew/inst)
+
+After that run next script:
++```bash
+ =C2=A0brew install autoconf automake libtool cmake file://$= ${PWD}/tools/brew_taps/tntpython2.rbs
+ =C2=A0pip install --force-reinst= all -r test-run/requirements.txt
+```
=C2=A0
=C2=A0### Usage
= =C2=A0
@@ -21,3 +39,20 @@ cmake .
=C2=A0make -j
=C2=A0ctest -V
= =C2=A0```
+
+## Customize your build
+
+If you want to customis= e build, you need to set `CMAKE_TARANTOOL_ARGS` variable
+
+### Usage=
+
+There is three types of `CMAKE_BUILD_TYPE`:
+* Debug - default=
+* Release
+* RelWithDebInfo
+
+And you want to build tarantoo= l with RelWithDebInfo:
+
+```bash
+cmake -DCMAKE_TARANTOOL_ARGS=3D= "-DCMAKE_BUILD_TYPE=3DRelWithDebInfo" .
+```
diff --git a/s= tatic-build/test/static-build/curl-features.test.lua b/static-build/test/st= atic-build/curl-features.test.lua
deleted file mode 100755
index 57b1= c4306..000000000
--- a/static-build/test/static-build/curl-features.test= .lua
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env tarantool
-=
-local tap =3D require('tap')
-local ffi =3D require('ff= i')
-ffi.cdef([[
- =C2=A0 =C2=A0struct curl_version_info_data {- =C2=A0 =C2=A0 =C2=A0 =C2=A0int age; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0/* see description below */
- =C2=A0 =C2=A0 = =C2=A0 =C2=A0const char *version; =C2=A0 =C2=A0 =C2=A0/* human readable str= ing */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int version_num; /* numeric= representation */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char *host; =C2=A0= =C2=A0 =C2=A0 =C2=A0 /* human readable string */
- =C2=A0 =C2=A0 =C2=A0= =C2=A0int features; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* bitmask, = see below */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0char *ssl_version; =C2=A0 =C2= =A0 =C2=A0 =C2=A0/* human readable string */
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0long ssl_version_num; =C2=A0 =C2=A0 /* not used, always zero */
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0const char *libz_version; /* human readable string = */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char * const *protocols; /* protoc= ols */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when 'age' is CURLVE= RSION_SECOND or higher, the members below exist */
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0const char *ares; =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* human readable s= tring */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0int ares_num; =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 /* number */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0/* = when 'age' is CURLVERSION_THIRD or higher, the members below exist = */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char *libidn; =C2=A0 =C2=A0 =C2=A0= /* human readable string */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when &= #39;age' is CURLVERSION_FOURTH or higher (>=3D 7.16.1), the members<= br>- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 below exist */
- =C2=A0 =C2=A0 = =C2=A0 =C2=A0int iconv_ver_num; =C2=A0 =C2=A0 =C2=A0 /* '_libiconv_vers= ion' if iconv support enabled */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0c= onst char *libssh_version; /* human readable string */
-
- =C2=A0 =C2= =A0 =C2=A0 =C2=A0/* when 'age' is CURLVERSION_FIFTH or higher (>= =3D 7.57.0), the members
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 below exis= t */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int brotli_ver_num; /* Numeri= c Brotli version
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(MAJOR << 24) | (MINOR << 12) | PATCH */
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0const char *brotli_version; /* human readable strin= g. */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when 'age' is CURLVER= SION_SIXTH or higher (>=3D 7.66.0), the members
- =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 below exist */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned i= nt nghttp2_ver_num; /* Numeric nghttp2 version
- =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (MAJOR << 16) | (MINOR = << 8) | PATCH */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const char *nghttp2_= version; /* human readable string. */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0= const char *quic_version; =C2=A0 =C2=A0/* human readable quic (+ HTTP/3) li= brary +
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0version or NULL */
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0/* when 'age= ' is CURLVERSION_SEVENTH or higher (>=3D 7.70.0), the members
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 below exist */
- =C2=A0 =C2=A0 =C2=A0= =C2=A0const char *cainfo; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* the built-i= n default CURLOPT_CAINFO, might
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0be NULL */
- =C2=A0 =C2=A0 =C2=A0 =C2=A0const= char *capath; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* the built-in default CU= RLOPT_CAPATH, might
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0be NULL */
- =C2=A0 =C2=A0};
-
- =C2=A0 =C2=A0str= uct curl_version_info_data *curl_version_info(int age);
-]])
-
-lo= cal info =3D ffi.C.curl_version_info(7)
-local test =3D tap.test('cu= rl-features')
-test:plan(2)
-
-if test:ok(info.ssl_version ~= =3D nil, 'Curl built with SSL support') then
- =C2=A0 =C2=A0test= :diag('ssl_version: ' .. ffi.string(info.ssl_version))
-end
-= if test:ok(info.libz_version ~=3D nil, 'Curl built with LIBZ') then=
- =C2=A0 =C2=A0test:diag('libz_version: ' .. ffi.string(info.li= bz_version))
-end
-
-os.exit(test:check() and 0 or 1)
diff --gi= t a/static-build/test/static-build/suite.ini b/static-build/test/static-bui= ld/suite.ini
index 4da3d5d2f..92e349466 100644
--- a/static-build/tes= t/static-build/suite.ini
+++ b/static-build/test/static-build/suite.ini<= br>@@ -3,4 +3,3 @@ core =3D app
=C2=A0description =3D Static build tests=
=C2=A0script =3D box.lua
=C2=A0is_parallel =3D True
-use_unix_soc= kets_iproto =3D True
--000000000000746bed05ac246bd4--