Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile
@ 2019-12-10 11:21 Alexander V. Tikhonov
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander V. Tikhonov @ 2019-12-10 11:21 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches

Fixed static build with '-DBUILD_STATIC=ON' option:

 - installed liblzma-dev library for libunwind static, due to found that
   static libunwind library uses undefined lzma functions:
     nm -a /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a | grep lzma
                 U lzma_index_buffer_decode
                 U lzma_index_end
                 U lzma_index_size
                 U lzma_index_uncompressed_size
                 U lzma_stream_buffer_decode
                 U lzma_stream_footer_decode
   while dynamic libunwind correctly sees liblzma installed:
     ldd /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so | grep lzma
       liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8fd1c23000)
   so to fix it the static library of lzma was needed.

 - added lzma library to unwind library for Tarantool build at file:
     cmake/compiler.cmake
   due to fail:
     /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
       In function `xz_uncompressed_size':
     ./src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
     ./src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
     ./src/elfxx.c:205: undefined reference to `lzma_index_size'
     ./src/elfxx.c:210: undefined reference to `lzma_index_end'
     ./src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
     ./src/elfxx.c:210: undefined reference to `lzma_index_end'
     /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
       In function `_Uelf64_extract_minidebuginfo':
     ./src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
     collect2: error: ld returned 1 exit status
     test/unit/CMakeFiles/luaL_iterator.test.dir/build.make:134:
       recipe for target 'test/unit/luaL_iterator.test' failed
     make[2]: *** [test/unit/luaL_iterator.test] Error 1

 - added dl library to gomp library for test/unit tests
   binaries builds at file:
     cmake/BuildMisc.cmake
   due to fail:
     /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o):(.text+0x34d):
       more undefined references to `dlsym' follow
     /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): In function
       `gomp_target_init':
     (.text+0x9cc): undefined reference to `dlerror'
     collect2: error: ld returned 1 exit status

  - added dl library to icu library for test/unit tests
   binaries builds at file:
     cmake/FindICU.cmake
   due to fail:
     /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
       In function `uprv_dl_open_60':
     (.text+0x1ce2): undefined reference to `dlopen'
     /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
       In function `uprv_dlsym_func_60':
     (.text+0x1d3d): undefined reference to `dlsym'
     /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
       In function `uprv_dl_close_60':
     (.text+0x1d21): undefined reference to `dlclose'
     collect2: error: ld returned 1 exit status

Added static build to gitlab-ci in release check criteria named
as static_build job. Previously named static_build job renamed to
static_docker_build, due to it checks the build at Dockerfile.

Close #4551
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4551-static-build-full-ci
Issue: https://github.com/tarantool/tarantool/issues/4551

 .gitlab-ci.yml        | 12 +++++++++++-
 .gitlab.mk            |  7 ++++++-
 cmake/BuildMisc.cmake |  2 +-
 cmake/FindICU.cmake   |  2 +-
 cmake/compiler.cmake  | 11 +++++++++++
 5 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3af5a3c8a..1060bb84c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -236,9 +236,19 @@ debian_10:
     OS: 'debian'
     DIST: 'buster'
 
+# Static builds
+
 static_build:
+  <<: *release_only_definition
+  <<: *docker_test_definition
+  variables:
+    CMAKE_EXTRA_PARAMS: '-DBUILD_STATIC=ON'
+  script:
+    - ${GITLAB_MAKE} static_build
+
+static_docker_build:
   <<: *deploy_test_definition
   variables:
     RUN_TESTS: 'ON'
   script:
-    - ${GITLAB_MAKE} static_build
+    - ${GITLAB_MAKE} static_docker_build
diff --git a/.gitlab.mk b/.gitlab.mk
index 48a92e518..a5d4ec26e 100644
--- a/.gitlab.mk
+++ b/.gitlab.mk
@@ -110,5 +110,10 @@ package: git_submodule_update
 # Static build
 # ############
 
-static_build:
+deps_debian_static:
+	apt install -y -f liblzma-dev
+
+static_build: deps_debian_static test_debian_no_deps
+
+static_docker_build:
 	docker build --network=host --build-arg RUN_TESTS="${RUN_TESTS}" -f Dockerfile.staticbuild .
diff --git a/cmake/BuildMisc.cmake b/cmake/BuildMisc.cmake
index b4a3ca1fc..0c571f326 100644
--- a/cmake/BuildMisc.cmake
+++ b/cmake/BuildMisc.cmake
@@ -39,7 +39,7 @@ macro(libmisc_build)
         else()
             set(GOMP_LIBRARY gomp)
         endif()
-        target_link_libraries(misc ${GOMP_LIBRARY} pthread)
+        target_link_libraries(misc ${GOMP_LIBRARY} pthread dl)
     endif()
 
     unset(misc_src)
diff --git a/cmake/FindICU.cmake b/cmake/FindICU.cmake
index 26f0683f3..2bb9a5d59 100644
--- a/cmake/FindICU.cmake
+++ b/cmake/FindICU.cmake
@@ -50,7 +50,7 @@ include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(ICU
     REQUIRED_VARS ICU_INCLUDE_DIR ICU_LIBRARY_I18N ICU_LIBRARY_UC)
 set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
-set(ICU_LIBRARIES ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_UC} ${ICU_LIBRARY_DATA})
+set(ICU_LIBRARIES ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_UC} ${ICU_LIBRARY_DATA} dl)
 mark_as_advanced(ICU_INCLUDE_DIR ICU_INCLUDE_DIRS
         ICU_LIBRARY_I18N ICU_LIBRARY_UC ICU_LIBRARIES)
 
diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index c9ad2b092..56429dc20 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -171,6 +171,17 @@ if (ENABLE_BACKTRACE)
             NAMES ${UNWIND_PLATFORM_LIB_NAME})
         set(UNWIND_LIBRARIES ${UNWIND_PLATFORM_LIBRARY} ${UNWIND_LIBRARY})
     endif()
