abseil-cpp icon indicating copy to clipboard operation
abseil-cpp copied to clipboard

Build fails vcpkg (x64-linux)

Open Gab-Menezes opened this issue 4 years ago • 1 comments

Describe the bug

Its' not possible to use abseil in x64-linux. It seems some sort of ABI problem (on windows the compilation works). I have already reported this bug on vcpkg repository (https://github.com/microsoft/vcpkg/issues/21625), but they asked to report here because looks like a upstream bug.

Steps to reproduce the bug

A git repository with the code and compilation steps

What version of Abseil are you using? 20210324

What operating system and version are you using Linux (Ubuntu 20.04)

What compiler and version are you using?

  • Compiler: g++ 11.1.0
Starting copying files to remote machine.
Copying 'C:\dev\abseil-build-fail\src\main.cpp' to '/home/gabriel/.vs/abseil-build-fail/src/main.cpp'.
Finished copying files (elapsed time 00h:00m:00s:013ms).
 cd /home/gabriel/.vs/abseil-build-fail/out/build/linux-x64-debug;export VCPKG_FEATURE_FLAGS=manifests,versions,binarycaching,registries;/usr/bin/cmake --build /home/gabriel/.vs/abseil-build-fail/out/build/linux-x64-debug --target main --config Debug --parallel 8 --verbose;

[1/2] /usr/bin/g++  -isystem /home/gabriel/.vs/abseil-build-fail/out/build/linux-x64-debug/vcpkg_installed/x64-linux/include -g -std=gnu++17 -MD -MT CMakeFiles/main.dir/src/main.cpp.o -MF CMakeFiles/main.dir/src/main.cpp.o.d -o CMakeFiles/main.dir/src/main.cpp.o -c /home/gabriel/.vs/abseil-build-fail/src/main.cpp
[2/2] : && /usr/bin/g++ -g  CMakeFiles/main.dir/src/main.cpp.o -o main  vcpkg_installed/x64-linux/debug/lib/libabsl_base.a  vcpkg_installed/x64-linux/debug/lib/libabsl_city.a  vcpkg_installed/x64-linux/debug/lib/libabsl_bad_any_cast_impl.a  vcpkg_installed/x64-linux/debug/lib/libabsl_base.a  vcpkg_installed/x64-linux/debug/lib/libabsl_raw_logging_internal.a  vcpkg_installed/x64-linux/debug/lib/libabsl_log_severity.a  vcpkg_installed/x64-linux/debug/lib/libabsl_spinlock_wait.a  -lpthread  -lrt && :
FAILED: main 
: && /usr/bin/g++ -g  CMakeFiles/main.dir/src/main.cpp.o -o main  vcpkg_installed/x64-linux/debug/lib/libabsl_base.a  vcpkg_installed/x64-linux/debug/lib/libabsl_city.a  vcpkg_installed/x64-linux/debug/lib/libabsl_bad_any_cast_impl.a  vcpkg_installed/x64-linux/debug/lib/libabsl_base.a  vcpkg_installed/x64-linux/debug/lib/libabsl_raw_logging_internal.a  vcpkg_installed/x64-linux/debug/lib/libabsl_log_severity.a  vcpkg_installed/x64-linux/debug/lib/libabsl_spinlock_wait.a  -lpthread  -lrt && :
/usr/bin/ld: CMakeFiles/main.dir/src/main.cpp.o: in function `main':
/home/gabriel/.vs/abseil-build-fail/src/main.cpp:6: undefined reference to `absl::lts_20210324::StrCat[abi:cxx11](absl::lts_20210324::AlphaNum const&, absl::lts_20210324::AlphaNum const&, absl::lts_20210324::AlphaNum const&)'
/usr/bin/ld: CMakeFiles/main.dir/src/main.cpp.o: in function `absl::lts_20210324::AlphaNum::AlphaNum(int)':
/home/gabriel/.vs/abseil-build-fail/out/build/linux-x64-debug/vcpkg_installed/x64-linux/include/absl/strings/str_cat.h:218: undefined reference to `absl::lts_20210324::numbers_internal::FastIntToBuffer(int, char*)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

What build system are you using?

  • CMake (3.21.3)

Aditional information I'm using the cxx17 feature, and the logs say someting about cxx11, but I already made sure that the cxx17 feature is anabled by looking at the abseil files generated after the patch to use std::any, std::optinal, std::string_view and std::variant.

Gab-Menezes avatar Jan 22 '22 01:01 Gab-Menezes

The issue is almost certainly that Abseil isn't being built with the same C++ language version as your program is. Additionally, the vcpkg version is not supported by us.

https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-abi-and-why-dont-you-recommend-using-a-pre-compiled-version-of-abseil

derekmauro avatar Jan 22 '22 15:01 derekmauro