Skip to content
Snippets Groups Projects
  1. Nov 09, 2023
    • Vladimir Davydov's avatar
      cmake: allow to include extra dependencies · a367265b
      Vladimir Davydov authored
      Tarantool EE needs to build or find some extra libraries. Let's add
      the new variable EXTRA_DEPENDENCIES_CMAKE for that. It'll be defined
      by the parent project.
      
      Since we might need to link the extra dependencies to the core library,
      we also add the new list variable EXTRA_CORE_DEPENDENCIES. If set, its
      contents will be appended to the core library dependencies list.
      
      Follow-up #9242
      
      NO_DOC=build
      NO_TEST=build
      NO_CHANGELOG=build
      a367265b
    • Vladimir Davydov's avatar
      cmake: allow to use bundled zzip · 140fd681
      Vladimir Davydov authored
      There's EMBED_LUZIP cmake option that embeds the Lua zip module in
      Tarantool binary. Since the Lua zip module depends on the zzip library,
      it also links the zzip library. The option is used only by Tarantool EE
      so there's no config for bundling the zzip library in the CE repository.
      Now, that we bundle all static build dependencies in the main project
      cmake config, let's add zzip bundling code here as well. The code of
      /cmake/BuildZZIP.make is copied from /static-build/CMakeLists.txt of
      the EE repository.
      
      Follow-up #9242
      
      NO_DOC=build
      NO_TEST=build
      NO_CHANGELOG=build
      140fd681
    • Vladimir Davydov's avatar
      cmake: allow to bundle static dependencies in main project · 98b38e89
      Vladimir Davydov authored
      The BUILD_STATIC cmake config option forces the build system link
      Tarantool binary statically with its dependencies. It expects that all
      static libraries on which Tarantool binary depends are available at
      build time.
      
      We don't use this option directly to create static binaries because it
      would produce different results on different build systems. Instead, we
      use the separate cmake config located in the static-build directory,
      which fetches all Tarantool dependencies from a predefined location
      before building a static binary.
      
      Having a separate cmake config is inconvenient. Let's enable bundling of
      static binary dependencies right in the main project cmake config, like
      we bundle, for example, libcurl. To achieve that, the new build option
      was introduced BUILD_STATIC_WITH_BUNDLED_LIBS. It implies BUILD_STATIC
      and also fetches and builds all required dependencies, like the
      static-build cmake config used to. The latter doesn't do it anymore;
      from now on, it just sets BUILD_STATIC_WITH_BUNDLED_LIBS when building
      Tarantool. We can't remove the static-build cmake config yet because
      there are quire a few CI workflows depending on it.
      
      Note that, just like BUILD_STATIC, BUILD_STATIC_WITH_BUNDLED_LIBS
      doesn't imply OPENSSL_USE_STATIC_LIBS so the latter should be set
      explicitly if one wants to use the static openssl library. However,
      setting OPENSSL_USE_STATIC_LIBS with BUILD_STATIC_WITH_BUNDLED_LIBS will
      force the build system use bundled static openssl library.
      
      This patch is relatively straightforward. It just moves the external
      projects from /static-build/cmake/AddDependencyProjects.cmake to /cmake
      adding build dependencies where required and setting variables that are
      set by the corresponding /cmake/FindXXX.cmake configs.
      
      There are a few things that should be noted separately though:
       - We dropped the ZLIB_FOUND check from the main project cmake config.
         It was used for building EE but the latter is going to be broken
         anyway once this patch is committed. We'll fix it in following
         commits.
       - FindLibUnwind referenced zlib library by ZLIB::ZLIB. We don't set
         it for bundled zlib so let's use ZLIB_LIBRARIES instead.
       - We don't need to detect dependency cflags while building bundled
         libraries as we can reuse the flags set by the main project.
       - We don't use HARDENING_LDFLAGS because it makes no sense when
         building static libraries.
      
      Closes #9242
      
      NO_DOC=build
      NO_TEST=build
      NO_CHANGELOG=build
      98b38e89
    • Vladimir Davydov's avatar
      cmake: build bundled libyaml as external project · 8820f5c9
      Vladimir Davydov authored
      Currently, we simply include the libyaml source directory into the main
      project. The problem is that libyaml uses ICU. If ICU is built outside
      the main project cmake config, as it's the case with the static-build,
      both the main project and libyaml cmake configs will use the same ICU
      version. However, if we build ICU in the main project, as we intend to
      do to resolve #9242, it may not work. To fix that, we need to use the
      external project API to build libyaml.
      
      Needed for #9242
      
      NO_DOC=build
      NO_TEST=build
      NO_CHANGELOG=build
      8820f5c9
  2. Oct 12, 2023
  3. Oct 03, 2023
    • Sergey Bronnikov's avatar
      cmake: build performance tests only with release build · a63d291b
      Sergey Bronnikov authored
      Note that targets for running performance tests are generated only when
      CMAKE_BUILD_TYPE is equal to Release or RelWithDebug. Additionally, C++
      performance tests require Google Benchmark library. Using non-debug
      build and having installed Google Benchmark library is rare case, so I
      suppose we don't need to introduce CMake option for performance testing.
      
      NO_CHANGELOG=testing
      NO_DOC=testing
      NO_TEST=testing infrastructure
      a63d291b
  4. Jul 13, 2023
    • Igor Munkin's avatar
      cmake: introduce FIBER_STACK_SIZE option · ff57f990
      Igor Munkin authored
      In scope of the commit 82f4b4a3 ("lib/core/fiber: Increase default
      stack size") the default value of fiber stack size is increased up to
      512 Kb (you can find the reasons in the aforementioned commit message
      and in https://github.com/tarantool/tarantool/issues/3418 description).
      
      Some of the tests in test/PUC-Rio-Lua-5.1-test suite in LuaJIT repo
      (e.g. some cases with deep recursion in errors.lua or pm.lua) have
      already been tweaked according to the limitations mentioned in
      https://github.com/tarantool/tarantool/issues/5782, but the crashes
      still occurs while running LuaJIT tests with ASan support enabled.
      
      To make the testing routine more convenient, FIBER_STACK_SIZE option is
      introduced to Tarantool CMake machinery. One can provide the size either
      by raw digits (i.e. in bytes) or using Kb/Mb suffixes for convenience.
      
      A couple of important nits:
      * If the given value is not a multiple of 4Kb, CMake machinery adjusts
        it up to the nearest one greater than this value.
      * If the adjusted value is less than 512Kb, configuration fails with the
        corresponding CMake fatal error.
      
      Follows up #3418
      Relates to #5782
      
      @TarantoolBot document
      Title: introduce FIBER_STACK_SIZE configuration option
      
      To make managing of the default fiber stack size more convenient, the
      corresponding CMake option is added.
      
      **NB**: The stack size can't be less than 512Kb and if the given value
      is not a multiple of 4Kb, CMake machinery adjusts it up to the nearest
      one greater than this value.
      ff57f990
  5. Apr 17, 2023
    • Vladimir Davydov's avatar
      lua: add malloc info · d34a0cbc
      Vladimir Davydov authored
      This commit adds two new Lua functions:
       - `box.malloc.info()` is a public function that returns the total
         memory usage of internal data structures allocated with `malloc()`.
         This information is extracted from the `malloc_info()` output.
         See the doc bot request for details.
       - `box.malloc.internal.info()` is an internal function that returns
         a parsed XML document returned by `malloc_info()` as is. It isn't
         documented. We may need it to get the detailed information about
         the system memory allocator.
      
      Both functions are useful only on Linux and only if ASAN is disabled
      because otherwise `malloc_info()` is unavailable. On other platforms
      `box.malloc.info()` reports zero memory usage while `internal.info()`
      returns an empty table.
      
      Closes #7311
      
      @TarantoolBot document
      Title: Document `box.malloc.info()`
      
      `box.malloc.info()` is a function that returns a table with two fields:
      
      ```
      tarantool> box.malloc.info()
      ---
      - size: 2498560
        used: 1835726
      ...
      ```
      
      The `used` value is the total amount of memory in bytes allocated by
      Tarantool for internal data structures with [`malloc()`][1].
      
      The `size` value is the total amount of memory in bytes allocated from
      the system by the `malloc()` allocator. It may not be less than `used`.
      
      The function may be used before `box.cfg()` is called.
      
      Currently, the function is available only on Linux. On other systems it
      reports zero memory usage (`{size = 0, used = 0}`).
      
      [1]: https://man7.org/linux/man-pages/man3/malloc.3.html
      d34a0cbc
  6. Apr 03, 2023
  7. Mar 03, 2023
    • Igor Munkin's avatar
      lua: disable JIT engine on macOS by default · ae0db476
      Igor Munkin authored
      To improve customer experience it was decided to disable JIT engine on
      Tarantool startup for macOS builds. Either way, JIT will be aboard as a
      result of the changes and more adventurous users will be able to enable
      it via <jit.on> in their code.
      
      Furthermore, for convenient maintenance of JIT default behaviour CMake
      configuration option "LUAJIT_JIT_STATUS" is introduced.
      
      Closes #8252
      
      NO_DOC=no behaviour changes
      ae0db476
  8. Jan 17, 2023
    • Nikolay Shirokovskiy's avatar
      libunwind: improve incremental build/rebuild · 14f93aee
      Nikolay Shirokovskiy authored
      Currently we use ExternalProject_Add to build libunwind subproject. The
      usecases it supports are not quite aligned with our. Configuration and
      build steps are rerun in case download step sees updated sources. But
      we use git submodules to fetch third-party projects and thus subproject
      is not rebuild when it's files are changed on disk. Either because of
      we doing some sort of experiments locally or because the new sources
      are brought by git pull.
      
      Actually libunwind has a CMakeList.txt so that we could try to build it
      just as project subdirectory. But it requires quite a fresh CMake
      version, currently supports only build on Visual Studio and probably is
      not up to date given it's package version variables. Keeping
      CMakeLists.txt in sync with main autotools build is additional
      maintenance burden. So I'd like to use main autotools build.
      
      So ext_project_autotools function is added to provide nicer build
      integration with third-party projects which are build using autotools.
      Actually incremental rebuild works only if CMake is at least 3.12 but
      I think this should be true for developer installations.
      
      Hopefully we can reuse the function in case we need to bundle more
      subprojects with autotools builds.
      
      Follow-up #5665
      
      NO_DOC=build improvement
      NO_TEST=build improvement
      NO_CHANGELOG=build improvement
      14f93aee
  9. Dec 09, 2022
    • Ilya Verbin's avatar
      cmake: enable leak backtraces on AArch64 · c1b0fa92
      Ilya Verbin authored
      This feature was disabled due to a crash in libunwind. After commit
      5b08d71a ("libunwind: use latest release v1.6.2 as a base") the
      crash is gone.
      
      Closes #7960
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      NO_TEST=<Leak backtraces are tested by test/unit/fiber.cc; the crash in
      libunwind is observable on test/box-luatest/gh_6310_grant_rw_access_on_
      _session_settings_space_to_public_role_test.lua>
      c1b0fa92
  10. Dec 08, 2022
    • Andrey Saranchin's avatar
      cmake: do not find zlib if it has been found before · 1b15fabb
      Andrey Saranchin authored
      Since we are going to introduce zlib compression in enterprise version,
      we need to find zlib package there, so let's search for zlib package
      only if it has not been found before.
      
      NO_TEST=cmake
      NO_CHANGELOG=no behavior changes
      NO_DOC=no behavior changes
      1b15fabb
  11. Nov 23, 2022
    • Nikolay Shirokovskiy's avatar
      misc: get rid of fiber_gc · 19abfd2a
      Nikolay Shirokovskiy authored
      As it breaks sane usage of region as a data stack:
      
      	size_t region_svp = region_used(&fiber()->gc);
      	/* some allocation on fiber gc and usage of allocated memory. */
      	region_truncate(&fiber()->gc, region_svp);
      
      If in the above snippet one calls a function that in turn calls
      `fiber_gc` then the snippet code may have use-after-free and later UB
      on truncation.
      
      For this reason let's get read of fiber_gc. However we need to make sure
      we won't introduce leaks this way. So before actually removing
      fiber_gc we make it perform leak check instead and only after fixing
      all the leaks the fiber_gc was removed.
      
      In order to find the leak easily the backtrace of the first fiber gc
      allocation that is not truncated is saved and then reported.
      
      In order to catch leaks that are not triggered by the current test suit
      and to prevent introducing leaks in future patches the leak check is
      added on fiber exit/recycle and for long living system fibers on every loop
      iteration.
      
      Leak check in release build is on but without leak backtrace info by
      default for performance reasons. Backtrace can be provided by using
      `fiber.leak_backtrace_enable()` knob before starting leaking fiber.
      
      Regularly leaks are only reported in log but it will not help to
      catch errors when running test suits so build option ABORT_ON_LEAK
      is added. When it is on we abort on leak. This option is turned off
      for all builds that used in CI.
      
      Closes #5665
      
      NO_CHANGELOG=internal
      NO_DOC=internal
      19abfd2a
  12. Nov 07, 2022
  13. Oct 21, 2022
    • Georgiy Lebedev's avatar
      build: use relative paths in diagnostics and debugging information · 256da010
      Georgiy Lebedev authored
      Since our diagnostics use the `__FILE__` macro, they provide absolute
      paths, which is kind of redundant and inconsistent: replace them with
      relative ones.
      
      As for debugging information, replacing absolute paths with relative ones
      also requires an extra command to tell the debugger where to find the
      source files, which is not convenient for developers: provide a new
      `DEV_BUILD` option (turned off by default), which replaces absolute paths
      with relative ones in debugging information if turned off.
      
      Strip the prefix map flags from compiler flags exported to tarantool via
      `src/trvia/config.h`.
      
      Closes #7808
      
      NO_DOC=<verbosity>
      NO_TEST=<verbosity>
      256da010
    • Georgiy Lebedev's avatar
      build: refactor setting hardening compiler flags · dd51a2fa
      Georgiy Lebedev authored
      Setting hardening compiler flags is used in three places: default build,
      static build and enterprise build — refactor it into a separate module.
      
      Follow-up e6abe1c9
      
      NO_CHANGELOG=refactoring
      NO_DOC=refactoring
      NO_TEST=refactoring
      dd51a2fa
    • Georgiy Lebedev's avatar
      build: refactor passing compiler flags to dependencies · c6794757
      Georgiy Lebedev authored
      e6abe1c9 passes compiler flags to dependencies via a `<project>_build` macro
      parameter, which is, firstly, inconvenient, and, secondly, as a result, not
      all dependencies got the required compiler flags passed: use global
      variables instead and pass these flags to skipped dependencies.
      
      Follow-up e6abe1c9
      
      NO_CHANGELOG=refactoring
      NO_DOC=refactoring
      NO_TEST=refactoring
      c6794757
  14. Sep 15, 2022
    • Ilya Verbin's avatar
      cmake: add extra security compiler options · e6abe1c9
      Ilya Verbin authored
      Introduce cmake option ENABLE_HARDENING, which is TRUE by default for
      non-debug regular and static builds, excluding AArch64 and FreeBSD.
      It passess compiler flags that harden Tarantool (including the bundled
      libraries) against memory corruption attacks. The following flags are
      passed:
      
      * -Wformat - Check calls to printf and scanf, etc., to make sure that
        the arguments supplied have types appropriate to the format string
        specified.
      
      * -Wformat-security -Werror=format-security - Warn about uses of format
        functions that represent possible security problems. And make the
        warning into an error.
      
      * -fstack-protector-strong - Emit extra code to check for buffer
        overflows, such as stack smashing attacks.
      
      * -fPIC -pie - Generate position-independent code (PIC). It allows to
        take advantage of the Address Space Layout Randomization (ASLR).
      
      * -z relro -z now - Resolve all dynamically linked functions at the
        beginning of the execution, and then make the GOT read-only.
      
      Also do not disable hardening for Debian and RPM-based Linux distros.
      
      Closes #5372
      Closes #7536
      
      NO_DOC=build
      NO_TEST=build
      e6abe1c9
  15. Sep 12, 2022
    • Vladimir Davydov's avatar
      Use MT-Safe strerror_r instead of strerror · 44f46dc8
      Vladimir Davydov authored
      strerror() is MT-Unsafe, because it uses a static buffer under the hood.
      We should use strerror_r() instead, which takes a user-provided buffer.
      The problem is there are two implementations of strerror_r(): XSI and
      GNU. The first one returns an error code and always writes the message
      to the beginning of the buffer while the second one returns a pointer to
      a location within the buffer where the message starts. Let's introduce a
      macro HAVE_STRERROR_R_GNU set if the GNU version is available and define
      tt_strerror() which writes the message to the static buffer, like
      tt_cstr() or tt_sprintf().
      
      Note, we have to export tt_strerror(), because it is used by Lua via
      FFI. We also need to make it available in the module API header, because
      the say_syserror() macro uses strerror() directly. In order to avoid
      adding tt_strerror() to the module API, we introduce an internal helper
      function _say_strerror(), which calls tt_strerror().
      
      NO_DOC=bug fix
      NO_TEST=code is covered by existing tests
      44f46dc8
  16. Aug 15, 2022
    • Ilya Verbin's avatar
      cmake: normalize ENABLE_BACKTRACE option · 3a6021ea
      Ilya Verbin authored
      CMake accepts the following case-insensitive values as true: 1, ON, YES,
      TRUE, Y, or a non-zero number (including floating point numbers). This
      complicates the parsing of ENABLE_BACKTRACE in `tarantool.build.options`.
      Fix this by defining it to TRUE for any true value.
      
      Part of #7535
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      3a6021ea
  17. Aug 09, 2022
    • Alexander Turenko's avatar
      cmake: show ENABLE_FEEDBACK_DAEMON in cmake output · 1546a123
      Alexander Turenko authored
      It is convenient to fast check, whether the option was enabled or
      disabled. Especially, when cmake is called indirectly, say, by a package
      manager on Gentoo.
      
      Follows up #3308
      
      NO_DOC=quite minor build process change
      NO_TEST=has no relation to tarantool behavior
      NO_CHANGELOG=see NO_DOC
      1546a123
  18. Aug 08, 2022
    • Ilya Verbin's avatar
      util: introduce strlcat utility function · dcd9be4a
      Ilya Verbin authored
      strlcat is a function from BSD, which is designed to be safer, more
      consistent, and less error prone replacement for strcat and strncat.
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      
      Part of #7534
      dcd9be4a
  19. Aug 03, 2022
    • Serge Petrenko's avatar
      cmake: add BUNDLED_LIBCURL_USE_ARES to options list · 076701c4
      Serge Petrenko authored
      The option was forgotten back when bundled c-ares was just introduced.
      Let's fix this now for the sake of consistency with other options.
      
      NO_DOC=build fix
      NO_TEST=build fix
      NO_CHANGELOG=build fix
      076701c4
    • Vladimir Davydov's avatar
      build: bump zstd submodule · ec02a6ad
      Vladimir Davydov authored
      Updated third_party/zstd submodule from v1.5.0 to 1.5.2 version.
      The new version fixes a few bugs found by fuzzing testing.
      
      Note, the new zstd version contains a .S source file so we need to
      include ASM to the CMake project languages.
      
      NO_DOC=build
      NO_TEST=build
      ec02a6ad
  20. May 20, 2022
    • Maxim Kokryashkin's avatar
      luajit: bump submodule · f40ad50d
      Maxim Kokryashkin authored
      LuaJIT submodule is bumped to introduce the following changes:
      * sysprof: change C configuration API
      * sysprof: enrich symtab on a new trace or a proto
      * sysprof: fix SYSPROF_HANDLER_STACK_DEPTH
      * sysprof: make internal API functions static
      * sysprof: add LUAJIT_DISABLE_SYSPROF to Makefile
      * symtab: check the _GNU_SOURCE definition
      
      Within this changeset Tarantool-specific backtrace handler is introduced
      and set to be used by sysprof machinery.
      
      Besides, all new public Lua C API introduced within this changeset is
      added to extra/exports.
      
      Follows up #781
      
      NO_DOC=LuaJIT submodule bump
      NO_TEST=LuaJIT submodule bump
      NO_CHANGELOG=LuaJIT submodule bump
      f40ad50d
  21. Mar 18, 2022
    • Georgiy Lebedev's avatar
      libunwind: add new submodule · 7dc9fe44
      Georgiy Lebedev authored
      Investigation of GNU libunwind problems on the aarch64-linux-gnu
      platform drive us to the conclusion that libunwind-1.2.1 provided by
      major distribution packages is broken. Not to mention that its test
      suite fails with SEGFAULTs.
      
      Last but not least, some distributions, e.g. CentOS 8 (see #4611) do
      not provide a libunwind package.
      
      Hence, bundle libunwind: bundling is enabled by default on all
      platforms, except for macOS — a system package can be used if its
      version is greater or equal than 1.3.0 (minimal version that does not
      seem to be broken on aarch64-linux-gnu).
      
      * Add new submodule: bump it to current master.
      * Refactor libunwind package search logic out of compiler.cmake.
      * Add CMake script for building bundled libunwind.
      * Add CMake script for extracting version of libunwind.
      * Re-enable backtrace for all RHEL distributions by default.
      * Remove libunwind from static build.
      
      Needed for #4002
      Closes #4611
      
      NO_DOC=build system
      NO_TEST=build system
      7dc9fe44
  22. Dec 21, 2021
    • AnaNek's avatar
      build: link bundled libcurl with nghttp2 · fa8d70ca
      AnaNek authored
      Before this patch Tarantool http client did not support HTTP/2.
      The reasons to enable HTTP/2 support are efficiency offered by
      the protocol and potential ability to interact with a GRPC server.
      The CMake version requirement is updated from 3.2 to 3.3, because
      we need generator expressions in cmake for setting multiple paths
      in CMAKE_FIND_ROOT_PATH for nghttp2 support.
      
      Closes #5771
      
      @TarantoolBot document
      Title: Now we require CMake 3.3 to build tarantool
      
      In tarantool/doc#2065 we requested to update
      the CMake minimum version to 3.2. Now it is time for 3.3.
      See details in the linked commit.
      fa8d70ca
  23. Dec 17, 2021
  24. Dec 14, 2021
    • Vladimir Davydov's avatar
      cmake: allow to set arbitrary version · 8509f163
      Vladimir Davydov authored
      This commit allows to override Tarantool version detection by setting
      CMake TARANTOOL_VERSION variable. This is needed to build Tarantool as a
      part of tarantool/sdk, which sets its own, extended version.
      
      Also, this commit updates box-py/args.test.py to allow arbitrary tags
      appended to the version (tarantool/sdk appends -rNNN).
      8509f163
    • Vladimir Davydov's avatar
      cmake: drop auto-update of submodules · 79f531c9
      Vladimir Davydov authored
      Submodules are auto-updated in two cases:
      1. When cmake is called for the first time (and there's no
         src/lib/small/CMakeLists.txt).
      2. If git-describe version doesn't match the version stored in the
         VERSION file.
      
      The first case looks okay, but the second one is confusing. It means
      that the following sequence of commands does NOT update submodules:
      
      ```sh
      cmake . # initial configuration, fetches small
      cd src/lib/small && git checkout HEAD^ && cd - # checkout small
      cmake . # does NOT update small
      ```
      
      while the following sequence of commands does:
      
      ```sh
      git commit --allow-empty -m dummy
      cmake . # updates small!
      ```
      
      This looks confusing, inconsistent, and dangerous. Let's drop this code
      and let the developers update submodules manually when they need to.
      
      This effectively reverts commit c83eea60
      ("CMake: automatically update submodules").
      79f531c9
    • Vladimir Davydov's avatar
      cmake: take git version from main project · c7546efe
      Vladimir Davydov authored
      Use git from CMAKE_SOURCE_DIR instead of PROJECT_SOURCE_DIR so that if
      Tarantool is built as a sub-project, we will use the version of the main
      project.
      c7546efe
  25. Dec 10, 2021
  26. Dec 09, 2021
  27. Oct 14, 2021
    • Timur Safin's avatar
      build, lua: built-in module datetime · 43e10ed3
      Timur Safin authored
      Introduce a new builtin Tarantool module `datetime.lua` for timestamp
      and interval types support.
      
      New third_party module - c-dt
      -----------------------------
      
      * Integrated chansen/c-dt parser as 3rd party module to the
        Tarantool cmake build process;
      * We use tarantool/c-dt instead of original chansen/c-dt to
        have an easier cmake build integration, as we have added some
        changes, which provide cmake support, and allow to rename symbols
        if necessary (this symbol renaming is similar to that we see
        with xxhash or icu).
      
      New built-in module `datetime`
      ------------------------------
      
      * created a new Tarantool built-in module `datetime`, which uses
        `struct datetime` data structure for keeping timestamp values;
      * Lua module uses a number of `dt_*` functions from `c-dt` library,
        but they were renamed to `tnt_dt_*` at the moment of exporting
        from executable - to avoid possible name clashes with external
        libraries.
      
      * At the moment we libc `strftime` for formatting of datetime
        values according to flags passed, i.e. `date:format('%FT%T%z')`
        will return something like '1970-01-01T00:00:00+0000', but
        `date:format('%A %d, %B %Y')` will return 'Thursday 01, January 1970'
      
      * if there is no format provided then we use default
        `tnt_datetime_to_string()` function, which converts datetime
        to their default ISO-8601 output format, i.e.
        `tostring(date)` will return string like "1970-01-01T00:00:00Z"
      
      * There are a number of simplified interfaces
        - totable() for exporting table with attributes names as provided
          by `os.date('*t')`
        - set() method provides unified interface to set values using
          the set of attributes as defined above in totable()
      
      Example,
      
      ```
      local dt = datetime.new {
      	nsec      = 123456789,
      
      	sec       = 19,
      	min       = 29,
      	hour      = 18,
      
      	day       = 20,
      	month     = 8,
      	year      = 2021,
      
      	tzoffset  = 180
      }
      
      local t = dt:totable()
      --[[
      {
      	sec = 19,
      	min = 29,
      	wday = 6,
      	day = 20,
      	nsec = 123456789,
      	isdst = false,
      	yday = 232,
      	tzoffset = 180,
      	month = 8,
      	year = 2021,
      	hour = 18
      }
      --]]
      
      dt:format()   -- 2021-08-21T14:53:34.032Z
      dt:format('%Y-%m-%dT%H:%M:%S')   -- 2021-08-21T14:53:34
      
      dt:set {
      	usec      = 123456,
      
      	sec       = 19,
      	min       = 29,
      	hour      = 18,
      
      	day       = 20,
      	month     = 8,
      	year      = 2021,
      
      	tzoffset  = 180,
      
      }
      dt:set {
      	timestamp = 1629476485.124,
      
      	tzoffset  = 180,
      }
      
      ```
      
      Coverage is
      
      File                 Hits Missed Coverage
      -----------------------------------------
      builtin/datetime.lua 299  23     92.86%
      -----------------------------------------
      Total                299  23     92.86%
      
      Part of #5941
      
      @TarantoolBot document
      Title: Introduced a new `datetime` module for timestamp and interval support
      
      Create `datetime` module for timestamp and interval types support.
      It allows to create date and timestamp values using either object interface,
      or via parsing of string values conforming to iso-8601 standard.
      One may manipulate (modify, subtract or add) timestamp and interval values.
      
      Please refer to https://hackmd.io/@Mons/S1Vfc_axK#Datetime-in-Tarantool
      for a more detailed description of module API.
      43e10ed3
  28. Aug 12, 2021
  29. Jun 18, 2021
    • Oleg Babin's avatar
      build: add libxxhash to third_party · ce382f96
      Oleg Babin authored
      This patch is the first step for fixing regression introduced in
      f998ea39 (digest: introduce FFI bindings for xxHash32/64).
      We used xxhash library that is shipped with zstd. However it's
      possible that user doesn't use bundled zstd. In such cases we
      couldn't export xxhash symbols and build failed with following
      error:
      
      ```
      [ 59%] Linking CXX executable tarantool
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xd80): undefined reference to `XXH32'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xd88): undefined reference to `XXH32_copyState'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xd90): undefined reference to `XXH32_digest'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xd98): undefined reference to `XXH32_reset'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xda0): undefined reference to `XXH32_update'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xda8): undefined reference to `XXH64'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xdb0): undefined reference to `XXH64_copyState'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xdb8): undefined reference to `XXH64_digest'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xdc0): undefined reference to `XXH64_reset'
      /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/tarantool.dir/exports.c.o:(.data.rel+0xdc8): undefined reference to `XXH64_update'
      collect2: error: ld returned 1 exit status
      ```
      
      To avoid a problem this patch introduces standalone xxhash library
      that will be bundled anyway. It's worth to mention that our
      approach is still related to zstd. We use Cyan4973/xxHash that is
      used in zstd and passes the same compile flags to it. Single
      difference is usage of XXH_NAMESPACE to avoid symbols clashing
      with zstd.
      
      Need for #6135
      ce382f96
  30. Jun 16, 2021
    • mechanik20051988's avatar
      build: fix tarantool build failure on xcode 12.5 · c5ae543f
      mechanik20051988 authored
      `VERSION` files in small subproject and in tarantool are treated as C++
      standard library on a filesystem with case-insensitive names. So we have
      to delete the root of tarantool project from `include_directories` in
      tarantool CMake. Also we have to change `include_directories` in tarantool
      CMake from the root of `small` project to `include` subfolder in `small`
      project.
      Closes #6076
      c5ae543f
Loading