+    if (BUILD_STATIC)
+        # some versions of libunwind need liblzma, and we don't use pkg-config
+        # so we just look whether liblzma is installed, and add it if it is.
+        # It might not be actually needed, but doesn't hurt if it is not.
+        # We don't need any headers, just the lib, as it's privately needed.
+        find_library(LZMA_LIBRARY PATH_SUFFIXES system NAMES liblzma.a)
+        if (NOT LZMA_LIBRARY STREQUAL "LZMA_LIBRARY-NOTFOUND")
+            message(STATUS "liblzma found")
+            set(UNWIND_LIBRARIES ${UNWIND_LIBRARIES} ${LZMA_LIBRARY})
+        endif()
+    endif()
     find_package_message(UNWIND_LIBRARIES "Found unwind" "${UNWIND_LIBRARIES}")
 endif()
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile
  2020-04-02 10:40 ` Kirill Yukhin
@ 2020-04-02 11:24   ` Kirill Yukhin
  0 siblings, 0 replies; 8+ messages in thread
From: Kirill Yukhin @ 2020-04-02 11:24 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

Hello,

On 02 апр 13:40, Kirill Yukhin wrote:
> Hello,
> 
> On 10 дек 16:11, Alexander V. Tikhonov wrote:
> > Fixed static build with '-DBUILD_STATIC=ON' option:
> > 
> >  - installed liblzma-dev library for libunwind static, due to found that
> >    static libunwind library uses undefined lzma functions:
> >      nm -a /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a | grep lzma
> >                  U lzma_index_buffer_decode
> >                  U lzma_index_end
> >                  U lzma_index_size
> >                  U lzma_index_uncompressed_size
> >                  U lzma_stream_buffer_decode
> >                  U lzma_stream_footer_decode
> >    while dynamic libunwind correctly sees liblzma installed:
> >      ldd /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so | grep lzma
> >        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8fd1c23000)
> >    so to fix it the static library of lzma was needed.
> > 
> >  - added lzma library to unwind library for Tarantool build at file:
> >      cmake/compiler.cmake
> >    due to fail:
> >      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
> >        In function `xz_uncompressed_size':
> >      ./src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
> >      ./src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
> >      ./src/elfxx.c:205: undefined reference to `lzma_index_size'
> >      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
> >      ./src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
> >      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
> >      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
> >        In function `_Uelf64_extract_minidebuginfo':
> >      ./src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
> >      collect2: error: ld returned 1 exit status
> >      test/unit/CMakeFiles/luaL_iterator.test.dir/build.make:134:
> >        recipe for target 'test/unit/luaL_iterator.test' failed
> >      make[2]: *** [test/unit/luaL_iterator.test] Error 1
> > 
> >  - added dl library to gomp library for test/unit tests
> >    binaries builds at file:
> >      cmake/BuildMisc.cmake
> >    due to fail:
> >      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o):(.text+0x34d):
> >        more undefined references to `dlsym' follow
> >      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): In function
> >        `gomp_target_init':
> >      (.text+0x9cc): undefined reference to `dlerror'
> >      collect2: error: ld returned 1 exit status
> > 
> >   - added dl library to icu library for test/unit tests
> >    binaries builds at file:
> >      cmake/FindICU.cmake
> >    due to fail:
> >      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
> >        In function `uprv_dl_open_60':
> >      (.text+0x1ce2): undefined reference to `dlopen'
> >      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
> >        In function `uprv_dlsym_func_60':
> >      (.text+0x1d3d): undefined reference to `dlsym'
> >      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
> >        In function `uprv_dl_close_60':
> >      (.text+0x1d21): undefined reference to `dlclose'
> >      collect2: error: ld returned 1 exit status
> > 
> > Added static build to gitlab-ci in release check criteria named
> > as static_build job. Previously named static_build job renamed to
> > static_docker_build, due to it checks the build at Dockerfile.
> > 
> > Also moved static build make targets from .gitlab.mk to .travis.mk
> > to store it in common place with the other test/build make targets.
> > Moved environement from .gitlab-ci.yml file into make targets to
> > make this targets true building in static w/o additional setup.
> > 
> > Close #4551
> > ---
> > 
> > Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4551-static-build-full-ci
> > Issue: https://github.com/tarantool/tarantool/issues/4551
> 
> I've checked your patch into 2.3 and master.

Also backported to 2.2 and 1.10.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile
  2019-12-10 13:11 Alexander V. Tikhonov
  2019-12-19 12:43 ` Igor Munkin
@ 2020-04-02 10:40 ` Kirill Yukhin
  2020-04-02 11:24   ` Kirill Yukhin
  1 sibling, 1 reply; 8+ messages in thread
From: Kirill Yukhin @ 2020-04-02 10:40 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

Hello,

On 10 дек 16:11, Alexander V. Tikhonov wrote:
> Fixed static build with '-DBUILD_STATIC=ON' option:
> 
>  - installed liblzma-dev library for libunwind static, due to found that
>    static libunwind library uses undefined lzma functions:
>      nm -a /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a | grep lzma
>                  U lzma_index_buffer_decode
>                  U lzma_index_end
>                  U lzma_index_size
>                  U lzma_index_uncompressed_size
>                  U lzma_stream_buffer_decode
>                  U lzma_stream_footer_decode
>    while dynamic libunwind correctly sees liblzma installed:
>      ldd /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so | grep lzma
>        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8fd1c23000)
>    so to fix it the static library of lzma was needed.
> 
>  - added lzma library to unwind library for Tarantool build at file:
>      cmake/compiler.cmake
>    due to fail:
>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
>        In function `xz_uncompressed_size':
>      ./src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
>      ./src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
>      ./src/elfxx.c:205: undefined reference to `lzma_index_size'
>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
>      ./src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
>        In function `_Uelf64_extract_minidebuginfo':
>      ./src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
>      collect2: error: ld returned 1 exit status
>      test/unit/CMakeFiles/luaL_iterator.test.dir/build.make:134:
>        recipe for target 'test/unit/luaL_iterator.test' failed
>      make[2]: *** [test/unit/luaL_iterator.test] Error 1
> 
>  - added dl library to gomp library for test/unit tests
>    binaries builds at file:
>      cmake/BuildMisc.cmake
>    due to fail:
>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o):(.text+0x34d):
>        more undefined references to `dlsym' follow
>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): In function
>        `gomp_target_init':
>      (.text+0x9cc): undefined reference to `dlerror'
>      collect2: error: ld returned 1 exit status
> 
>   - added dl library to icu library for test/unit tests
>    binaries builds at file:
>      cmake/FindICU.cmake
>    due to fail:
>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>        In function `uprv_dl_open_60':
>      (.text+0x1ce2): undefined reference to `dlopen'
>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>        In function `uprv_dlsym_func_60':
>      (.text+0x1d3d): undefined reference to `dlsym'
>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>        In function `uprv_dl_close_60':
>      (.text+0x1d21): undefined reference to `dlclose'
>      collect2: error: ld returned 1 exit status
> 
> Added static build to gitlab-ci in release check criteria named
> as static_build job. Previously named static_build job renamed to
> static_docker_build, due to it checks the build at Dockerfile.
> 
> Also moved static build make targets from .gitlab.mk to .travis.mk
> to store it in common place with the other test/build make targets.
> Moved environement from .gitlab-ci.yml file into make targets to
> make this targets true building in static w/o additional setup.
> 
> Close #4551
> ---
> 
> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4551-static-build-full-ci
> Issue: https://github.com/tarantool/tarantool/issues/4551

I've checked your patch into 2.3 and master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile
  2019-12-19 16:53   ` Alexander Tikhonov
  2019-12-19 16:55     ` Alexander Tikhonov
@ 2020-04-01  9:59     ` Sergey Bronnikov
  1 sibling, 0 replies; 8+ messages in thread
