From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) (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 09BFD469719 for ; Wed, 9 Sep 2020 17:49:47 +0300 (MSK) Received: by mail-ot1-f65.google.com with SMTP id n61so2485177ota.10 for ; Wed, 09 Sep 2020 07:49:47 -0700 (PDT) MIME-Version: 1.0 References: <20200825140108.52090-1-huston.mavr@gmail.com> <20200904174143.GF18920@tarantool.org> In-Reply-To: <20200904174143.GF18920@tarantool.org> From: Alexandr Barulev Date: Wed, 9 Sep 2020 17:49:33 +0300 Message-ID: Content-Type: multipart/alternative; boundary="000000000000fff37005aee28fc7" Subject: Re: [Tarantool-patches] [PATCH v2] build: refactor static build process List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Munkin Cc: Alexander Turenko , tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@gmail.com --000000000000fff37005aee28fc7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, thank you for the review! Here are required fixes: 1. Fixed typos at commit message, here is a new: build: refactor static build process Refactored static build process to use static-build/CMakeLists.txt instead of Dockerfile.staticbuild (this allows to support static build on macOS). Following third-party dependencies for static build are installed via cmake `ExternalProject_Add`: - OpenSSL - Zlib - Ncurses - Readline - Unwind - ICU * Added support static build for macOS * Fixed `CONFIGURE_COMMAND` while building bundled libcurl for static build at file cmake/BuildLibCURL.cmake: - disable building shared libcurl libraries (by setting `--disable-shared` option) - disable hiding libcurl symbols (by setting `--disable-symbol-hiding` option) - prevent linking libcurl with system libz (by setting `--with-zlib=3D${FOUND_ZLIB_ROOT_DIR}` option) * Removed Dockerfile.staticbuild * Added new gitlab.ci jobs to test new style static build: - static_build_cmake_linux - static_build_cmake_osx_15 * Removed static_docker_build gitlab.ci job Closes #5095 2. Fixed commentaries at .travis.mk 3. Fixed finding libz library at cmake/BuildLibCurl.cmake as at master branch 4. Instead of using static-build/.gitignore use the root .gitignore file 5. Refactored static-build/CMakeLists.txt: * Project name is set to tarantool-static * Instead of explicitly finding of c/c++ compilers current version uses cmake `project(tarantool-static C CXX)` command. This change requires to manually set CFLAGS/CPPFLAGS/LDFLAGS for all static-build dependencies (because building dependencies at macOS requires path to macOS SDK) the idea was taken from cmake/BuildLibCurl.cmake * Added commentaries about problem with libicu * Removed unused TEST_COMMAND at ExternalProject_Add(zlib ...) also removed unnecessary # STEP_TARGETS at ExternalProject_Add(readline ...) * Deleted doubled whitespaces 6. Fixed static-build/README.md: * Added list of required tools * Added example for ubuntu/debian * Fixed indentation and typos 7. Refactored tests: * Got rid of test-run * Deleted whitespaces at exports.test.lua * Fixed defining of RTLD_DEFAULT Here is a diff: diff --git a/.gitignore b/.gitignore index a42c7db35..c6e261e18 100644 --- a/.gitignore +++ b/.gitignore @@ -151,3 +151,11 @@ src/box/sql/parse.h src/box/sql/parse.c src/box/sql/opcodes.h src/box/sql/opcodes.c + +# static-build +static-build/*-prefix +static-build/Makefile +static-build/build + +# macOS files +.DS_Store diff --git a/.travis.mk b/.travis.mk index ccd9d6db1..58d0c1596 100644 --- a/.travis.mk +++ b/.travis.mk @@ -149,7 +149,8 @@ test_static_build: deps_debian_static CMAKE_EXTRA_PARAMS=3D-DBUILD_STATIC=3DON make -f .travis.mk test_debian_no_deps # New static build -# builddir used in this target - is a default build path from cmake ExternalProject_Add() +# builddir used in this target - is a default build path from cmake +# ExternalProject_Add() test_static_build_cmake_linux: cd static-build && cmake -DCMAKE_TARANTOOL_ARGS=3D"-DCMAKE_BUILD_TYPE=3DRelWithDebInfo;-DENABLE_WERR= OR=3DON" . && \ make -j && ctest -V @@ -233,7 +234,8 @@ base_deps_osx: brew install --force ${STATIC_OSX_PKGS} || brew upgrade ${STATIC_OSX_PKGS= } pip install --force-reinstall -r test-run/requirements.txt -# builddir used in this target - is a default build path from cmake ExternalProject_Add() +# 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 -DCMAKE_TARANTOOL_ARGS=3D"-DCMAKE_BUILD_TYPE=3DRelWithDebInfo;-DENABLE_WERR= OR=3DON" . && \ make -j && ctest -V diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake index 365c14284..86fec39e9 100644 --- a/cmake/BuildLibCURL.cmake +++ b/cmake/BuildLibCURL.cmake @@ -8,10 +8,11 @@ macro(curl_build) find_path(ZLIB_INCLUDE_DIR zlib.h) message(STATUS "Looking for zlib.h - ${ZLIB_INCLUDE_DIR}") if (BUILD_STATIC) - find_library(LIBZ_LIBRARY NAMES libz.a) + set(LIBZ_LIB_NAME libz.a) else() - find_library(LIBZ_LIBRARY NAMES z) + set(LIBZ_LIB_NAME z) endif() + find_library(LIBZ_LIBRARY NAMES ${LIBZ_LIB_NAME}) message(STATUS "Looking for libz - ${LIBZ_LIBRARY}") if (NOT ZLIB_INCLUDE_DIR OR NOT LIBZ_LIBRARY) diff --git a/static-build/.gitignore b/static-build/.gitignore deleted file mode 100644 index c8028a870..000000000 --- a/static-build/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*-prefix -/Makefile -/test/var -/build diff --git a/static-build/CMakeLists.txt b/static-build/CMakeLists.txt index d07cae176..90029fdd8 100644 --- a/static-build/CMakeLists.txt +++ b/static-build/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 2.8) -project(tarantool-env NONE) +# Detect system compilers for further configuring dependencies to be +# builded with these compilers. This is used to build tarantool and +# it's dependencies by usign one compiler system (for example libicu +# by default uses clang if it exists when others uses gcc/g++ on +# linux machine). +project(tarantool-static C CXX) include(ExternalProject) set(OPENSSL_VERSION 1.1.1f) @@ -9,21 +14,24 @@ set(NCURSES_VERSION 6.2) set(READLINE_VERSION 8.0) set(UNWIND_VERSION 1.3-rc1) -# Set compilers explicitly for further configuring dependencies with -# these compilers. This gonna solve libicu building problem in case when -# at dependency configure stage no compiler specified and clang compiler -# exists on linux machine, libicu sources would be compiled with clang -# while for other dependencies (including tarantool) gcc would be used. -# This behaviour causes problem at tarantool linkage stage. +# Pass -isysroot=3D option on Mac OS to a preprocessor and a C +# compiler to find header files installed with an SDK. +# +# The idea is to set these (DEPENDENCY_*) variables to corresponding +# environment variables at each depenency configure script. +# +# Note: Passing of CPPFLAGS / CFLAGS explicitly discards using of +# corresponsing environment variables. So pass empty LDFLAGS to discard +# using of corresponding environment variable. It is possible that a +# linker flag assumes that some compilation flag is set. We don't pass +# CFLAGS from environment, so we should not do it for LDFLAGS too. +set(DEPENDENCY_CFLAGS "") +set(DEPENDENCY_CPPFLAGS "") +set(DEPENDENCY_LDFLAGS) if (APPLE) - find_program(C_COMPILER clang) - find_program(CXX_COMPILER clang++) -else() - find_program(C_COMPILER gcc) - find_program(CXX_COMPILER g++) + set(DEPENDENCY_CFLAGS "${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT}"= ) + set(DEPENDENCY_CPPFLAGS "${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT}"= ) endif() -set(CMAKE_C_COMPILER ${C_COMPILER}) -set(CMAKE_CXX_COMPILER ${CXX_COMPILER}) # Install all libraries required by tarantool at current build dir @@ -32,9 +40,13 @@ set(CMAKE_CXX_COMPILER ${CXX_COMPILER}) # ExternalProject_Add(openssl URL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz - CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} + CONFIGURE_COMMAND /config + CC=3D${CMAKE_C_COMPILER} CXX=3D${CMAKE_CXX_COMPILER} - /config + CFLAGS=3D${DEPENDENCY_CFLAGS} + CPPFLAGS=3D${DEPENDENCY_CPPFLAGS} + LDFLAGS=3D${DEPENDENCY_LDFLAGS} + --prefix=3D --libdir=3Dlib no-shared @@ -46,9 +58,21 @@ ExternalProject_Add(openssl # ExternalProject_Add(icu URL https://github.com/unicode-org/icu/releases/download/release-62-1/icu4c-62_= 1-src.tgz - CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} + # By default libicu is built by using clang/clang++ compiler (if it + # exists). Here is a link for detecting compilers at libicu configure + # script: https://github.com/unicode-org/icu/blob/7c7b8bd5702310b972f888299169bc3cc88= bf0a6/icu4c/source/configure.ac#L135 + # This will cause the problem on linux machine: tarantool is built + # with gcc/g++ and libicu is built with clang/clang++ (if it exists) + # so at linking stage `rellocation` errors will occur. To solve this, + # we can set CC/CXX to CMAKE_C_COMPILER/CMAKE_CXX_COMPILER variables + # manually which are detected above (by cmake `project()` command) + CONFIGURE_COMMAND /source/configure + CC=3D${CMAKE_C_COMPILER} CXX=3D${CMAKE_CXX_COMPILER} - /source/configure + CFLAGS=3D${DEPENDENCY_CFLAGS} + CPPFLAGS=3D${DEPENDENCY_CPPFLAGS} + LDFLAGS=3D${DEPENDENCY_LDFLAGS} + --with-data-packaging=3Dstatic --prefix=3D --disable-shared @@ -60,11 +84,14 @@ ExternalProject_Add(icu # ExternalProject_Add(zlib URL https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz - CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} + CONFIGURE_COMMAND env + CC=3D${CMAKE_C_COMPILER} + CFLAGS=3D${DEPENDENCY_CFLAGS} + CPPFLAGS=3D${DEPENDENCY_CPPFLAGS} + LDFLAGS=3D${DEPENDENCY_LDFLAGS} /configure --prefix=3D --static - TEST_COMMAND ${CMAKE_MAKE_PROGRAM} check ) # @@ -72,13 +99,17 @@ ExternalProject_Add(zlib # ExternalProject_Add(ncurses URL https://ftp.gnu.org/gnu/ncurses/ncurses-${NCURSES_VERSION}.tar.gz - CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} + CONFIGURE_COMMAND /configure + CC=3D${CMAKE_C_COMPILER} CXX=3D${CMAKE_CXX_COMPILER} - /configure + CFLAGS=3D${DEPENDENCY_CFLAGS} + CPPFLAGS=3D${DEPENDENCY_CPPFLAGS} + LDFLAGS=3D${DEPENDENCY_LDFLAGS} + --prefix=3D # This flag enables creation of libcurses.a as a symlink to libncurses.a - # and disables subdir creation `ncurses` at /include. It is + # and disables subdir creation `ncurses` at /include. It is # necessary for correct work of FindCurses.cmake module (this module is # builtin at cmake package) which used in cmake/FindReadline.cmake --enable-overwrite @@ -101,11 +132,14 @@ ExternalProject_Add(ncurses # ExternalProject_Add(readline URL https://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz - CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} - /configure + CONFIGURE_COMMAND /configure + CC=3D${CMAKE_C_COMPILER} + CFLAGS=3D${DEPENDENCY_CFLAGS} + CPPFLAGS=3D${DEPENDENCY_CPPFLAGS} + LDFLAGS=3D${DEPENDENCY_LDFLAGS} + --prefix=3D --disable-shared - # STEP_TARGETS download ) # @@ -114,8 +148,12 @@ ExternalProject_Add(readline if (APPLE) ExternalProject_Add(iconv URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz - CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} - /configure + CONFIGURE_COMMAND /configure + CC=3D${CMAKE_C_COMPILER} + CFLAGS=3D${DEPENDENCY_CFLAGS} + CPPFLAGS=3D${DEPENDENCY_CPPFLAGS} + LDFLAGS=3D${DEPENDENCY_LDFLAGS} + --prefix=3D --disable-shared --enable-static @@ -203,9 +241,12 @@ if (APPLE) else() ExternalProject_Add(unwind URL https://download.savannah.nongnu.org/releases/libunwind/libunwind-${UNWIND_= VERSION}.tar.gz - CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} + CONFIGURE_COMMAND /configure + CC=3D${CMAKE_C_COMPILER} CXX=3D${CMAKE_CXX_COMPILER} - /configure + CFLAGS=3D${DEPENDENCY_CFLAGS} + CPPFLAGS=3D${DEPENDENCY_CPPFLAGS} + LDFLAGS=3D${DEPENDENCY_LDFLAGS} --prefix=3D --disable-shared --enable-static @@ -258,7 +299,13 @@ add_test( ) add_test( - NAME test-run-static - COMMAND ./test-run.py --builddir ${TARANTOOL_BINARY_DIR} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test + NAME check-exports + COMMAND ${TARANTOOL_BINARY_DIR}/src/tarantool + ${CMAKE_CURRENT_SOURCE_DIR}/test/static-build/exports.test.lua +) + +add_test( + NAME check-traceback + COMMAND ${TARANTOOL_BINARY_DIR}/src/tarantool + ${CMAKE_CURRENT_SOURCE_DIR}/test/static-build/traceback.test.lua ) diff --git a/static-build/README.md b/static-build/README.md index 0019e963f..2219b5026 100644 --- a/static-build/README.md +++ b/static-build/README.md @@ -5,6 +5,29 @@ statically. And builds it. ## Prerequisites +Please install following tools and libraries that will +be necessary for building and testing: +* git +* A C/C++ compiler. + + Ordinarily, this is gcc and g++ version 4.6 or later. On Mac OS X, this + is Clang version 3.2+. +* cmake +* autoconf automake libtool +* make +* Python and modules. + + Python interpreter is not necessary for building Tarantool itself, unless you + intend to use the =E2=80=9CRun the test suite". For all platforms, this = is python + version 2.7+ (but not 3.x). You need the following Python modules: + * pyyaml + * argparse + * msgpack-python + * gevent + * six + +### Here is an examples for your OS: + CentOS: ```bash @@ -13,11 +36,20 @@ yum install -y \ python-msgpack python-yaml python-argparse python-six python-gevent ``` +Ubuntu/Debian: + +```bash +apt-get install -y \ + build-essential cmake make coreutils autoconf automake libtool sed \ + python python-pip python-setuptools python-dev \ + python-msgpack python-yaml python-argparse python-six python-gevent +``` + MacOS: Before you start please install default Xcode Tools by Apple: -``` +```bash sudo xcode-select --install sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer ``` @@ -28,11 +60,11 @@ Install brew using command from 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 +brew install autoconf automake libtool cmake file://$${PWD}/tools/brew_taps/tntpython2.rbs +pip install --force-reinstall -r test-run/requirements.txt ``` -### Usage +## Usage ```bash cmake . @@ -46,7 +78,7 @@ If you want to customise build, you need to set `CMAKE_TARANTOOL_ARGS` variable ### Usage -There is three types of `CMAKE_BUILD_TYPE`: +There are three types of `CMAKE_BUILD_TYPE`: * Debug - default * Release * RelWithDebInfo diff --git a/static-build/test/static-build/exports.test.lua b/static-build/test/static-build/exports.test.lua index 63dc163a9..de54973d8 100755 --- a/static-build/test/static-build/exports.test.lua +++ b/static-build/test/static-build/exports.test.lua @@ -8,19 +8,13 @@ ffi.cdef([[ local test =3D tap.test('exports') - -local RTLD_DEFAULT -- See `man 3 dlsym`: -- RTLD_DEFAULT --- Find the first occurrence of the desired symbol using the default --- shared object search order. The search will include global symbols +-- Find the first occurrence of the desired symbol using the default +-- shared object search order. The search will include global symbols -- in the executable and its dependencies, as well as symbols in shared -- objects that were dynamically loaded with the RTLD_GLOBAL flag. -if jit.os =3D=3D "OSX" then - RTLD_DEFAULT =3D ffi.cast("void *", -2LL) -else - RTLD_DEFAULT =3D ffi.cast("void *", 0LL) -end +local RTLD_DEFAULT =3D ffi.cast("void *", jit.os =3D=3D "OSX" and -2LL or = 0LL) local function check_symbol(sym) test:ok(ffi.C.dlsym(RTLD_DEFAULT, sym) ~=3D nil, ('Symbol %q found'):format(sym)) diff --git a/static-build/test/static-build/suite.ini b/static-build/test/static-build/suite.ini deleted file mode 100644 index 5aabadd92..000000000 --- a/static-build/test/static-build/suite.ini +++ /dev/null @@ -1,4 +0,0 @@ -[default] -core =3D app -description =3D Static build tests -is_parallel =3D True diff --git a/static-build/test/test-run.py b/static-build/test/test-run.py deleted file mode 120000 index 02187cdc5..000000000 --- a/static-build/test/test-run.py +++ /dev/null @@ -1 +0,0 @@ -../../test-run/test-run.py \ No newline at end of file =D0=BF=D1=82, 4 =D1=81=D0=B5=D0=BD=D1=82. 2020 =D0=B3. =D0=B2 20:52, Igor M= unkin : > Hello, > > Thanks for the patch! It's strange to me why this patch is not reviewed > by Sasha Ti., though there are many changes in the build and testing > infrastructure. Nevertheless, please consider my comments below. > > On 25.08.20, HustonMmmavr wrote: > > From: Yaroslav Dynnikov > > > > Refactored static build process to use static-build/CMakeLists.txt > > instead of Dockerfile.staticbuild (this allows to support static > > build on macOS). Following third-party dependencies for static build > > are installed via cmake `ExternalProject_Add`: > > - OpenSSL > > - Zlib > > - Ncurses > > - Readline > > - Unwind > > - ICU > > > > * Added support static build for macOS > > * Prevented linking tarantool binary with system libcurses (which is > > entire copy of libncurses) by setting flag `CURSES_NEED_NCURSES` > > to TRUE at file cmake/FindReadline.cmake. (This flag defined at > > FindCurses.cmake module and it's a workaround for linking with > > correct library) > > * Fixed `CONFIGURE_COMMAND` while building bundled libcurl for staic > > Typo: s/staic/static/. > > > build at file cmake/BuildLibCURL.cmake: > > - disable building shared libcurl libraries (by setting > > `--disable-shared` option) > > - disable hiding libcurl symbols (by setting > > `--disable-symbol-hiding` option) > > - prevent linking libcurl with system libz by settign > > Typo: s/settign/setting/. > > > `--with-zlib=3D${FOUND_ZLIB_ROOT_DIR}` option) > > * Removed Dockerfile.staticbuild > > * Added new gitlab.ci jobs to test new style static build: > > - static_build_cmake_linux > > - static_build_cmake_osx_15 > > * Removed static_docker_build gitlab.ci job > > > > Closes #5095 > > --- > > .gitlab-ci.yml | 11 +- > > .travis.mk | 52 +++- > > Dockerfile.staticbuild | 98 ------- > > cmake/BuildLibCURL.cmake | 18 +- > > cmake/FindReadline.cmake | 10 + > > cmake/compiler.cmake | 24 +- > > cmake/os.cmake | 5 +- > > static-build/.gitignore | 4 + > > static-build/CMakeLists.txt | 240 ++++++++++++++++++ > > static-build/README.md | 58 +++++ > > static-build/test/CheckDependencies.cmake | 43 ++++ > > static-build/test/static-build/box.lua | 3 + > > .../test/static-build/exports.test.lua | 148 +++++++++++ > > static-build/test/static-build/suite.ini | 5 + > > .../test/static-build/traceback.test.lua | 15 ++ > > static-build/test/test-run.py | 1 + > > 16 files changed, 608 insertions(+), 127 deletions(-) > > delete mode 100644 Dockerfile.staticbuild > > create mode 100644 static-build/.gitignore > > create mode 100644 static-build/CMakeLists.txt > > create mode 100644 static-build/README.md > > create mode 100644 static-build/test/CheckDependencies.cmake > > create mode 100755 static-build/test/static-build/box.lua > > create mode 100755 static-build/test/static-build/exports.test.lua > > create mode 100644 static-build/test/static-build/suite.ini > > create mode 100755 static-build/test/static-build/traceback.test.lua > > create mode 120000 static-build/test/test-run.py > > > > > > > diff --git a/.travis.mk b/.travis.mk > > index efc05cf05..482672429 100644 > > --- a/.travis.mk > > +++ b/.travis.mk > > @@ -148,8 +148,12 @@ deps_debian_static: > > test_static_build: deps_debian_static > > CMAKE_EXTRA_PARAMS=3D-DBUILD_STATIC=3DON make -f .travis.mk > test_debian_no_deps > > > > -test_static_docker_build: > > - docker build --no-cache --network=3Dhost --build-arg RUN_TESTS=3D= ON -f > Dockerfile.staticbuild . > > +# New static build > > +# builddir used in this target - is a default build path from cmake > ExternalProject_Add() > > The comment exceeds 80 symbols. > > > +test_static_build_cmake_linux: > > > > > diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake > > index 5f8b15a63..365c14284 100644 > > --- a/cmake/BuildLibCURL.cmake > > +++ b/cmake/BuildLibCURL.cmake > > @@ -4,15 +4,20 @@ macro(curl_build) > > > > > 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}) > > Well... What is the difference from the previous approach? > > > - if ("${LIBZ_LIBRARY}" STREQUAL "LIBZ_LIBRARY-NOTFOUND") > > + message(STATUS "Looking for libz - ${LIBZ_LIBRARY}") > > + > > > > > diff --git a/static-build/.gitignore b/static-build/.gitignore > > new file mode 100644 > > index 000000000..c8028a870 > > --- /dev/null > > +++ b/static-build/.gitignore > > Minor: Why did you introduce a separate .gitignore instead of adjusting > the root one? > > > @@ -0,0 +1,4 @@ > > > > > diff --git a/static-build/CMakeLists.txt b/static-build/CMakeLists.txt > > new file mode 100644 > > index 000000000..d90a642e6 > > --- /dev/null > > +++ b/static-build/CMakeLists.txt > > @@ -0,0 +1,240 @@ > > +cmake_minimum_required(VERSION 2.8) > > + > > +project(tarantool-env NONE) > > Minor: Why is the name tarantool-env and not e.g. tarantool-static? > > > + > > > > > + > > +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}) > > I see you've added a comment for this passage, *but* at least for me > Sasha's comment is still left unaddressed. AFAICS Sasha asked whether we > can solve the linkage issue by explicitly setting CMAKE_C{,XX}_COMPILER > variables. If the problem isn't fixed this way, then I guess your > solution is fine. > > > + > > +# Install all libraries required by tarantool at current build dir > > + > > > > > +# > > +# ICU > > +# > > +ExternalProject_Add(icu > > + URL > https://github.com/unicode-org/icu/releases/download/release-62-1/icu4c-6= 2_1-src.tgz > > + CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} > > + CXX=3D${CMAKE_CXX_COMPILER} > > OK, I see, you've already set the variables I mentioned above. Anyway, > please mention this fact if it doesn't fix the linkage issue (maybe > refer the corresponding place in libicu configure / the issue / etc). > > > + /source/configure > > + --with-data-packaging=3Dstatic > > + --prefix=3D > > + --disable-shared > > + --enable-static > > +) > > + > > +# > > +# ZLIB > > +# > > +ExternalProject_Add(zlib > > + URL https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz > > + CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} > > + /configure > > + --prefix=3D > > + --static > > + TEST_COMMAND ${CMAKE_MAKE_PROGRAM} check > > This TEST_COMMAND line looks odd and I guess it need some commenting > with the rationale, since other commands don't have it. > > > +) > > + > > > > > + > > +# > > +# ReadLine > > +# > > +ExternalProject_Add(readline > > + URL > https://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz > > + CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER} > > + /configure > > + --prefix=3D > > + --disable-shared > > + # STEP_TARGETS download > > Looks like this line can be dropped. > > > +) > > + > > > > > diff --git a/static-build/README.md b/static-build/README.md > > new file mode 100644 > > index 000000000..0019e963f > > --- /dev/null > > +++ b/static-build/README.md > > @@ -0,0 +1,58 @@ > > +# Tarantool static build tooling > > + > > +These files help to prepare environment for building Tarantool > > +statically. And builds it. > > + > > +## Prerequisites > > + > > +CentOS: > > Minor: Does this mean that other distros are not supported? > > > + > > +```bash > > +yum install -y \ > > + git perl gcc cmake make gcc-c++ libstdc++-static autoconf automake > libtool \ > > + python-msgpack python-yaml python-argparse python-six python-geven= t > > +``` > > + > > +MacOS: > > + > > +Before you start please install default Xcode Tools by Apple: > > + > > +``` > > Typo: bash specifier is missing (considering verbatim blocks below). > > > +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 > > Typo: Looks like misindentation. > > > +``` > > + > > +### Usage > > Typo: I guess it should be h2, not h3. > > > + > > +```bash > > +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`: > > Typo: s/is/are/. > > > +* Debug - default > > +* Release > > +* RelWithDebInfo > > + > > +And you want to build tarantool with RelWithDebInfo: > > + > > +```bash > > +cmake -DCMAKE_TARANTOOL_ARGS=3D"-DCMAKE_BUILD_TYPE=3DRelWithDebInfo" . > > +``` > > > > > diff --git a/static-build/test/static-build/exports.test.lua > b/static-build/test/static-build/exports.test.lua > > new file mode 100755 > > index 000000000..63dc163a9 > > --- /dev/null > > +++ b/static-build/test/static-build/exports.test.lua > > @@ -0,0 +1,148 @@ > > > > > + > > +local RTLD_DEFAULT > > +-- See `man 3 dlsym`: > > +-- RTLD_DEFAULT > > +-- Find the first occurrence of the desired symbol using the defau= lt > > +-- shared object search order. The search will include global symbo= ls > > Typo: There are several places above with doubled whitespace. > > > +-- in the executable and its dependencies, as well as symbols in > shared > > +-- objects that were dynamically loaded with the RTLD_GLOBAL flag. > > +if jit.os =3D=3D "OSX" then > > + RTLD_DEFAULT =3D ffi.cast("void *", -2LL) > > +else > > + RTLD_DEFAULT =3D ffi.cast("void *", 0LL) > > +end > > Minor: OK, since the difference is only in the constant value, the > following way looks more convenient to me: > | local RTLD_DEFAULT =3D ffi.cast("void *", jit.os =3D=3D "OSX" and -2LL = or 0LL) > > > + > > > > > -- > > 2.26.2 > > > > -- > Best regards, > IM > --000000000000fff37005aee28fc7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello, thank you for the review!

Here are required = fixes:

1. Fixed typos at commit message, here is a new:

build= : refactor static build process

Refactored static build process to u= se static-build/CMakeLists.txt
instead of Dockerfile.staticbuild (this a= llows to support static
build on macOS). Following third-party dependenc= ies for static build
are installed via cmake `ExternalProject_Add`:
= =C2=A0 =C2=A0 - OpenSSL
=C2=A0 =C2=A0 - Zlib
=C2=A0 =C2=A0 - Ncurses<= br>=C2=A0 =C2=A0 - Readline
=C2=A0 =C2=A0 - Unwind
=C2=A0 =C2=A0 - IC= U

* Added support static build for macOS
* Fixed `CONFIGURE_COMMA= ND` while building bundled libcurl for static
=C2=A0 =C2=A0 build at fil= e cmake/BuildLibCURL.cmake:
=C2=A0 =C2=A0 - disable building shared libc= url libraries (by setting
=C2=A0 =C2=A0 =C2=A0 =C2=A0 `--disable-shared`= option)
=C2=A0 =C2=A0 - disable hiding libcurl symbols (by setting
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 `--disable-symbol-hiding` option)
=C2=A0 =C2= =A0 - prevent linking libcurl with system libz (by setting
=C2=A0 =C2=A0= =C2=A0 =C2=A0 `--with-zlib=3D${FOUND_ZLIB_ROOT_DIR}` option)
* Removed = Dockerfile.staticbuild
* Added new gitlab.c= i jobs to test new style static build:
=C2=A0 =C2=A0 - static_build_= cmake_linux
=C2=A0 =C2=A0 - static_build_cmake_osx_15
* Removed stati= c_docker_build gitlab.ci job

Closes= #5095

2. Fixed commentaries at .travis= .mk

3. Fixed finding libz library at cmake/BuildLibCurl.cmake as= at master
=C2=A0 =C2=A0branch

4. Instead of using static-build/.= gitignore use the root .gitignore file

5. Refactored static-build/CM= akeLists.txt:
* Project name is set to tarantool-static
* Instead of = explicitly finding of c/c++ compilers current version uses
cmake `projec= t(tarantool-static C CXX)` command. This change requires
to manually set= CFLAGS/CPPFLAGS/LDFLAGS for all static-build
dependencies (because buil= ding dependencies at macOS requires path
to macOS SDK) the idea was take= n from cmake/BuildLibCurl.cmake
* Added commentaries about problem with = libicu
* Removed unused TEST_COMMAND at ExternalProject_Add(zlib ...) al= so
removed unnecessary # STEP_TARGETS at ExternalProject_Add(readline ..= .)
* Deleted doubled whitespaces

6. Fixed static-build/README.md:=
* Added list of required tools
* Added example for ubuntu/debian
= * Fixed indentation and typos

7. Refactored tests:
* Got rid of t= est-run
* Deleted whitespaces at exports.test.lua
* Fixed defining of= RTLD_DEFAULT


Here is a diff:

diff --git a/.gitignore b/.= gitignore
index a42c7db35..c6e261e18 100644
--- a/.gitignore
+++ b= /.gitignore
@@ -151,3 +151,11 @@ src/box/sql/parse.h
=C2=A0src/box/sq= l/parse.c
=C2=A0src/box/sql/opcodes.h
=C2=A0src/box/sql/opcodes.c
= +
+# static-build
+static-build/*-prefix
+static-build/Makefile+static-build/build
+
+# macOS files
+.DS_Store
diff --git a/.= travis.mk b/.= travis.mk
index ccd9d6db1..58d0c1596 100644
--- a/.travis.mk
+++ b/.travis.= mk
@@ -149,7 +149,8 @@ test_static_build: 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 b= uild
-# builddir used in this target - is a default build path from cmak= e ExternalProject_Add()
+# builddir used in this target - is a default b= uild path from cmake
+# ExternalProject_Add()
=C2=A0test_static_build= _cmake_linux:
=C2=A0 cd static-build && cmake -DCMAKE_TARANTOOL_= ARGS=3D"-DCMAKE_BUILD_TYPE=3DRelWithDebInfo;-DENABLE_WERROR=3DON"= . && \
=C2=A0 make -j && ctest -V
@@ -233,7 +234,8 @= @ base_deps_osx:
=C2=A0 brew install --force ${STATIC_OSX_PKGS} || brew = upgrade ${STATIC_OSX_PKGS}
=C2=A0 pip install --force-reinstall -r test-= run/requirements.txt
=C2=A0
-# builddir used in this target - is a de= fault build path from cmake ExternalProject_Add()
+# builddir used in th= is target - is a default build path from cmake
+# ExternalProject_Add()<= br>=C2=A0test_static_build_cmake_osx: base_deps_osx
=C2=A0 cd static-bui= ld && cmake -DCMAKE_TARANTOOL_ARGS=3D"-DCMAKE_BUILD_TYPE=3DRel= WithDebInfo;-DENABLE_WERROR=3DON" . && \
=C2=A0 make -j &am= p;& ctest -V
diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibC= URL.cmake
index 365c14284..86fec39e9 100644
--- a/cmake/BuildLibCURL.= cmake
+++ b/cmake/BuildLibCURL.cmake
@@ -8,10 +8,11 @@ macro(curl_bui= ld)
=C2=A0 =C2=A0 =C2=A0find_path(ZLIB_INCLUDE_DIR zlib.h)
=C2=A0 =C2= =A0 =C2=A0message(STATUS "Looking for zlib.h - ${ZLIB_INCLUDE_DIR}&quo= t;)
=C2=A0 =C2=A0 =C2=A0if (BUILD_STATIC)
- =C2=A0 =C2=A0 =C2=A0 =C2= =A0find_library(LIBZ_LIBRARY NAMES libz.a)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0= set(LIBZ_LIB_NAME libz.a)
=C2=A0 =C2=A0 =C2=A0else()
- =C2=A0 =C2=A0 = =C2=A0 =C2=A0find_library(LIBZ_LIBRARY NAMES z)
+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0set(LIBZ_LIB_NAME z)
=C2=A0 =C2=A0 =C2=A0endif()
+ =C2=A0 =C2= =A0find_library(LIBZ_LIBRARY NAMES ${LIBZ_LIB_NAME})
=C2=A0 =C2=A0 =C2= =A0message(STATUS "Looking for libz - ${LIBZ_LIBRARY}")
=C2=A0=
=C2=A0 =C2=A0 =C2=A0if (NOT ZLIB_INCLUDE_DIR OR NOT LIBZ_LIBRARY)
di= ff --git a/static-build/.gitignore b/static-build/.gitignore
deleted fil= e mode 100644
index c8028a870..000000000
--- a/static-build/.gitignor= e
+++ /dev/null
@@ -1,4 +0,0 @@
-*-prefix
-/Makefile
-/test/= var
-/build
diff --git a/static-build/CMakeLists.txt b/static-build/C= MakeLists.txt
index d07cae176..90029fdd8 100644
--- a/static-build/CM= akeLists.txt
+++ b/static-build/CMakeLists.txt
@@ -1,6 +1,11 @@
= =C2=A0cmake_minimum_required(VERSION 2.8)
=C2=A0
-project(tarantool-e= nv NONE)
+# Detect system compilers for further configuring dependencies= to be
+# builded with these compilers. This is used to build tarantool = and
+# it's dependencies by usign one compiler system (for example l= ibicu
+# by default uses clang if it exists when others uses gcc/g++ on<= br>+# linux machine).
+project(tarantool-static C CXX)
=C2=A0
=C2= =A0include(ExternalProject)
=C2=A0set(OPENSSL_VERSION 1.1.1f)
@@ -9,2= 1 +14,24 @@ set(NCURSES_VERSION 6.2)
=C2=A0set(READLINE_VERSION 8.0)
= =C2=A0set(UNWIND_VERSION 1.3-rc1)
=C2=A0
-# Set compilers explicitly = for further configuring dependencies with
-# these compilers. This gonna= solve libicu building problem in case when
-# at dependency configure s= tage no compiler specified and clang compiler
-# exists on linux machine= , libicu sources would be compiled with clang
-# while for other depende= ncies (including tarantool) gcc would be used.
-# This behaviour causes = problem at tarantool linkage stage.
+# Pass -isysroot=3D<SDK_PATH>= option on Mac OS to a preprocessor and a C
+# compiler to find header f= iles installed with an SDK.
+#
+# The idea is to set these (DEPENDENC= Y_*) variables to corresponding
+# environment variables at each depenen= cy configure script.
+#
+# Note: Passing of CPPFLAGS / CFLAGS explici= tly discards using of
+# corresponsing environment variables. So pass em= pty LDFLAGS to discard
+# using of corresponding environment variable. I= t is possible that a
+# linker flag assumes that some compilation flag i= s set. We don't pass
+# CFLAGS from environment, so we should not do= it for LDFLAGS too.
+set(DEPENDENCY_CFLAGS "")
+set(DEPEND= ENCY_CPPFLAGS "")
+set(DEPENDENCY_LDFLAGS)
=C2=A0if (APPLE)=
- =C2=A0 =C2=A0find_program(C_COMPILER clang)
- =C2=A0 =C2=A0find_pr= ogram(CXX_COMPILER clang++)
-else()
- =C2=A0 =C2=A0find_program(C_COM= PILER gcc)
- =C2=A0 =C2=A0find_program(CXX_COMPILER g++)
+ =C2=A0 =C2= =A0set(DEPENDENCY_CFLAGS =C2=A0 "${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_S= YSROOT}")
+ =C2=A0 =C2=A0set(DEPENDENCY_CPPFLAGS "${CMAKE_C_SY= SROOT_FLAG} ${CMAKE_OSX_SYSROOT}")
=C2=A0endif()
-set(CMAKE_C_CO= MPILER ${C_COMPILER})
-set(CMAKE_CXX_COMPILER ${CXX_COMPILER})
=C2=A0=
=C2=A0# Install all libraries required by tarantool at current build di= r
=C2=A0
@@ -32,9 +40,13 @@ set(CMAKE_CXX_COMPILER ${CXX_COMPILER})=C2=A0#
=C2=A0ExternalProject_Add(openssl
=C2=A0 =C2=A0 =C2=A0URL <= a href=3D"https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"= >https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
- = =C2=A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
+ =C2=A0 =C2=A0C= ONFIGURE_COMMAND <SOURCE_DIR>/config
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0= CC=3D${CMAKE_C_COMPILER}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CXX=3D${CMAKE= _CXX_COMPILER}
- =C2=A0 =C2=A0 =C2=A0 =C2=A0<SOURCE_DIR>/config+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CFLAGS=3D${DEPENDENCY_CFLAGS}
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0CPPFLAGS=3D${DEPENDENCY_CPPFLAGS}
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0LDFLAGS=3D${DEPENDENCY_LDFLAGS}
+
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0--prefix=3D<INSTALL_DIR>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0--libdir=3Dlib
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0no-shared
@@ -46,= 9 +58,21 @@ ExternalProject_Add(openssl
=C2=A0#
=C2=A0ExternalProject= _Add(icu
=C2=A0 =C2=A0 =C2=A0URL https://github.co= m/unicode-org/icu/releases/download/release-62-1/icu4c-62_1-src.tgz
= - =C2=A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
+ =C2=A0 =C2= =A0# By default libicu is built by using clang/clang++ compiler (if it
+= =C2=A0 =C2=A0# exists). Here is a link for detecting compilers at libicu c= onfigure
+ =C2=A0 =C2=A0# script: https://github.com/unicode-org/icu/blob/7c7b8bd5702310b972f88829= 9169bc3cc88bf0a6/icu4c/source/configure.ac#L135
+ =C2=A0 =C2=A0# Thi= s will cause the problem on linux machine: tarantool is built
+ =C2=A0 = =C2=A0# with gcc/g++ and libicu is built with clang/clang++ (if it exists)<= br>+ =C2=A0 =C2=A0# so at linking stage `rellocation` errors will occur. To= solve this,
+ =C2=A0 =C2=A0# we can set CC/CXX to CMAKE_C_COMPILER/CMAK= E_CXX_COMPILER variables
+ =C2=A0 =C2=A0# manually which are detected ab= ove (by cmake `project()` command)
+ =C2=A0 =C2=A0CONFIGURE_COMMAND <= SOURCE_DIR>/source/configure
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CC=3D${CMAK= E_C_COMPILER}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CXX=3D${CMAKE_CXX_COMPIL= ER}
- =C2=A0 =C2=A0 =C2=A0 =C2=A0<SOURCE_DIR>/source/configure
= + =C2=A0 =C2=A0 =C2=A0 =C2=A0CFLAGS=3D${DEPENDENCY_CFLAGS}
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0CPPFLAGS=3D${DEPENDENCY_CPPFLAGS}
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0LDFLAGS=3D${DEPENDENCY_LDFLAGS}
+
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0--with-data-packaging=3Dstatic
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0--prefix=3D<INSTALL_DIR>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--di= sable-shared
@@ -60,11 +84,14 @@ ExternalProject_Add(icu
=C2=A0#
= =C2=A0ExternalProject_Add(zlib
=C2=A0 =C2=A0 =C2=A0URL https://zlib.net/zlib-${ZLIB_VERSIO= N}.tar.gz
- =C2=A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}<= br>+ =C2=A0 =C2=A0CONFIGURE_COMMAND env
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CC= =3D${CMAKE_C_COMPILER}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CFLAGS=3D${DEPENDENC= Y_CFLAGS}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CPPFLAGS=3D${DEPENDENCY_CPPFLAGS}=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0LDFLAGS=3D${DEPENDENCY_LDFLAGS}
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0<SOURCE_DIR>/configure
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0--prefix=3D<INSTALL_DIR>
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0--static
- =C2=A0 =C2=A0TEST_COMMAND ${CMAKE_MAKE_PROGRAM} = check
=C2=A0)
=C2=A0
=C2=A0#
@@ -72,13 +99,17 @@ ExternalProjec= t_Add(zlib
=C2=A0#
=C2=A0ExternalProject_Add(ncurses
=C2=A0 =C2=A0= =C2=A0URL https://ftp.gnu.org/gnu/ncurses/ncurses-${NCURSES_VERSION}.ta= r.gz
- =C2=A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
+ = =C2=A0 =C2=A0CONFIGURE_COMMAND <SOURCE_DIR>/configure
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0CC=3D${CMAKE_C_COMPILER}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0CXX=3D${CMAKE_CXX_COMPILER}
- =C2=A0 =C2=A0 =C2=A0 =C2=A0<SOURC= E_DIR>/configure
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CFLAGS=3D${DEPENDENCY_C= FLAGS}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CPPFLAGS=3D${DEPENDENCY_CPPFLAGS}+ =C2=A0 =C2=A0 =C2=A0 =C2=A0LDFLAGS=3D${DEPENDENCY_LDFLAGS}
+
=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# This flag enables creation of libcurses= .a as a symlink to libncurses.a
- =C2=A0 =C2=A0 =C2=A0 =C2=A0# and disab= les subdir creation `ncurses` at =C2=A0<install_dir>/include. It is+ =C2=A0 =C2=A0 =C2=A0 =C2=A0# and disables subdir creation `ncurses` at = <install_dir>/include. It is
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# n= ecessary for correct work of FindCurses.cmake module (this module is
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# builtin at cmake package) which used in cm= ake/FindReadline.cmake
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--enable-overwr= ite
@@ -101,11 +132,14 @@ ExternalProject_Add(ncurses
=C2=A0#
=C2= =A0ExternalProject_Add(readline
=C2=A0 =C2=A0 =C2=A0URL https://ft= p.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz
- =C2=A0 = =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
- =C2=A0 =C2=A0 =C2=A0 = =C2=A0<SOURCE_DIR>/configure
+ =C2=A0 =C2=A0CONFIGURE_COMMAND <= SOURCE_DIR>/configure
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CC=3D${CMAKE_C_COM= PILER}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CFLAGS=3D${DEPENDENCY_CFLAGS}
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0CPPFLAGS=3D${DEPENDENCY_CPPFLAGS}
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0LDFLAGS=3D${DEPENDENCY_LDFLAGS}
+
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0--prefix=3D<INSTALL_DIR>
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0--disable-shared
- =C2=A0 =C2=A0# STEP_TARGETS download
= =C2=A0)
=C2=A0
=C2=A0#
@@ -114,8 +148,12 @@ ExternalProject_Add(re= adline
=C2=A0if (APPLE)
=C2=A0 =C2=A0 =C2=A0ExternalProject_Add(iconv=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0URL https://ftp.gnu.org/pub/gnu/libiconv/l= ibiconv-1.16.tar.gz
- =C2=A0 =C2=A0 =C2=A0 =C2=A0CONFIGURE_COMMAND C= C=3D${CMAKE_C_COMPILER}
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<S= OURCE_DIR>/configure
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CONFIGURE_COMMAND &= lt;SOURCE_DIR>/configure
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0C= C=3D${CMAKE_C_COMPILER}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CFLAG= S=3D${DEPENDENCY_CFLAGS}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CPPF= LAGS=3D${DEPENDENCY_CPPFLAGS}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0LDFLAGS=3D${DEPENDENCY_LDFLAGS}
+
=C2=A0 =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 =C2=A0--disable-shared
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0--enable-static
@@ -203,9 +241,12 @@ if (APPLE)
=C2= =A0else()
=C2=A0 =C2=A0 =C2=A0ExternalProject_Add(unwind
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0URL https://download.sa= vannah.nongnu.org/releases/libunwind/libunwind-${UNWIND_VERSION}.tar.gz=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0CONFIGURE_COMMAND <SOURCE_DIR>/confi= gure
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CC=3D${CMAKE_C_COMPILER}=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CXX=3D${CMAKE_CXX_COMPI= LER}
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<SOURCE_DIR>/confi= gure
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CFLAGS=3D${DEPENDENCY_CF= LAGS}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CPPFLAGS=3D${DEPENDENCY= _CPPFLAGS}
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0LDFLAGS=3D${DEPEND= ENCY_LDFLAGS}
=C2=A0 =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 =C2=A0-= -disable-shared
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--enable= -static
@@ -258,7 +299,13 @@ add_test(
=C2=A0)
=C2=A0
=C2=A0add= _test(
- =C2=A0 =C2=A0NAME test-run-static
- =C2=A0 =C2=A0COMMAND ./t= est-run.py --builddir ${TARANTOOL_BINARY_DIR}
- =C2=A0 =C2=A0WORKING_DIR= ECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
+ =C2=A0 =C2=A0NAME check-export= s
+ =C2=A0 =C2=A0COMMAND ${TARANTOOL_BINARY_DIR}/src/tarantool
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0${CMAKE_CURRENT_SOURCE_DIR}/test/stat= ic-build/exports.test.lua
+)
+
+add_test(
+ =C2=A0 =C2=A0NAME c= heck-traceback
+ =C2=A0 =C2=A0COMMAND ${TARANTOOL_BINARY_DIR}/src/tarant= ool
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0${CMAKE_CURRENT_SOURCE_DI= R}/test/static-build/traceback.test.lua
=C2=A0)
diff --git a/static-b= uild/README.md b/static-build/README.md
index 0019e963f..2219b5026 10064= 4
--- a/static-build/README.md
+++ b/static-build/README.md
@@ -5,= 6 +5,29 @@ statically. And builds it.
=C2=A0
=C2=A0## Prerequisites=C2=A0
+Please install following tools and libraries that will
+be = necessary for building and testing:
+* git
+* A C/C++ compiler.
+<= br>+ =C2=A0Ordinarily, this is gcc and g++ version 4.6 or later. On Mac OS = X, this
+ =C2=A0is Clang version 3.2+.
+* cmake
+* autoconf automa= ke libtool
+* make
+* Python and modules.
+
+ =C2=A0Python inte= rpreter is not necessary for building Tarantool itself, unless you
+ =C2= =A0intend to use the =E2=80=9CRun the test suite". For all platforms, = this is python
+ =C2=A0version 2.7+ (but not 3.x). You need the followin= g Python modules:
+ =C2=A0* pyyaml
+ =C2=A0* argparse
+ =C2=A0* ms= gpack-python
+ =C2=A0* gevent
+ =C2=A0* six
+
+### Here is an e= xamples for your OS:
+
=C2=A0CentOS:
=C2=A0
=C2=A0```bash
@@= -13,11 +36,20 @@ yum install -y \
=C2=A0 =C2=A0 =C2=A0python-msgpack py= thon-yaml python-argparse python-six python-gevent
=C2=A0```
=C2=A0+Ubuntu/Debian:
+
+```bash
+apt-get install -y \
+ =C2=A0 =C2= =A0build-essential cmake make coreutils autoconf automake libtool sed \
= + =C2=A0 =C2=A0python python-pip python-setuptools python-dev \
+ =C2=A0= =C2=A0python-msgpack python-yaml python-argparse python-six python-gevent<= br>+```
+
=C2=A0MacOS:
=C2=A0
=C2=A0Before you start please ins= tall default Xcode Tools by Apple:
=C2=A0
-```
+```bash
=C2=A0s= udo xcode-select --install
=C2=A0sudo xcode-select -switch /Applications= /Xcode.app/Contents/Developer
=C2=A0```
@@ -28,11 +60,11 @@ Install b= rew using command from
=C2=A0After that run next script:
=C2=A0
= =C2=A0```bash
- =C2=A0brew install autoconf automake libtool cmake file:= //$${PWD}/tools/brew_taps/tntpython2.rbs
- =C2=A0pip install --force-rei= nstall -r test-run/requirements.txt
+brew install autoconf automake libt= ool cmake file://$${PWD}/tools/brew_taps/tntpython2.rbs
+pip install --f= orce-reinstall -r test-run/requirements.txt
=C2=A0```
=C2=A0
-### = Usage
+## Usage
=C2=A0
=C2=A0```bash
=C2=A0cmake .
@@ -46,7 = +78,7 @@ If you want to customise build, you need to set `CMAKE_TARANTOOL_A= RGS` variable
=C2=A0
=C2=A0### Usage
=C2=A0
-There is three typ= es of `CMAKE_BUILD_TYPE`:
+There are three types of `CMAKE_BUILD_TYPE`:<= br>=C2=A0* Debug - default
=C2=A0* Release
=C2=A0* RelWithDebInfo
= diff --git a/static-build/test/static-build/exports.test.lua b/static-build= /test/static-build/exports.test.lua
index 63dc163a9..de54973d8 100755--- a/static-build/test/static-build/exports.test.lua
+++ b/static-buil= d/test/static-build/exports.test.lua
@@ -8,19 +8,13 @@ ffi.cdef([[
= =C2=A0
=C2=A0local test =3D tap.test('exports')
=C2=A0
--local RTLD_DEFAULT
=C2=A0-- See `man 3 dlsym`:
=C2=A0-- RTLD_DEFAU= LT
--- =C2=A0 Find =C2=A0the =C2=A0first occurrence of the desired symbo= l using the default
--- =C2=A0 shared object search order.=C2=A0 The sea= rch will include global symbols
+-- =C2=A0 Find the first occurrence of = the desired symbol using the default
+-- =C2=A0 shared object search ord= er. The search will include global symbols
=C2=A0-- =C2=A0 in the execut= able and its dependencies, as well as symbols in shared
=C2=A0-- =C2=A0 = objects that were dynamically loaded with the RTLD_GLOBAL flag.
-if jit.= os =3D=3D "OSX" then
- =C2=A0 =C2=A0RTLD_DEFAULT =3D ffi.cast(= "void *", -2LL)
-else
- =C2=A0 =C2=A0RTLD_DEFAULT =3D ffi.c= ast("void *", 0LL)
-end
+local RTLD_DEFAULT =3D ffi.cast(&q= uot;void *", jit.os =3D=3D "OSX" and -2LL or 0LL)
=C2=A0<= br>=C2=A0local function check_symbol(sym)
=C2=A0 =C2=A0 =C2=A0test:ok(ff= i.C.dlsym(RTLD_DEFAULT, sym) ~=3D nil, ('Symbol %q found'):format(s= ym))
diff --git a/static-build/test/static-build/suite.ini b/static-buil= d/test/static-build/suite.ini
deleted file mode 100644
index 5aabadd9= 2..000000000
--- a/static-build/test/static-build/suite.ini
+++ /dev/= null
@@ -1,4 +0,0 @@
-[default]
-core =3D app
-description =3D = Static build tests
-is_parallel =3D True
diff --git a/static-build/te= st/test-run.py b/static-build/test/test-run.py
deleted file mode 120000<= br>index 02187cdc5..000000000
--- a/static-build/test/test-run.py
+++= /dev/null
@@ -1 +0,0 @@
-../../test-run/test-run.py
\ No new= line at end of file


=D0=BF=D1=82, 4 =D1=81=D0=B5=D0=BD= =D1=82. 2020 =D0=B3. =D0=B2 20:52, Igor Munkin <imun@tarantool.org>:
Hello,

Thanks for the patch! It's strange to me why this patch is not reviewed=
by Sasha Ti., though there are many changes in the build and testing
infrastructure. Nevertheless, please consider my comments below.

On 25.08.20, HustonMmmavr wrote:
> From: Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com>
>
> Refactored static build process to use static-build/CMakeLists.txt
> instead of Dockerfile.staticbuild (this allows to support static
> build on macOS). Following third-party dependencies for static build > are installed via cmake `ExternalProject_Add`:
>=C2=A0 =C2=A0- OpenSSL
>=C2=A0 =C2=A0- Zlib
>=C2=A0 =C2=A0- Ncurses
>=C2=A0 =C2=A0- Readline
>=C2=A0 =C2=A0- Unwind
>=C2=A0 =C2=A0- ICU
>
> * Added support static build for macOS
> * Prevented linking tarantool binary with system libcurses (which is >=C2=A0 =C2=A0entire copy of libncurses) by setting flag `CURSES_NEED_NC= URSES`
>=C2=A0 =C2=A0to TRUE at file cmake/FindReadline.cmake. (This flag defin= ed at
>=C2=A0 =C2=A0FindCurses.cmake module and it's a workaround for link= ing with
>=C2=A0 =C2=A0correct library)
> * Fixed `CONFIGURE_COMMAND` while building bundled libcurl for staic
Typo: s/staic/static/.

>=C2=A0 =C2=A0build at file cmake/BuildLibCURL.cmake:
>=C2=A0 =C2=A0 =C2=A0- disable building shared libcurl libraries (by set= ting
>=C2=A0 =C2=A0 =C2=A0 =C2=A0`--disable-shared` option)
>=C2=A0 =C2=A0 =C2=A0- disable hiding libcurl symbols (by setting
>=C2=A0 =C2=A0 =C2=A0 =C2=A0`--disable-symbol-hiding` option)
>=C2=A0 =C2=A0 =C2=A0- prevent linking libcurl with system libz by setti= gn

Typo: s/settign/setting/.

>=C2=A0 =C2=A0 =C2=A0 =C2=A0`--with-zlib=3D${FOUND_ZLIB_ROOT_DIR}` optio= n)
> * Removed Dockerfile.staticbuild
> * Added new gitlab.ci jobs to test new style static build:
>=C2=A0 =C2=A0- static_build_cmake_linux
>=C2=A0 =C2=A0- static_build_cmake_osx_15
> * Removed static_docker_build gitlab.ci job
>
> Closes #5095
> ---
>=C2=A0 .gitlab-ci.yml=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 11 += -
>=C2=A0 .travis.mk=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 = 52 +++-
>=C2=A0 Dockerfile.staticbuild=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 98 -------
>=C2=A0 cmake/BuildLibCURL.cmake=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 18 +-
>=C2=A0 cmake/FindReadline.cmake=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 10 +
>=C2=A0 cmake/compiler.cmake=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 24 +-
>=C2=A0 cmake/os.cmake=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= =A05 +-
>=C2=A0 static-build/.gitignore=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=A04 +
>=C2=A0 static-build/CMakeLists.txt=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 240 ++++++++++++++++++
>=C2=A0 static-build/README.md=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 58 +++++
>=C2=A0 static-build/test/CheckDependencies.cmake=C2=A0 =C2=A0 =C2=A0|= =C2=A0 43 ++++
>=C2=A0 static-build/test/static-build/box.lua=C2=A0 =C2=A0 =C2=A0 =C2= =A0 |=C2=A0 =C2=A03 +
>=C2=A0 .../test/static-build/exports.test.lua=C2=A0 =C2=A0 =C2=A0 =C2= =A0 | 148 +++++++++++
>=C2=A0 static-build/test/static-build/suite.ini=C2=A0 =C2=A0 =C2=A0 |= =C2=A0 =C2=A05 +
>=C2=A0 .../test/static-build/traceback.test.lua=C2=A0 =C2=A0 =C2=A0 |= =C2=A0 15 ++
>=C2=A0 static-build/test/test-run.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A01 +
>=C2=A0 16 files changed, 608 insertions(+), 127 deletions(-)
>=C2=A0 delete mode 100644 Dockerfile.staticbuild
>=C2=A0 create mode 100644 static-build/.gitignore
>=C2=A0 create mode 100644 static-build/CMakeLists.txt
>=C2=A0 create mode 100644 static-build/README.md
>=C2=A0 create mode 100644 static-build/test/CheckDependencies.cmake
>=C2=A0 create mode 100755 static-build/test/static-build/box.lua
>=C2=A0 create mode 100755 static-build/test/static-build/exports.test.l= ua
>=C2=A0 create mode 100644 static-build/test/static-build/suite.ini
>=C2=A0 create mode 100755 static-build/test/static-build/traceback.test= .lua
>=C2=A0 create mode 120000 static-build/test/test-run.py
>

<snipped>

> diff --git a/.travis.mk b/.travis.mk
> index efc05cf05..482672429 100644
> --- a/.travis.mk
> +++ b/.travis.mk
> @@ -148,8 +148,12 @@ deps_debian_static:
>=C2=A0 test_static_build: deps_debian_static
>=C2=A0 =C2=A0 =C2=A0 =C2=A0CMAKE_EXTRA_PARAMS=3D-DBUILD_STATIC=3DON mak= e -f .tra= vis.mk test_debian_no_deps
>=C2=A0
> -test_static_docker_build:
> -=C2=A0 =C2=A0 =C2=A0docker build --no-cache --network=3Dhost --build-= arg RUN_TESTS=3DON -f Dockerfile.staticbuild .
> +# New static build
> +# builddir used in this target - is a default build path from cmake E= xternalProject_Add()

The comment exceeds 80 symbols.

> +test_static_build_cmake_linux:

<snipped>

> diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake
> index 5f8b15a63..365c14284 100644
> --- a/cmake/BuildLibCURL.cmake
> +++ b/cmake/BuildLibCURL.cmake
> @@ -4,15 +4,20 @@ macro(curl_build)

<snipped>

>=C2=A0 =C2=A0 =C2=A0 if (BUILD_STATIC)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 set(LIBZ_LIB_NAME libz.a)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 find_library(LIBZ_LIBRARY NAMES libz.a) >=C2=A0 =C2=A0 =C2=A0 else()
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 set(LIBZ_LIB_NAME z)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 find_library(LIBZ_LIBRARY NAMES z)
>=C2=A0 =C2=A0 =C2=A0 endif()
> -=C2=A0 =C2=A0 find_library(LIBZ_LIBRARY NAMES ${LIBZ_LIB_NAME})

Well... What is the difference from the previous approach?

> -=C2=A0 =C2=A0 if ("${LIBZ_LIBRARY}" STREQUAL "LIBZ_LIB= RARY-NOTFOUND")
> +=C2=A0 =C2=A0 message(STATUS "Looking for libz - ${LIBZ_LIBRARY}= ")
> +

<snipped>

> diff --git a/static-build/.gitignore b/static-build/.gitignore
> new file mode 100644
> index 000000000..c8028a870
> --- /dev/null
> +++ b/static-build/.gitignore

Minor: Why did you introduce a separate .gitignore instead of adjusting
the root one?

> @@ -0,0 +1,4 @@

<snipped>

> diff --git a/static-build/CMakeLists.txt b/static-build/CMakeLists.txt=
> new file mode 100644
> index 000000000..d90a642e6
> --- /dev/null
> +++ b/static-build/CMakeLists.txt
> @@ -0,0 +1,240 @@
> +cmake_minimum_required(VERSION 2.8)
> +
> +project(tarantool-env NONE)

Minor: Why is the name tarantool-env and not e.g. tarantool-static?

> +

<snipped>

> +
> +if (APPLE)
> +=C2=A0 =C2=A0 find_program(C_COMPILER clang)
> +=C2=A0 =C2=A0 find_program(CXX_COMPILER clang++)
> +else()
> +=C2=A0 =C2=A0 find_program(C_COMPILER gcc)
> +=C2=A0 =C2=A0 find_program(CXX_COMPILER g++)
> +endif()
> +set(CMAKE_C_COMPILER ${C_COMPILER})
> +set(CMAKE_CXX_COMPILER ${CXX_COMPILER})

I see you've added a comment for this passage, *but* at least for me Sasha's comment is still left unaddressed. AFAICS Sasha asked whether w= e
can solve the linkage issue by explicitly setting CMAKE_C{,XX}_COMPILER
variables. If the problem isn't fixed this way, then I guess your
solution is fine.

> +
> +# Install all libraries required by tarantool at current build dir > +

<snipped>

> +#
> +# ICU
> +#
> +ExternalProject_Add(icu
> +=C2=A0 =C2=A0 URL https://github.com/unicode-org/icu/releases/download/release-62-1/i= cu4c-62_1-src.tgz
> +=C2=A0 =C2=A0 CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 CXX=3D${CMAKE_CXX_COMPILER}

OK, I see, you've already set the variables I mentioned above. Anyway,<= br> please mention this fact if it doesn't fix the linkage issue (maybe
refer the corresponding place in libicu configure / the issue / etc).

> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 <SOURCE_DIR>/source/configure
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 --with-data-packaging=3Dstatic
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 --prefix=3D<INSTALL_DIR>
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 --disable-shared
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 --enable-static
> +)
> +
> +#
> +# ZLIB
> +#
> +ExternalProject_Add(zlib
> +=C2=A0 =C2=A0 URL https://zlib.net/zlib-${ZLIB= _VERSION}.tar.gz
> +=C2=A0 =C2=A0 CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 <SOURCE_DIR>/configure
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 --prefix=3D<INSTALL_DIR>
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 --static
> +=C2=A0 =C2=A0 TEST_COMMAND ${CMAKE_MAKE_PROGRAM} check

This TEST_COMMAND line looks odd and I guess it need some commenting
with the rationale, since other commands don't have it.

> +)
> +

<snipped>

> +
> +#
> +# ReadLine
> +#
> +ExternalProject_Add(readline
> +=C2=A0 =C2=A0 URL http= s://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz
> +=C2=A0 =C2=A0 CONFIGURE_COMMAND CC=3D${CMAKE_C_COMPILER}
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 <SOURCE_DIR>/configure
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 --prefix=3D<INSTALL_DIR>
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 --disable-shared
> +=C2=A0 =C2=A0 # STEP_TARGETS download

Looks like this line can be dropped.

> +)
> +

<snipped>

> diff --git a/static-build/README.md b/static-build/README.md
> new file mode 100644
> index 000000000..0019e963f
> --- /dev/null
> +++ b/static-build/README.md
> @@ -0,0 +1,58 @@
> +# Tarantool static build tooling
> +
> +These files help to prepare environment for building Tarantool
> +statically. And builds it.
> +
> +## Prerequisites
> +
> +CentOS:

Minor: Does this mean that other distros are not supported?

> +
> +```bash
> +yum install -y \
> +=C2=A0 =C2=A0 git perl gcc cmake make gcc-c++ libstdc++-static autoco= nf automake libtool \
> +=C2=A0 =C2=A0 python-msgpack python-yaml python-argparse python-six p= ython-gevent
> +```
> +
> +MacOS:
> +
> +Before you start please install default Xcode Tools by Apple:
> +
> +```

Typo: bash specifier is missing (considering verbatim blocks below).

> +sudo xcode-select --install
> +sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer<= br> > +```
> +
> +Install brew using command from
> +[Homebrew repository instructions](https://github.com/Homebrew= /inst)
> +
> +After that run next script:
> +
> +```bash
> +=C2=A0 brew install autoconf automake libtool cmake file://$${PWD}/to= ols/brew_taps/tntpython2.rbs
> +=C2=A0 pip install --force-reinstall -r test-run/requirements.txt

Typo: Looks like misindentation.

> +```
> +
> +### Usage

Typo: I guess it should be h2, not h3.

> +
> +```bash
> +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`:

Typo: s/is/are/.

> +* Debug - default
> +* Release
> +* RelWithDebInfo
> +
> +And you want to build tarantool with RelWithDebInfo:
> +
> +```bash
> +cmake -DCMAKE_TARANTOOL_ARGS=3D"-DCMAKE_BUILD_TYPE=3DRelWithDebI= nfo" .
> +```

<snipped>

> diff --git a/static-build/test/static-build/exports.test.lua b/static-= build/test/static-build/exports.test.lua
> new file mode 100755
> index 000000000..63dc163a9
> --- /dev/null
> +++ b/static-build/test/static-build/exports.test.lua
> @@ -0,0 +1,148 @@

<snipped>

> +
> +local RTLD_DEFAULT
> +-- See `man 3 dlsym`:
> +-- RTLD_DEFAULT
> +--=C2=A0 =C2=A0Find=C2=A0 the=C2=A0 first occurrence of the desired s= ymbol using the default
> +--=C2=A0 =C2=A0shared object search order.=C2=A0 The search will incl= ude global symbols

Typo: There are several places above with doubled whitespace.

> +--=C2=A0 =C2=A0in the executable and its dependencies, as well as sym= bols in shared
> +--=C2=A0 =C2=A0objects that were dynamically loaded with the RTLD_GLO= BAL flag.
> +if jit.os =3D=3D "OSX" then
> +=C2=A0 =C2=A0 RTLD_DEFAULT =3D ffi.cast("void *", -2LL)
> +else
> +=C2=A0 =C2=A0 RTLD_DEFAULT =3D ffi.cast("void *", 0LL)
> +end

Minor: OK, since the difference is only in the constant value, the
following way looks more convenient to me:
| local RTLD_DEFAULT =3D ffi.cast("void *", jit.os =3D=3D "O= SX" and -2LL or 0LL)

> +

<snipped>

> --
> 2.26.2
>

--
Best regards,
IM
--000000000000fff37005aee28fc7--