Skip to content
Snippets Groups Projects
  1. Dec 05, 2019
  2. Nov 08, 2019
    • Alexander Turenko's avatar
      build: don't pass LDFLAGS from environment to curl · 0bead600
      Alexander Turenko authored
      
      After ea5929db ('build: fix OpenSSL
      linking problems on FreeBSD') we set CFLAGS explicitly (possibly to an
      empty value) when invoking a configure script for curl. When this
      parameter is set the script does not use a value of environment variable
      CFLAGS.
      
      Before this commit LDFLAGS environment variable can affect build of curl
      submodule. This can lead to a problem when a user or a tool set CFLAGS
      and LDFLAGS both and some linker flag assumes that some compilation flag
      is present. Here we set empty LDFLAGS explicitly to avoid using of the
      environment variable.
      
      A distributive build tool such as rpmbuild or emerge usually sets CFLAGS
      and LDFLAGS. The problem with incompatible compiler / linker options has
      been reveal under rpmbuild on CentOS 8 with hardened build enabled
      (which is so when backtraces are disabled).
      
      It is not clear whether we should follow environment variables or values
      determined by CMake for CFLAGS, CPPFLAGS and LDFLAGS when building a
      submodule (such as luajit and curl). Let's decide about this later.
      
      Part of #4543.
      
      Reviewed-by: default avatarAlexander V. Tikhonov <avtikhon@tarantool.org>
      Reviewed-by: default avatarIgor Munkin <imun@tarantool.org>
      Unverified
      0bead600
  3. Oct 28, 2019
    • Alexander Turenko's avatar
      build: pass path to toolchain for luajit and curl · 1eead75e
      Alexander Turenko authored
      This allows to overcome problems when CMake chooses one toolchain to
      build tarantool, but a library (libluajit.a or libcurl.a) is built using
      another (incompatible) toolchain.
      
      Fixes #4587.
      1eead75e
    • Alexander Turenko's avatar
      build: fix OpenSSL linking problems on FreeBSD · ea5929db
      Alexander Turenko authored
      FreeBSD has OpenSSL as part of the base system: libraries are located in
      /usr/lib, headers are in /usr/include. However a user may install the
      library into /usr/local/{lib,include} from ports / pkg. In this case
      tarantool did choose /usr/local version, while libcurl will pick up a
      base system library. This is fixed by passing --with-ssl option with an
      argument (/usr/local or /usr if custom -DOPENSSL_ROOT_DIR=<...> is not
      passed).
      
      Now the behaviour is the following. If -DOPENSSL_ROOT_DIR=<...> is
      passed, then try to use OpenSSL from it. Otherwise find the library in
      /usr/local and then in /usr. This is right as for tarantool's crypto
      module as well as for libcurl submodule.
      
      There is a flaw here: a user is unable to choose a base system library
      if a ports / pkg version of OpenSSL is installed. The reason here is
      that tarantool's crypto module depends on other libraries and
      -I/usr/local/include may be added to build options. I have no good
      solution for that, so `cmake . -DOPENSSL_ROOT_DIR=/usr` will give a
      warning on FreeBSD and `gmake` likely will fail if libraries are of
      different versions (see cmake/os.cmake comments for more information).
      See also a [discussion][1] in FreeBSD community about all those /usr and
      /usr/local problems.
      
      There were two other problems that may fail tarantool build on FreeBSD:
      they are fixed in this commit and described below.
      
      First, libcurl's configure script chooses GCC by default if it exists
      (say, installed from ports / pkg). It is unexpected behaviour when
      tarantool sources itself are built with clang. Now it is fixed by
      passing a compiler explicitly to the libcurl's configure script: the
      library will use base system clang by default or one that a user pass to
      tarantool's cmake.
      
      Side note: GCC has /usr/local/include in its default headers search
      paths; libcurl's configure script chooses GCC as a compiler and OpenSSL
      from a base system by default (when CC and --with-ssl=<...> are not set)
      that leads to OpenSSL header / library mismatch. It is the primary
      reason of the build fail that was fixed in
      1f2338bd ('build: FreeBSD packages
      installation'). It is not much relevant anymore, because we don't try to
      link with a base system OpenSSL if /usr/local one exists (however if it
      is asked explicitly with -DOPENSSL_ROOT_DIR=<...> we'll do, but will
      give a warning). Anyway, it is important to know such details if we'll
      change build scripts in a future.
      
      Second, backtraces are not supported on FreeBSD, but were enabled if
      libunwind headers is found. This leads to an error on cmake stage,
      because of inability to find a right library (this is a bug). Now we
      disable backtraces on FreeBSD by default even if libunwind is found. See
      
      When CC is passed to libcurl's configure script, the new problem opens
      on Mac OS. CMake chooses XCode toolchain by default (at least on a
      particular system where I tried it), which requires -isysroot=<SDK_PATH>
      option to be passed to a preprocessor and a compiler in order to find
      system headers. See [2] for more information.
      
      [1]: https://wiki.freebsd.org/WarnerLosh/UsrLocal
      [2]: https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035623
      
      Follows up #4490.
      ea5929db
  4. Aug 27, 2019
    • Alexander Turenko's avatar
      build: fix linking with static openssl library · 2cdfaf3b
      Alexander Turenko authored
      System-wide dynamic libraries usually (always?) have NEEDED and RUNPATH
      tags in a dynamic section (as `readelf -d /usr/lib/lib<...>.so` shows),
      so when we link, say, with libssl.so, which depends on libz.so, a linker
      does not complain against unresolved symbols that can be found in Z
      library (if it is installed within a system).
      
      Things are different when we linking with a static library. Say, when we
      linking with libssl.a, which contains an unresolved symbol from Z
      library, a linker reports an error. It is not possible to store an
      information where to find unresolved symbols (NEEDED / RUNPATH) in a
      static library (AFAIK).
      
      We depend on three libraries that are depend on Z library: libcurl,
      libssl and libcrypto (two latter are part of OpenSSL). When one of those
      libraries is linked statically we should link with libz.so or libz.a
      (depending on BUILD_STATIC flag). The patch doing exactly this.
      
      The patch changes OPENSSL_LIBRARIES variable to fix the issue with
      static linking of OpenSSL libraries. It also changes CURL_LIBRARIES in
      the same way, however this does not alter any visible behaviour, because
      OPENSSL_LIBRARIES is added to CURL_LIBRARIES. The latter change was made
      to unify the way to choose libraries to link with: it is pure
      refactoring part.
      
      Fixes #4437.
      2cdfaf3b
  5. Aug 21, 2019
    • Mergen Imeev's avatar
      build: link libcurl statically from a submodule · 7e51aebb
      Mergen Imeev authored
      Hold libcurl-7.65.3. This version is not affected by the following
      issues:
      
      * #4180 ('httpc: redirects are broken with libcurl-7.30 and older');
      * #4389 ('libcurl memory leak');
      * #4397 ('HTTPS seem to be unstable').
      
      After this patch libcurl will be statically linked when
      ENABLE_BUNDLED_LIBCURL option is set. This option is set by default.
      
      Closes #4318
      
      @TarantoolBot document
      Title: Tarantool dependency list was changed
      
      * Added build dependencies: autoconf, automake, libtool, zlib-devel
        (zlib1g-dev on Debian).
      * Added runtime dependencies: zlib (zlib1g on Debian).
      * Removed build dependencies: libcurl-devel (libcurl4-openssl-dev on
        Debian).
      * Removed runtime dependencies: curl.
      
      The reason is that now we use compiled-in libcurl: so we don't depend on
      a system libcurl, but inherit its dependencies.
      7e51aebb
  6. Jun 13, 2019
    • Serge Petrenko's avatar
      lib/core: introduce decimal type to tarantool · 6d62c6c1
      Serge Petrenko authored
      Add fixed-point decimal type to tarantool core.
      Adapt decNumber floating-point decimal library for the purpose, write a
      small wrapper and add unit tests.
      
      A new decimal type is an alias for decNumber numbers from the decNumber
      library.
      Arithmetic operations (+, -, *, /) and some mathematic functions
      (ln, log10, exp, pow, sqrt) are available together with methods to
      pack and unpack decimal to and from its packed representation (useful
      for serialization).
      
      We introduce a single context for all the arithmetic operations
      on decimals, which enforces both number precision and scale to be
      in range [0, 38]. NaNs and Infinities are restricted.
      
      Part of #692
      6d62c6c1
    • Alexander V. Tikhonov's avatar
      Fix static build · 31ab6ea9
      Alexander V. Tikhonov authored
      Added to cmake environment CMAKE_DL_LIBS (The name of the library
      that has dlopen and dlclose in it, usually -ldl) to openssl build
      to add DL library, to fix the following fails:
      
      Linking CXX executable crypto.test
      /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
      dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
      dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
      dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
      /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
      dso_dlfcn.c:(.text+0x334): undefined reference to `dlsym'
      dso_dlfcn.c:(.text+0x3f2): undefined reference to `dlerror'
      /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
      dso_dlfcn.c:(.text+0x459): undefined reference to `dlopen'
      dso_dlfcn.c:(.text+0x4c9): undefined reference to `dlclose'
      dso_dlfcn.c:(.text+0x502): undefined reference to `dlerror'
      /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
      dso_dlfcn.c:(.text+0x5a1): undefined reference to `dladdr'
      dso_dlfcn.c:(.text+0x601): undefined reference to `dlerror'
      /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
      dso_dlfcn.c:(.text+0x662): undefined reference to `dlclose'
      collect2: error: ld returned 1 exit status
      make[2]: *** [test/unit/crypto.test] Error 1
      make[1]: *** [test/unit/CMakeFiles/crypto.test.dir/all] Error 2
      
      Closes #4245
      31ab6ea9
  7. Apr 29, 2019
    • Alexander Turenko's avatar
      travis-ci: set right flags in release testing jobs · c308f35d
      Alexander Turenko authored
      It is important to have testing jobs that build the project with both
      -Werror and -O2 to keep the code clean. -O2 is needed, because some
      compiler warnings are available only after extra analyzing passes that
      are disabled with lesser optimization levels.
      
      The first attempt to add -Werror for release testing jobs was made in
      da505ee7 ('Add -Werror for CI (1.10
      part)'), but it mistakely doesn't enable -O2 for RelWithDebInfoWError
      build. It is possible to fix it in this way:
      
       | --- a/cmake/compiler.cmake
       | +++ b/cmake/compiler.cmake
       | @@ -113,10 +113,14 @@ set (CMAKE_C_FLAGS_DEBUG
       |      "${CMAKE_C_FLAGS_DEBUG} ${CC_DEBUG_OPT} -O0")
       |  set (CMAKE_C_FLAGS_RELWITHDEBINFO
       |      "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CC_DEBUG_OPT} -O2")
       | +set (CMAKE_C_FLAGS_RELWITHDEBINFOWERROR
       | +    "${CMAKE_C_FLAGS_RELWITHDEBINFOWERROR} ${CC_DEBUG_OPT} -O2")
       |  set (CMAKE_CXX_FLAGS_DEBUG
       |      "${CMAKE_CXX_FLAGS_DEBUG} ${CC_DEBUG_OPT} -O0")
       |  set (CMAKE_CXX_FLAGS_RELWITHDEBINFO
       |      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CC_DEBUG_OPT} -O2")
       | +set (CMAKE_CXX_FLAGS_RELWITHDEBINFOWERROR
       | +    "${CMAKE_CXX_FLAGS_RELWITHDEBINFOWERROR} ${CC_DEBUG_OPT} -O2")
       |
       |  unset(CC_DEBUG_OPT)
      
      However I think that a build type (and so `tarantool --version`) should
      not show whether -Werror was passed or not. So I have added
      ENABLE_WERROR CMake option for that. It can be set like so:
      
       | cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON
      
      Enabled the option in testing Travis-CI jobs with the RelWithDebInfo
      build type. Deploy jobs don't include it as before.
      
      Fixed all -Wmaybe-uninitialized and -Wunused-result warnings. A few
      notes about the fixes:
      
      * net.box does not validate received data in general, so I don't add a
        check for autoincrement IDs too. Set the ID to INT64_MIN, because this
        value is less probably will appear here in a normal case and so is the
        best one to signal a user that something probably going wrongly.
      * xrow_decode_*() functions could read uninitialized data from
        row->body[0].iov_base in xrow_on_decode_err() when printing a hex code
        for a row. It could be possible when the received msgpack was empty
        (row->bodycnt == 0), but there were expected keys (key_map != 0).
      * getcwd() is marked with __attribute__((__warn_unused_result__)) in
        glibc, but the buffer filled by this call is not used anywhere and so
        just removed.
      * Vinyl -Wmaybe-uninitialized warnings are false positive ones.
      
      Added comments and quotes into .travis.yml to ease reading. Removed
      "test" word from the CentOS 6 job name, because we don't run tests on
      this distro (disabled in the RPM spec).
      
      Fixes #4178.
      c308f35d
  8. Mar 15, 2019
    • Alexander V. Tikhonov's avatar
      travis-ci: fix OS X Mojave 10.14 build · eb964471
      Alexander V. Tikhonov authored
      Fixed Mojave Mac build with setting MACOSX_DEPLOYMENT_TARGET environment
      variable for LuaJIT's Makefile. This variable specifies the minimum
      version of OS X on which the target binaries are to be deployed.
      
      The reason why we need to set MACOSX_DEPLOYMENT_TARGET to at least 10.6
      is that 10.4 SDK (which is set by default in LuaJIT's Makefile) is not
      longer included in Mac OS X Mojave 10.14.
      
      See also https://github.com/LuaJIT/LuaJIT/issues/484
      
      We already set -Wl,-macosx_version_min,10.6 (-macosx_version_min and
      MACOSX_DEPLOYMENT_TARGET are synonymous), but it affects only a linker.
      We possibly should remove -macosx_version_min, because it superseded by
      MACOSX_DEPLOYMENT_TARGET, but it should be done with verification that
      the original problem really fixed by the new way to set a deployment
      target. This is not part of this patch.
      
      Removed virtualenv usage in CI for OS X (so pip just installs packages
      into a system), because OS X Mojave 10.14 does not offer virtualenv by
      default.
      
      Fixed #3797
      Unverified
      eb964471
  9. Dec 24, 2018
  10. Dec 21, 2018
  11. Nov 03, 2018
  12. Oct 25, 2018
  13. Oct 05, 2018
    • Alexander Turenko's avatar
      Add -Werror for CI (1.10 part) · da505ee7
      Alexander Turenko authored
      Added MAKE_BUILD_TYPE=RelWithDebInfoWError option, which means enabling
      -DNDEBUG=1, -O2 and -Wall -Wextra -Werror. This ensures we have clean
      release build without warnings.
      
      Fixed found -Wunused-variable and -Wunused-parameter warnings.
      
      Part of #3238.
      da505ee7
  14. Sep 20, 2018
  15. Sep 10, 2018
    • Kirill Yukhin's avatar
      Fix libgomp linking for static build · 0a3186c4
      Kirill Yukhin authored
      Since addition of -fopenmp to compiler also means
      addition of -lgomp to the link stage, pass -fno-openmp
      to the linking stage in case of static build. In that
      case OMP functions are statically linked into libmisc.
      
      Also, emit error if trying to perform static build using
      clang.
      0a3186c4
  16. Sep 06, 2018
    • Konstantin Osipov's avatar
    • Georgy Kirichenko's avatar
      Tarantool static build ability · cb1c72da
      Georgy Kirichenko authored
      A possibility to build tarantool with included library dependencies.
      Use the flag -DBUILD_STATIC=ON to build statically against curl, readline,
      ncurses, icu and z.
      Use the flag -DOPENSSL_USE_STATIC_LIBS=ON to build with static
      openssl
      
      Changes:
        * Add FindOpenSSL.cmake because some distributions do not support the use of
        openssl static libraries.
        * Find libssl before curl because of build dependency.
        * Catch all bundled libraries API and export then it in case of static
        build.
        * Rename crc32 internal functions to avoid a name clash with linked libraries.
      
      Notes:
        * Bundled libyaml is not properly exported, use the system one.
        * Dockerfile to build static with docker is included
      
      Fixes #3445
      cb1c72da
  17. Aug 21, 2018
    • Konstantin Belyavskiy's avatar
      Add FindICONV and iconv wrapper · dcac64af
      Konstantin Belyavskiy authored
      Fixing build under FreeBSD:
      Undefined symbol "iconv_open"
      Add compile time build check with FindICONV.cmake
      and a wrapper to import relevant symbol names with include file.
      
      Closes #3441
      dcac64af
  18. Aug 02, 2018
  19. Mar 01, 2018
  20. Jan 27, 2018
  21. Oct 13, 2017
    • Alexandr Lyapunov's avatar
      Fix build with old ICU library · 5e1fde37
      Alexandr Lyapunov authored
      Fast ucol_strcollUTF8 function was introduced in ICU 50. In older
      ICU versions we have to use slower ucol_strcollIter with properly
      initialized UTF8 iterators.
      
      Fix #2820
      5e1fde37
  22. Oct 09, 2017
  23. Oct 06, 2017
  24. Oct 05, 2017
  25. Sep 26, 2017
    • Alexander Turenko's avatar
      Add an option to allow using system ZStd · 664fc51e
      Alexander Turenko authored
      The option is '-DENABLE_BUNDLED_ZSTD' and defaults to ON.
      
      There are two goals of making this conditional, both related to building
      Tarantool on Gentoo Linux from an ebuild:
      
      * Avoid bundled ZStd building issue w/o pay to investivage it.
      * Allow user to choose between system and bundled library.
      664fc51e
  26. Sep 22, 2017
  27. Sep 18, 2017
  28. Sep 12, 2017
    • Roman Tsisyk's avatar
      Add FALLTHROUGH macro · 3ce62ef8
      Roman Tsisyk authored
      The fallthrough attribute with a null statement serves as a fallthrough
      statement. It hints to the compiler that a statement that falls through
      to another case label, or user-defined label in a switch statement is
      intentional and thus the -Wimplicit-fallthrough warning must not trigger.
      The fallthrough attribute may appear at most once in each attribute list,
      and may not be mixed with other attributes. It can only be used in a switch
      statement (the compiler will issue an error otherwise), after a preceding
      statement and before a logically succeeding case label, or user-defined
      label.
      
      https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
      3ce62ef8
  29. Aug 22, 2017
    • Roman Tsisyk's avatar
      Replace gopt with getopt_long() · f6370335
      Roman Tsisyk authored
      getopt_long() is available on all supported platforms.
      Get rid of legacy gopt and use getopt_long().
      
      Incompatible changes:
      
       * `tarantool --version --no-such-option` printed
          "unrecognized option '--no-such-option'", now it displays version.
          `tarantool --no-such-option --version` still prints an error message.
      
      Needed for #1265
      f6370335
  30. Aug 03, 2017
    • Roman Tsisyk's avatar
      CMake: add -DLUAJIT_ENABLE_GC64 option · ee71b9f7
      Roman Tsisyk authored
      Add an option to enable LuaJIT's GC64 mode and enable this option
      by default on OS X.
      
      Closes #2643
      ee71b9f7
    • Roman Tsisyk's avatar
      CMake: fix LUAJIT_USE_XXX definitions · 8bc16692
      Roman Tsisyk authored
      LuaJIT has some configuration flags which can be switched via
      -DLUAJIT_USE_OPTION defines, e.g. USE_ASAN or USE_VALGRIND.
      Before this patch these definitions were added by CMake to XCFLAGS
      variable and passed to LuaJIT's Makefile. However, some of these
      flags also affect the content of lj_xxx.h internal header files,
      which were included by Tarantool (see utils.c) and compiled WITHOUT
      proper flags. This situation might lead to inconsistent ABI between
      compiled libluajit.a and Tarantool.
      
      This patch adds all LUAJIT_USE_XXX defines to CMake's COMPILE_FLAGS
      in order to enable these flags globally, then parses COMPILE_FLAGS
      and adds them to LuaJIT's XCFLAGS.
      
      Needed for #2643
      8bc16692
  31. Jul 28, 2017
  32. Jul 27, 2017
  33. Jul 24, 2017
Loading