From: Sergey Bronnikov @ 2020-04-01  9:59 UTC (permalink / raw)
  To: Alexander Tikhonov; +Cc: tarantool-patches

LGTM

On 19:53 Thu 19 Dec , Alexander Tikhonov wrote:
> 
> 
> 
> >Четверг, 19 декабря 2019, 15:45 +03:00 от Igor Munkin <imun@tarantool.org>:
> >
> >Sasha,
> >
> >Thanks, LGTM. Please consider several side notes below.
> >
> >On 10.12.19, Alexander V. Tikhonov wrote:
> >> Fixed static build with '-DBUILD_STATIC=ON' option:
> >> 
> >>  - installed liblzma-dev library for libunwind static, due to found that
> >>    static libunwind library uses undefined lzma functions:
> >>      nm -a /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a | grep lzma
> >>                  U lzma_index_buffer_decode
> >>                  U lzma_index_end
> >>                  U lzma_index_size
> >>                  U lzma_index_uncompressed_size
> >>                  U lzma_stream_buffer_decode
> >>                  U lzma_stream_footer_decode
> >>    while dynamic libunwind correctly sees liblzma installed:
> >>      ldd /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so | grep lzma
> >>        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8fd1c23000)
> >>    so to fix it the static library of lzma was needed.
> >> 
> >>  - added lzma library to unwind library for Tarantool build at file:
> >>      cmake/compiler.cmake
> >>    due to fail:
> >>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
> >>        In function `xz_uncompressed_size':
> >>      ./src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
> >>      ./src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
> >>      ./src/elfxx.c:205: undefined reference to `lzma_index_size'
> >>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
> >>      ./src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
> >>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
> >>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
> >>        In function `_Uelf64_extract_minidebuginfo':
> >>      ./src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
> >>      collect2: error: ld returned 1 exit status
> >>      test/unit/CMakeFiles/luaL_iterator.test.dir/build.make:134:
> >>        recipe for target 'test/unit/luaL_iterator.test' failed
> >>      make[2]: *** [test/unit/luaL_iterator.test] Error 1
> >> 
> >>  - added dl library to gomp library for test/unit tests
> >>    binaries builds at file:
> >>      cmake/BuildMisc.cmake
> >>    due to fail:
> >>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o):(.text+0x34d):
> >>        more undefined references to `dlsym' follow
> >>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): In function
> >>        `gomp_target_init':
> >>      (.text+0x9cc): undefined reference to `dlerror'
> >>      collect2: error: ld returned 1 exit status
> >> 
> >>   - added dl library to icu library for test/unit tests
> >>    binaries builds at file:
> >>      cmake/FindICU.cmake
> >>    due to fail:
> >>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
> >>        In function `uprv_dl_open_60':
> >>      (.text+0x1ce2): undefined reference to `dlopen'
> >>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
> >>        In function `uprv_dlsym_func_60':
> >>      (.text+0x1d3d): undefined reference to `dlsym'
> >>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
> >>        In function `uprv_dl_close_60':
> >>      (.text+0x1d21): undefined reference to `dlclose'
> >>      collect2: error: ld returned 1 exit status
> >> 
> >> Added static build to gitlab-ci in release check criteria named
> >> as static_build job. Previously named static_build job renamed to
> >> static_docker_build, due to it checks the build at Dockerfile.
> >> 
> >> Also moved static build make targets from .gitlab.mk to .travis.mk
> >> to store it in common place with the other test/build make targets.
> >> Moved environement from .gitlab-ci.yml file into make targets to
> >> make this targets true building in static w/o additional setup.
> >> 
> >> Close #4551
> >> ---
> >> 
> >> Github:  https://github.com/tarantool/tarantool/tree/avtikhon/gh-4551-static-build-full-ci
> >> Issue:  https://github.com/tarantool/tarantool/issues/4551
> >> 
> >>  .gitlab-ci.yml        | 12 +++++++++---
> >>  .gitlab.mk            |  9 +--------
> >>  .travis.mk            | 16 ++++++++++++++++
> >>  cmake/BuildMisc.cmake |  2 +-
> >>  cmake/FindICU.cmake   |  2 +-
> >>  cmake/compiler.cmake  | 11 +++++++++++
> >>  6 files changed, 39 insertions(+), 13 deletions(-)
> >
> ><snipped>
> >
> >>  # Pass *_no_deps goals to .travis.mk.
> >> -test_%_no_deps: git_submodule_update
> >> +test_%: git_submodule_update
> >>  	${TRAVIS_MAKE} $@
> >> 
> >
> >Side note: As discussed offline, please create a ticket for the
> >follow up activity to reduce a mess with the make target naming.
> Right, created the issue
> https://github.com/tarantool/tarantool/issues/4694
> >
> >>  # #######################################################
> >
> ><snipped>
> >
> >> diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
> >> index c9ad2b092..56429dc20 100644
> >> --- a/cmake/compiler.cmake
> >> +++ b/cmake/compiler.cmake
> >> @@ -171,6 +171,17 @@ if (ENABLE_BACKTRACE)
> >>              NAMES ${UNWIND_PLATFORM_LIB_NAME})
> >>          set(UNWIND_LIBRARIES ${UNWIND_PLATFORM_LIBRARY} ${UNWIND_LIBRARY})
> >>      endif()
> >> +    if (BUILD_STATIC)
> >> +        # some versions of libunwind need liblzma, and we don't use pkg-config
> >> +        # so we just look whether liblzma is installed, and add it if it is.
> >> +        # It might not be actually needed, but doesn't hurt if it is not.
> >> +        # We don't need any headers, just the lib, as it's privately needed.
> >> +        find_library(LZMA_LIBRARY PATH_SUFFIXES system NAMES liblzma.a)
> >> +        if (NOT LZMA_LIBRARY STREQUAL "LZMA_LIBRARY-NOTFOUND")
> >> +            message(STATUS "liblzma found")
> >> +            set(UNWIND_LIBRARIES ${UNWIND_LIBRARIES} ${LZMA_LIBRARY})
> >> +        endif()
> >> +    endif()
> >
> >Side note: We discussed offline with Sasha Tu. whether there is a better
> >way to maintain such indirect dependencies and decided to proceed with
> >the research within a separate issue.
> Sure, created issue
> https://github.com/tarantool/tarantool/issues/4695
> >
> >>      find_package_message(UNWIND_LIBRARIES "Found unwind" "${UNWIND_LIBRARIES}")
> >>  endif()
> >> 
> >> -- 
> >> 2.17.1
> >> 
> >
> >-- 
> >Best regards,
> >IM
> 
> 
> -- 
> Alexander Tikhonov

