Skip to content
Snippets Groups Projects
Commit 6d088b56 authored by Alexander Turenko's avatar Alexander Turenko Committed by Vladimir Davydov
Browse files

build: fix libunwind.h search in test files

## The problem

Case: a build host has no libunwind installed into the system. Dispite
that tarantool has libunwind bundled as a git submodule (see PR #6877),
the build fails in the case:

NO_WRAP
```
In file included from <...>/src/lib/core/fiber.h:47,
                 from <..some test/**/*.{c,cc} file..>:
<...>/src/lib/core/backtrace.h:14:10: fatal error: libunwind.h: No such file or directory
   14 | #include "libunwind.h"
      |          ^~~~~~~~~~~~~
```
NO_WRAP

The problem appears when `ENABLE_BACKTRACE` and
`ENABLE_BUNDLED_LIBUNWIND` CMake options are enabled. They're enabled by
default for most targets.

The compilation fails for testing files, which include `fiber.h`. The
`fiber.h` header includes `backtrace.h`, which includes `libunwind.h`.
The `libunwind.h` header couldn't be found if appropriate include
directory is not passed to a compiler.

Almost half (45/102) of unit tests includes `fiber.h` directly or
indirectly. Swim fuzzers include it too.

## The solution

Just add libunwind's include directory to compilation of those files.

The include path is added as a system one to suppress warnings from the
third party project. It follows the way the directory is included into
tarantool's build, see PR #6877.

The uri unit test includes `fiber.h`, but actually doesn't use it. The
test has no CMake dependency on the `core` library and so the build
system may attempt to build it before `libunwind.h` is installed into
`LIBUNWIND_INCLUDE_DIR`. Eliminated redundant includes from the test.

Note: this commit solves only a part of the problem: it fixes
compilation of unit tests and fuzzers. There are other test files that
include `fiber.h` and it'll be fixed in the next commit.

Part of #8025

NO_DOC=It is a fix of a build failure.
NO_TEST=It is a fix of a build failure.
NO_CHANGELOG=Only part of the problem is solved here. A following commit
             will add a changelog entry.
parent a79d32b1
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment