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