-- 
sergeyb@

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile
  2019-12-19 16:53   ` Alexander Tikhonov
@ 2019-12-19 16:55     ` Alexander Tikhonov
  2020-04-01  9:59     ` Sergey Bronnikov
  1 sibling, 0 replies; 8+ messages in thread
From: Alexander Tikhonov @ 2019-12-19 16:55 UTC (permalink / raw)
  To: Igor Munkin; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 6465 bytes --]

Igor, thanks for the review, I've created 2 issues as you suggested.


>Четверг, 19 декабря 2019, 19:53 +03:00 от Alexander Tikhonov <avtikhon@tarantool.org>:
>
>
>
>
>>Четверг, 19 декабря 2019, 15:45 +03:00 от Igor Munkin < imun@tarantool.org >:
>>
>>Sasha,
>>
>>Thanks, LGTM. Please consider several side notes below.
>>
>>On 10.12.19, Alexander V. Tikhonov wrote:
>>> Fixed static build with '-DBUILD_STATIC=ON' option:
>>> 
>>>  - installed liblzma-dev library for libunwind static, due to found that
>>>    static libunwind library uses undefined lzma functions:
>>>      nm -a /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a | grep lzma
>>>                  U lzma_index_buffer_decode
>>>                  U lzma_index_end
>>>                  U lzma_index_size
>>>                  U lzma_index_uncompressed_size
>>>                  U lzma_stream_buffer_decode
>>>                  U lzma_stream_footer_decode
>>>    while dynamic libunwind correctly sees liblzma installed:
>>>      ldd /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so | grep lzma
>>>        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8fd1c23000)
>>>    so to fix it the static library of lzma was needed.
>>> 
>>>  - added lzma library to unwind library for Tarantool build at file:
>>>      cmake/compiler.cmake
>>>    due to fail:
>>>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
>>>        In function `xz_uncompressed_size':
>>>      ./src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
>>>      ./src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
>>>      ./src/elfxx.c:205: undefined reference to `lzma_index_size'
>>>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
>>>      ./src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
>>>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
>>>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
>>>        In function `_Uelf64_extract_minidebuginfo':
>>>      ./src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
>>>      collect2: error: ld returned 1 exit status
>>>      test/unit/CMakeFiles/luaL_iterator.test.dir/build.make:134:
>>>        recipe for target 'test/unit/luaL_iterator.test' failed
>>>      make[2]: *** [test/unit/luaL_iterator.test] Error 1
>>> 
>>>  - added dl library to gomp library for test/unit tests
>>>    binaries builds at file:
>>>      cmake/BuildMisc.cmake
>>>    due to fail:
>>>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o):(.text+0x34d):
>>>        more undefined references to `dlsym' follow
>>>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): In function
>>>        `gomp_target_init':
>>>      (.text+0x9cc): undefined reference to `dlerror'
>>>      collect2: error: ld returned 1 exit status
>>> 
>>>   - added dl library to icu library for test/unit tests
>>>    binaries builds at file:
>>>      cmake/FindICU.cmake
>>>    due to fail:
>>>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>>>        In function `uprv_dl_open_60':
>>>      (.text+0x1ce2): undefined reference to `dlopen'
>>>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>>>        In function `uprv_dlsym_func_60':
>>>      (.text+0x1d3d): undefined reference to `dlsym'
>>>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>>>        In function `uprv_dl_close_60':
>>>      (.text+0x1d21): undefined reference to `dlclose'
>>>      collect2: error: ld returned 1 exit status
>>> 
>>> Added static build to gitlab-ci in release check criteria named
>>> as static_build job. Previously named static_build job renamed to
>>> static_docker_build, due to it checks the build at Dockerfile.
>>> 
>>> Also moved static build make targets from .gitlab.mk to .travis.mk
>>> to store it in common place with the other test/build make targets.
>>> Moved environement from .gitlab-ci.yml file into make targets to
>>> make this targets true building in static w/o additional setup.
>>> 
>>> Close #4551
>>> ---
>>> 
>>> Github:  https://github.com/tarantool/tarantool/tree/avtikhon/gh-4551-static-build-full-ci
>>> Issue:  https://github.com/tarantool/tarantool/issues/4551
>>> 
>>>  .gitlab-ci.yml        | 12 +++++++++---
>>>  .gitlab.mk            |  9 +--------
>>>  .travis.mk            | 16 ++++++++++++++++
>>>  cmake/BuildMisc.cmake |  2 +-
>>>  cmake/FindICU.cmake   |  2 +-
>>>  cmake/compiler.cmake  | 11 +++++++++++
>>>  6 files changed, 39 insertions(+), 13 deletions(-)
>>
>><snipped>
>>
>>>  # Pass *_no_deps goals to .travis.mk.
>>> -test_%_no_deps: git_submodule_update
>>> +test_%: git_submodule_update
>>>  	${TRAVIS_MAKE} $@
>>> 
>>
>>Side note: As discussed offline, please create a ticket for the
>>follow up activity to reduce a mess with the make target naming.
>Right, created the issue
>https://github.com/tarantool/tarantool/issues/4694
>>
>>>  # #######################################################
>>
>><snipped>
>>
>>> diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
>>> index c9ad2b092..56429dc20 100644
>>> --- a/cmake/compiler.cmake
>>> +++ b/cmake/compiler.cmake
>>> @@ -171,6 +171,17 @@ if (ENABLE_BACKTRACE)
>>>              NAMES ${UNWIND_PLATFORM_LIB_NAME})
>>>          set(UNWIND_LIBRARIES ${UNWIND_PLATFORM_LIBRARY} ${UNWIND_LIBRARY})
>>>      endif()
>>> +    if (BUILD_STATIC)
>>> +        # some versions of libunwind need liblzma, and we don't use pkg-config
>>> +        # so we just look whether liblzma is installed, and add it if it is.
>>> +        # It might not be actually needed, but doesn't hurt if it is not.
>>> +        # We don't need any headers, just the lib, as it's privately needed.
>>> +        find_library(LZMA_LIBRARY PATH_SUFFIXES system NAMES liblzma.a)
>>> +        if (NOT LZMA_LIBRARY STREQUAL "LZMA_LIBRARY-NOTFOUND")
>>> +            message(STATUS "liblzma found")
>>> +            set(UNWIND_LIBRARIES ${UNWIND_LIBRARIES} ${LZMA_LIBRARY})
>>> +        endif()
>>> +    endif()
>>
>>Side note: We discussed offline with Sasha Tu. whether there is a better
>>way to maintain such indirect dependencies and decided to proceed with
>>the research within a separate issue.
>Sure, created issue
>https://github.com/tarantool/tarantool/issues/4695
>>
>>>      find_package_message(UNWIND_LIBRARIES "Found unwind" "${UNWIND_LIBRARIES}")
>>>  endif()
>>> 
>>> -- 
>>> 2.17.1
>>> 
>>
>>-- 
>>Best regards,
>>IM
>
>
>-- 
>Alexander Tikhonov


-- 
Alexander Tikhonov

[-- Attachment #2: Type: text/html, Size: 9003 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile
  2019-12-19 12:43 ` Igor Munkin
