protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.1k stars 15.43k forks source link

Abseil linking issues while building from scratch #17539

Open sevaserg opened 1 month ago

sevaserg commented 1 month ago

What version of protobuf and what language are you using? Version: main Language: C++

What operating system (Linux, Windows, ...) and version? MacOS Sonoma 14.3.1 What runtime / compiler are you using (e.g., python version or gcc version) cmake 3.30.0 + Apple clang 15.0.0 (clang-1500.1.0.2.5) What did you do?

git clone https://github.com/protocolbuffers/protobuf
cd protobuf
mkdir build
cd build
cmake ..

What did you expect to see A proper build setup, so I could launch

make install

What did you see instead?

-- The C compiler identification is AppleClang 15.0.0.15000100
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 
-- 29.0.0
-- Performing Test protobuf_HAVE_LD_VERSION_SCRIPT
-- Performing Test protobuf_HAVE_LD_VERSION_SCRIPT - Failed
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/lib/libz.tbd (found version "1.2.12")
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
CMake Warning at third_party/abseil-cpp/CMakeLists.txt:82 (message):
  A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake
  3.8 and up.  We recommend enabling this option to ensure your project still
  builds correctly.

-- Performing Test ABSL_INTERNAL_AT_LEAST_CXX17
-- Performing Test ABSL_INTERNAL_AT_LEAST_CXX17 - Failed
-- Performing Test ABSL_INTERNAL_AT_LEAST_CXX20
-- Performing Test ABSL_INTERNAL_AT_LEAST_CXX20 - Failed
-- Configuring done (1.1s)
CMake Error at third_party/abseil-cpp/CMake/AbseilHelpers.cmake:317 (target_link_libraries):
  The link interface of target "random_mocking_bit_gen" contains:

    absl::random_internal_mock_overload_set

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  third_party/abseil-cpp/absl/random/CMakeLists.txt:100 (absl_cc_library)

-- Generating done (0.6s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

Anything else we should know about your project / environment Before attempting doing anything I have intentionally removed protobuf and abseil previously installed by brew:

 % brew uninstall protobuf
Uninstalling /opt/homebrew/Cellar/protobuf/27.1... (430 files, 14.6MB)
==> Autoremoving 1 unneeded formula:
abseil
Uninstalling /opt/homebrew/Cellar/abseil/20240116.2... (748 files, 10.9MB)
sevaserg commented 1 month ago

I have discovered that setting ABSL_BUILD_TESTING to ON fixes the problem with this step, but it still looks like an issue to be fixed. But when I call

cmake .. -DABSL_BUILD_TESTING=ON -DCMAKE_CXX_STANDARD=17 && make install

I get this output:

error: static assertion failed due to requirement '!absl::is_trivially_relocatable<S>::value': 
  static_assert(!absl::is_trivially_relocatable<S>::value, "");