← All tasks
cppabseil/abseil-cpp #225Not checked yet

Cmake links all abseil components and results in a link time error

envgap__abseil__abseil-cpp-225

Original GitHub issue ↗Opened 2018-11-24

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not checked yet.
  • No curated issue-specific recipe or verified environment fix is available.

02 / ENVIRONMENT RECIPE

Base commit
Not freshly verified
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

abseil/abseil-cpp #225 · read the original issue
No matter what I try, cmake builds the whole abseil and then links everything into my shared library. I could reproduce this with a minimal cmake example:

```cmake

cmake_minimum_required(VERSION 2.8.12)

project(my_project)

set(CMAKE_CXX_FLAGS "-std=c++11 -fvisibility=hidden ${CMAKE_CXX_FLAGS}")

add_subdirectory(abseil-cpp)

add_library(my_lib SHARED main.cpp)

include_directories(SYSTEM abseil-cpp)

target_link_libraries(my_lib absl::hash absl::container)

```

`main.cpp` contains only the following:

```cpp

#include <absl/container/flat_hash_map.h>

int foo(void) {

	absl::flat_hash_map<int,int> m;

	return 0;

}

```



For an actual project where I'm trying to use abseil, I get a linker error in debug mode that says the following:

```

/usr/sbin/ld: ../absail/absl/container/libabsl_container.a(raw_hash_set.cc.o): relocation R_X86_64_TPOFF32 against hidden symbol `_ZZN4absl18container_internal10RandomSeedEvE7counter' can not be used when making a shared object

```

The project in question is [here](https://github.com/bstaletic/ycmd/tree/abseil).

[Top level `CmakeLists.txt`](https://github.com/bstaletic/ycmd/blob/abseil/cpp/CMakeLists.txt#L268)

[Shared object defining `CMakeLists.txt`](https://github.com/bstaletic/ycmd/blob/abseil/cpp/ycm/CMakeLists.txt)

Abseil, at commit a06c4a1, is a submodule of my project. The build instructions are:

- Clone bstaletic/ycmd and checkout aseil branch

- `git submodule update --init --recursive`

- `mkdir build && cd build`

- `cmake ../cpp -DCMAKE_BUILD_TYPE=Debug`



Other build time dependencies are python headers. For python3 `-DUSE_PYTHON2=OFF` is needed.
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]

Issue-specific recipe and runtime smoke command require review against the complete issue and repository.

Legacy reproduction is generic install-only; match the actual issue failure before admission.