@ 2019-12-19 16:53   ` Alexander Tikhonov
  2019-12-19 16:55     ` Alexander Tikhonov
  2020-04-01  9:59     ` Sergey Bronnikov
  0 siblings, 2 replies; 8+ messages in thread
From: Alexander Tikhonov @ 2019-12-19 16:53 UTC (permalink / raw)
  To: Igor Munkin; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 6110 bytes --]




>Четверг, 19 декабря 2019, 15:45 +03:00 от Igor Munkin <imun@tarantool.org>:
>
>Sasha,
>
>Thanks, LGTM. Please consider several side notes below.
>
>On 10.12.19, Alexander V. Tikhonov wrote:
>> Fixed static build with '-DBUILD_STATIC=ON' option:
>> 
>>  - installed liblzma-dev library for libunwind static, due to found that
>>    static libunwind library uses undefined lzma functions:
>>      nm -a /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a | grep lzma
>>                  U lzma_index_buffer_decode
>>                  U lzma_index_end
>>                  U lzma_index_size
>>                  U lzma_index_uncompressed_size
>>                  U lzma_stream_buffer_decode
>>                  U lzma_stream_footer_decode
>>    while dynamic libunwind correctly sees liblzma installed:
>>      ldd /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so | grep lzma
>>        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8fd1c23000)
>>    so to fix it the static library of lzma was needed.
>> 
>>  - added lzma library to unwind library for Tarantool build at file:
>>      cmake/compiler.cmake
>>    due to fail:
>>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
>>        In function `xz_uncompressed_size':
>>      ./src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
>>      ./src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
>>      ./src/elfxx.c:205: undefined reference to `lzma_index_size'
>>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
>>      ./src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
>>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
>>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
>>        In function `_Uelf64_extract_minidebuginfo':
>>      ./src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
>>      collect2: error: ld returned 1 exit status
>>      test/unit/CMakeFiles/luaL_iterator.test.dir/build.make:134:
>>        recipe for target 'test/unit/luaL_iterator.test' failed
>>      make[2]: *** [test/unit/luaL_iterator.test] Error 1
>> 
>>  - added dl library to gomp library for test/unit tests
>>    binaries builds at file:
>>      cmake/BuildMisc.cmake
>>    due to fail:
>>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o):(.text+0x34d):
>>        more undefined references to `dlsym' follow
>>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): In function
>>        `gomp_target_init':
>>      (.text+0x9cc): undefined reference to `dlerror'
>>      collect2: error: ld returned 1 exit status
>> 
>>   - added dl library to icu library for test/unit tests
>>    binaries builds at file:
>>      cmake/FindICU.cmake
>>    due to fail:
>>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>>        In function `uprv_dl_open_60':
>>      (.text+0x1ce2): undefined reference to `dlopen'
>>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>>        In function `uprv_dlsym_func_60':
>>      (.text+0x1d3d): undefined reference to `dlsym'
>>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>>        In function `uprv_dl_close_60':
>>      (.text+0x1d21): undefined reference to `dlclose'
>>      collect2: error: ld returned 1 exit status
>> 
>> Added static build to gitlab-ci in release check criteria named
>> as static_build job. Previously named static_build job renamed to
>> static_docker_build, due to it checks the build at Dockerfile.
>> 
>> Also moved static build make targets from .gitlab.mk to .travis.mk
>> to store it in common place with the other test/build make targets.
>> Moved environement from .gitlab-ci.yml file into make targets to
>> make this targets true building in static w/o additional setup.
>> 
>> Close #4551
>> ---
>> 
>> Github:  https://github.com/tarantool/tarantool/tree/avtikhon/gh-4551-static-build-full-ci
>> Issue:  https://github.com/tarantool/tarantool/issues/4551
>> 
>>  .gitlab-ci.yml        | 12 +++++++++---
>>  .gitlab.mk            |  9 +--------
>>  .travis.mk            | 16 ++++++++++++++++
>>  cmake/BuildMisc.cmake |  2 +-
>>  cmake/FindICU.cmake   |  2 +-
>>  cmake/compiler.cmake  | 11 +++++++++++
>>  6 files changed, 39 insertions(+), 13 deletions(-)
>
><snipped>
>
>>  # Pass *_no_deps goals to .travis.mk.
>> -test_%_no_deps: git_submodule_update
>> +test_%: git_submodule_update
>>  	${TRAVIS_MAKE} $@
>> 
>
>Side note: As discussed offline, please create a ticket for the
>follow up activity to reduce a mess with the make target naming.
Right, created the issue
https://github.com/tarantool/tarantool/issues/4694
>
>>  # #######################################################
>
><snipped>
>
>> diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
>> index c9ad2b092..56429dc20 100644
>> --- a/cmake/compiler.cmake
>> +++ b/cmake/compiler.cmake
>> @@ -171,6 +171,17 @@ if (ENABLE_BACKTRACE)
>>              NAMES ${UNWIND_PLATFORM_LIB_NAME})
>>          set(UNWIND_LIBRARIES ${UNWIND_PLATFORM_LIBRARY} ${UNWIND_LIBRARY})
>>      endif()
>> +    if (BUILD_STATIC)
>> +        # some versions of libunwind need liblzma, and we don't use pkg-config
>> +        # so we just look whether liblzma is installed, and add it if it is.
>> +        # It might not be actually needed, but doesn't hurt if it is not.
>> +        # We don't need any headers, just the lib, as it's privately needed.
>> +        find_library(LZMA_LIBRARY PATH_SUFFIXES system NAMES liblzma.a)
>> +        if (NOT LZMA_LIBRARY STREQUAL "LZMA_LIBRARY-NOTFOUND")
>> +            message(STATUS "liblzma found")
>> +            set(UNWIND_LIBRARIES ${UNWIND_LIBRARIES} ${LZMA_LIBRARY})
>> +        endif()
>> +    endif()
>
>Side note: We discussed offline with Sasha Tu. whether there is a better
>way to maintain such indirect dependencies and decided to proceed with
>the research within a separate issue.
Sure, created issue
https://github.com/tarantool/tarantool/issues/4695
>
>>      find_package_message(UNWIND_LIBRARIES "Found unwind" "${UNWIND_LIBRARIES}")
>>  endif()
>> 
>> -- 
>> 2.17.1
>> 
>
>-- 
>Best regards,
>IM


-- 
Alexander Tikhonov

[-- Attachment #2: Type: text/html, Size: 8151 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile
  2019-12-10 13:11 Alexander V. Tikhonov
@ 2019-12-19 12:43 ` Igor Munkin
  2019-12-19 16:53   ` Alexander Tikhonov
  2020-04-02 10:40 ` Kirill Yukhin
  1 sibling, 1 reply; 8+ messages in thread
From: Igor Munkin @ 2019-12-19 12:43 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

Sasha,

Thanks, LGTM. Please consider several side notes below.

On 10.12.19, Alexander V. Tikhonov wrote:
> Fixed static build with '-DBUILD_STATIC=ON' option:
> 
>  - installed liblzma-dev library for libunwind static, due to found that
>    static libunwind library uses undefined lzma functions:
>      nm -a /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a | grep lzma
>                  U lzma_index_buffer_decode
>                  U lzma_index_end
>                  U lzma_index_size
>                  U lzma_index_uncompressed_size
>                  U lzma_stream_buffer_decode
>                  U lzma_stream_footer_decode
>    while dynamic libunwind correctly sees liblzma installed:
>      ldd /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so | grep lzma
>        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8fd1c23000)
>    so to fix it the static library of lzma was needed.
> 
>  - added lzma library to unwind library for Tarantool build at file:
>      cmake/compiler.cmake
>    due to fail:
>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
>        In function `xz_uncompressed_size':
>      ./src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
>      ./src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
>      ./src/elfxx.c:205: undefined reference to `lzma_index_size'
>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
>      ./src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
>      ./src/elfxx.c:210: undefined reference to `lzma_index_end'
>      /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
>        In function `_Uelf64_extract_minidebuginfo':
>      ./src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
>      collect2: error: ld returned 1 exit status
>      test/unit/CMakeFiles/luaL_iterator.test.dir/build.make:134:
>        recipe for target 'test/unit/luaL_iterator.test' failed
>      make[2]: *** [test/unit/luaL_iterator.test] Error 1
> 
>  - added dl library to gomp library for test/unit tests
>    binaries builds at file:
>      cmake/BuildMisc.cmake
>    due to fail:
>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o):(.text+0x34d):
>        more undefined references to `dlsym' follow
>      /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): In function
>        `gomp_target_init':
>      (.text+0x9cc): undefined reference to `dlerror'
>      collect2: error: ld returned 1 exit status
> 
>   - added dl library to icu library for test/unit tests
>    binaries builds at file:
>      cmake/FindICU.cmake
>    due to fail:
>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>        In function `uprv_dl_open_60':
>      (.text+0x1ce2): undefined reference to `dlopen'
>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>        In function `uprv_dlsym_func_60':
>      (.text+0x1d3d): undefined reference to `dlsym'
>      /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
>        In function `uprv_dl_close_60':
>      (.text+0x1d21): undefined reference to `dlclose'
>      collect2: error: ld returned 1 exit status
> 
> Added static build to gitlab-ci in release check criteria named
> as static_build job. Previously named static_build job renamed to
> static_docker_build, due to it checks the build at Dockerfile.
> 
> Also moved static build make targets from .gitlab.mk to .travis.mk
> to store it in common place with the other test/build make targets.
> Moved environement from .gitlab-ci.yml file into make targets to
> make this targets true building in static w/o additional setup.
> 
> Close #4551
> ---
> 
> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4551-static-build-full-ci
> Issue: https://github.com/tarantool/tarantool/issues/4551
> 
>  .gitlab-ci.yml        | 12 +++++++++---
>  .gitlab.mk            |  9 +--------
>  .travis.mk            | 16 ++++++++++++++++
>  cmake/BuildMisc.cmake |  2 +-
>  cmake/FindICU.cmake   |  2 +-
>  cmake/compiler.cmake  | 11 +++++++++++
>  6 files changed, 39 insertions(+), 13 deletions(-)

<snipped>

>  # Pass *_no_deps goals to .travis.mk.
> -test_%_no_deps: git_submodule_update
> +test_%: git_submodule_update
>  	${TRAVIS_MAKE} $@
>  

Side note: As discussed offline, please create a ticket for the
follow up activity to reduce a mess with the make target naming.

>  # #######################################################

<snipped>

> diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
> index c9ad2b092..56429dc20 100644
> --- a/cmake/compiler.cmake
> +++ b/cmake/compiler.cmake
> @@ -171,6 +171,17 @@ if (ENABLE_BACKTRACE)
>              NAMES ${UNWIND_PLATFORM_LIB_NAME})
>          set(UNWIND_LIBRARIES ${UNWIND_PLATFORM_LIBRARY} ${UNWIND_LIBRARY})
>      endif()
> +    if (BUILD_STATIC)
> +        # some versions of libunwind need liblzma, and we don't use pkg-config
> +        # so we just look whether liblzma is installed, and add it if it is.
> +        # It might not be actually needed, but doesn't hurt if it is not.
> +        # We don't need any headers, just the lib, as it's privately needed.
> +        find_library(LZMA_LIBRARY PATH_SUFFIXES system NAMES liblzma.a)
> +        if (NOT LZMA_LIBRARY STREQUAL "LZMA_LIBRARY-NOTFOUND")
> +            message(STATUS "liblzma found")
> +            set(UNWIND_LIBRARIES ${UNWIND_LIBRARIES} ${LZMA_LIBRARY})
> +        endif()
> +    endif()

Side note: We discussed offline with Sasha Tu. whether there is a better
way to maintain such indirect dependencies and decided to proceed with
the research within a separate issue.

>      find_package_message(UNWIND_LIBRARIES "Found unwind" "${UNWIND_LIBRARIES}")
>  endif()
>  
> -- 
> 2.17.1
> 

-- 
Best regards,
IM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile
@ 2019-12-10 13:11 Alexander V. Tikhonov
  2019-12-19 12:43 ` Igor Munkin
  2020-04-02 10:40 ` Kirill Yukhin
  0 siblings, 2 replies; 8+ messages in thread
From: Alexander V. Tikhonov @ 2019-12-10 13:11 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches

Fixed static build with '-DBUILD_STATIC=ON' option:

 - installed liblzma-dev library for libunwind static, due to found that
   static libunwind library uses undefined lzma functions:
     nm -a /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a | grep lzma
                 U lzma_index_buffer_decode
                 U lzma_index_end
                 U lzma_index_size
                 U lzma_index_uncompressed_size
                 U lzma_stream_buffer_decode
                 U lzma_stream_footer_decode
   while dynamic libunwind correctly sees liblzma installed:
     ldd /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so | grep lzma
       liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8fd1c23000)
   so to fix it the static library of lzma was needed.

 - added lzma library to unwind library for Tarantool build at file:
     cmake/compiler.cmake
   due to fail:
     /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
       In function `xz_uncompressed_size':
     ./src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
     ./src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
     ./src/elfxx.c:205: undefined reference to `lzma_index_size'
     ./src/elfxx.c:210: undefined reference to `lzma_index_end'
     ./src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
     ./src/elfxx.c:210: undefined reference to `lzma_index_end'
     /usr/lib/x86_64-linux-gnu/libunwind-x86_64.a(elf64.o):
       In function `_Uelf64_extract_minidebuginfo':
     ./src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
     collect2: error: ld returned 1 exit status
     test/unit/CMakeFiles/luaL_iterator.test.dir/build.make:134:
       recipe for target 'test/unit/luaL_iterator.test' failed
     make[2]: *** [test/unit/luaL_iterator.test] Error 1

 - added dl library to gomp library for test/unit tests
   binaries builds at file:
     cmake/BuildMisc.cmake
   due to fail:
     /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o):(.text+0x34d):
       more undefined references to `dlsym' follow
     /usr/lib/gcc/x86_64-linux-gnu/7/libgomp.a(target.o): In function
       `gomp_target_init':
     (.text+0x9cc): undefined reference to `dlerror'
     collect2: error: ld returned 1 exit status

  - added dl library to icu library for test/unit tests
   binaries builds at file:
     cmake/FindICU.cmake
   due to fail:
     /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
       In function `uprv_dl_open_60':
     (.text+0x1ce2): undefined reference to `dlopen'
     /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
       In function `uprv_dlsym_func_60':
     (.text+0x1d3d): undefined reference to `dlsym'
     /usr/x86_64-linux-gnu/libicuuc.a(putil.ao):
       In function `uprv_dl_close_60':
     (.text+0x1d21): undefined reference to `dlclose'
     collect2: error: ld returned 1 exit status

Added static build to gitlab-ci in release check criteria named
as static_build job. Previously named static_build job renamed to
static_docker_build, due to it checks the build at Dockerfile.

Also moved static build make targets from .gitlab.mk to .travis.mk
to store it in common place with the other test/build make targets.
Moved environement from .gitlab-ci.yml file into make targets to
make this targets true building in static w/o additional setup.

Close #4551
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4551-static-build-full-ci
Issue: https://github.com/tarantool/tarantool/issues/4551

 .gitlab-ci.yml        | 12 +++++++++---
 .gitlab.mk            |  9 +--------
 .travis.mk            | 16 ++++++++++++++++
 cmake/BuildMisc.cmake |  2 +-
 cmake/FindICU.cmake   |  2 +-
 cmake/compiler.cmake  | 11 +++++++++++
 6 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3af5a3c8a..bc7baf8ff 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -236,9 +236,15 @@ debian_10:
     OS: 'debian'
     DIST: 'buster'
 
+# Static builds
+
 static_build:
+  <<: *release_only_definition
+  <<: *docker_test_definition
+  script:
+    - ${GITLAB_MAKE} test_static_build
+
+static_docker_build:
   <<: *deploy_test_definition
-  variables:
-    RUN_TESTS: 'ON'
   script:
-    - ${GITLAB_MAKE} static_build
+    - ${GITLAB_MAKE} test_static_docker_build
diff --git a/.gitlab.mk b/.gitlab.mk
index 48a92e518..03f5fac94 100644
--- a/.gitlab.mk
+++ b/.gitlab.mk
@@ -14,7 +14,7 @@ git_submodule_update:
 		git submodule update --recursive --init
 
 # Pass *_no_deps goals to .travis.mk.
-test_%_no_deps: git_submodule_update
+test_%: git_submodule_update
 	${TRAVIS_MAKE} $@
 
 # #######################################################
@@ -105,10 +105,3 @@ vms_shutdown:
 package: git_submodule_update
 	git clone https://github.com/packpack/packpack.git packpack
 	PACKPACK_EXTRA_DOCKER_RUN_PARAMS='--network=host' ./packpack/packpack
-
-# ############
-# Static build
-# ############
-
-static_build:
-	docker build --network=host --build-arg RUN_TESTS="${RUN_TESTS}" -f Dockerfile.staticbuild .
diff --git a/.travis.mk b/.travis.mk
index 42969ff56..d01c6a99b 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -123,6 +123,22 @@ test_asan_debian_no_deps: build_asan_debian
 
 test_asan_debian: deps_debian deps_buster_clang_8 test_asan_debian_no_deps
 
+# Static build
+
+deps_debian_static:
+	# Found that in Debian OS libunwind library built with dependencies to
+	# liblzma library, but there is no liblzma static library installed,
+	# while liblzma dynamic library exists. So the build dynamicaly has no
+	# issues, while static build fails. To fix it we need to install
+	# liblzma-dev package with static library only for static build.
+	apt-get install -y -f liblzma-dev
+
+test_static_build: deps_debian_static
+	CMAKE_EXTRA_PARAMS=-DBUILD_STATIC=ON make -f .travis.mk test_debian_no_deps
+
+test_static_docker_build:
+	docker build --network=host --build-arg RUN_TESTS=ON -f Dockerfile.staticbuild .
+
 #######
 # OSX #
 #######
diff --git a/cmake/BuildMisc.cmake b/cmake/BuildMisc.cmake
index b4a3ca1fc..0c571f326 100644
--- a/cmake/BuildMisc.cmake
+++ b/cmake/BuildMisc.cmake
@@ -39,7 +39,7 @@ macro(libmisc_build)
         else()
             set(GOMP_LIBRARY gomp)
         endif()
-        target_link_libraries(misc ${GOMP_LIBRARY} pthread)
+        target_link_libraries(misc ${GOMP_LIBRARY} pthread dl)
     endif()
 
     unset(misc_src)
diff --git a/cmake/FindICU.cmake b/cmake/FindICU.cmake
index 26f0683f3..2bb9a5d59 100644
--- a/cmake/FindICU.cmake
+++ b/cmake/FindICU.cmake
@@ -50,7 +50,7 @@ include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(ICU
     REQUIRED_VARS ICU_INCLUDE_DIR ICU_LIBRARY_I18N ICU_LIBRARY_UC)
 set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
-set(ICU_LIBRARIES ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_UC} ${ICU_LIBRARY_DATA})
+set(ICU_LIBRARIES ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_UC} ${ICU_LIBRARY_DATA} dl)
 mark_as_advanced(ICU_INCLUDE_DIR ICU_INCLUDE_DIRS
         ICU_LIBRARY_I18N ICU_LIBRARY_UC ICU_LIBRARIES)
 
diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index c9ad2b092..56429dc20 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -171,6 +171,17 @@ if (ENABLE_BACKTRACE)
             NAMES ${UNWIND_PLATFORM_LIB_NAME})
         set(UNWIND_LIBRARIES ${UNWIND_PLATFORM_LIBRARY} ${UNWIND_LIBRARY})
     endif()
+    if (BUILD_STATIC)
+        # some versions of libunwind need liblzma, and we don't use pkg-config
+        # so we just look whether liblzma is installed, and add it if it is.
+        # It might not be actually needed, but doesn't hurt if it is not.
+        # We don't need any headers, just the lib, as it's privately needed.
+        find_library(LZMA_LIBRARY PATH_SUFFIXES system NAMES liblzma.a)
+        if (NOT LZMA_LIBRARY STREQUAL "LZMA_LIBRARY-NOTFOUND")
+            message(STATUS "liblzma found")
+            set(UNWIND_LIBRARIES ${UNWIND_LIBRARIES} ${LZMA_LIBRARY})
+        endif()
+    endif()
     find_package_message(UNWIND_LIBRARIES "Found unwind" "${UNWIND_LIBRARIES}")
 endif()
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-02 11:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 11:21 [Tarantool-patches] [PATCH v2] static build: create new build w/o dockerfile Alexander V. Tikhonov
2019-12-10 13:11 Alexander V. Tikhonov
2019-12-19 12:43 ` Igor Munkin
2019-12-19 16:53   ` Alexander Tikhonov
2019-12-19 16:55     ` Alexander Tikhonov
2020-04-01  9:59     ` Sergey Bronnikov
2020-04-02 10:40 ` Kirill Yukhin
2020-04-02 11:24   ` Kirill Yukhin

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