Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

23.0: issue with generated protobuf.pc files (it depends on utf8_range) #12746

Closed
kloczek opened this issue May 9, 2023 · 60 comments
Closed
Assignees
Labels
inactive Denotes the issue/PR has not seen activity in the last 90 days.

Comments

@kloczek
Copy link

kloczek commented May 9, 2023

Looks like generated protobuf.pc has in Requires utf8_range.

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include

Name: Protocol Buffers
Description: Google's Data Interchange Format
Version: 23.0.0
Requires: absl_absl_check absl_absl_log absl_algorithm absl_base absl_bind_front absl_bits absl_btree absl_cleanup absl_cord absl_core_headers absl_debugging absl_die_if_null absl_dynamic_annotations absl_flags absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_layout absl_log_initialize absl_log_severity absl_memory absl_node_hash_map absl_node_hash_set absl_optional absl_span absl_status absl_statusor absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant utf8_range
Libs: -L${libdir} -lprotobuf
Cflags: -I${includedir} -DPROTOBUF_USE_DLLS
Conflicts: protobuf-lite
@kloczek kloczek added the untriaged auto added to all issues by default when created. label May 9, 2023
@kloczek
Copy link
Author

kloczek commented May 9, 2023

In generated protobuf-config.cmake I see as well:

# User options
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake")

# Depend packages

if(NOT TARGET absl::strings)
  find_package(absl CONFIG)
endif()
if(NOT TARGET utf8_range)
  find_package(utf8_range CONFIG)
endif()

# Imported targets
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake")

# protobuf-generate function
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-generate.cmake")

# CMake FindProtobuf module compatible file
if(protobuf_MODULE_COMPATIBLE)
  include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake")
endif()

@kloczek
Copy link
Author

kloczek commented May 9, 2023

Just in case I've build protobuf with -D utf8_range_ENABLE_INSTALL=OFF.

@kloczek
Copy link
Author

kloczek commented May 10, 2023

I've added quick hack to remove utf8_range from Requires on rpm package %install stage.
With such product I was able to start testing use generated package on building other packages.
Results:

  • libphonenumber build fails:
[ 81%] Linking CXX executable libphonenumber_test
/usr/bin/cmake -E cmake_link_script CMakeFiles/libphonenumber_test.dir/link.txt --verbose=1
/usr/bin/g++ -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -DNDEBUG -Wl,--gc-sections -Wl,--as-needed -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--build-id=sha1 CMakeFiles/libphonenumber_test.dir/test/phonenumbers/asyoutypeformatter_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/logger_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/matcher_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumberutil_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/regexp_adapter_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/regexp_cache_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/run_tests.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/shortnumberinfo_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/stringutil_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/test_util.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/unicodestring_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/utf/unicodetext_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/area_code_map_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/geocoding_data_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/geocoding_test_data.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/mapping_file_provider_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/phonenumber_offline_geocoder_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumbermatch_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumbermatcher_test.cc.o -o libphonenumber_test  libphonenumber_testing.a /usr/lib64/libgtest.so -lpthread /usr/lib64/libicuuc.so /usr/lib64/libicui18n.so /usr/lib64/libprotobuf.so /usr/lib64/libabsl_cord.so.2301.0.0 /usr/lib64/libabsl_cordz_info.so.2301.0.0 /usr/lib64/libabsl_cord_internal.so.2301.0.0 /usr/lib64/libabsl_cordz_functions.so.2301.0.0 /usr/lib64/libabsl_cordz_handle.so.2301.0.0 /usr/lib64/libabsl_crc_cord_state.so.2301.0.0 /usr/lib64/libabsl_crc32c.so.2301.0.0 /usr/lib64/libabsl_crc_internal.so.2301.0.0 /usr/lib64/libabsl_crc_cpu_detect.so.2301.0.0 /usr/lib64/libabsl_hash.so.2301.0.0 /usr/lib64/libabsl_city.so.2301.0.0 /usr/lib64/libabsl_bad_variant_access.so.2301.0.0 /usr/lib64/libabsl_low_level_hash.so.2301.0.0 /usr/lib64/libabsl_raw_hash_set.so.2301.0.0 /usr/lib64/libabsl_hashtablez_sampler.so.2301.0.0 /usr/lib64/libabsl_exponential_biased.so.2301.0.0 /usr/lib64/libabsl_bad_optional_access.so.2301.0.0 /usr/lib64/libabsl_synchronization.so.2301.0.0 /usr/lib64/libabsl_graphcycles_internal.so.2301.0.0 /usr/lib64/libabsl_stacktrace.so.2301.0.0 /usr/lib64/libabsl_symbolize.so.2301.0.0 /usr/lib64/libabsl_malloc_internal.so.2301.0.0 /usr/lib64/libabsl_debugging_internal.so.2301.0.0 /usr/lib64/libabsl_demangle_internal.so.2301.0.0 /usr/lib64/libabsl_time.so.2301.0.0 /usr/lib64/libabsl_strings.so.2301.0.0 /usr/lib64/libabsl_strings_internal.so.2301.0.0 /usr/lib64/libabsl_throw_delegate.so.2301.0.0 /usr/lib64/libabsl_base.so.2301.0.0 /usr/lib64/libabsl_spinlock_wait.so.2301.0.0 /usr/lib64/libabsl_int128.so.2301.0.0 /usr/lib64/libabsl_raw_logging_internal.so.2301.0.0 /usr/lib64/libabsl_log_severity.so.2301.0.0 /usr/lib64/libabsl_civil_time.so.2301.0.0 /usr/lib64/libabsl_time_zone.so.2301.0.0 /usr/lib64/libboost_date_time.so /usr/lib64/libboost_system.so -lboost_thread /usr/lib64/libboost_chrono.so /usr/lib64/libboost_atomic.so
/usr/bin/ld: /tmp/ccOihmdo.lto.o: in function `google::protobuf::RepeatedField<int>::GrowNoAnnotate(int, int)':
/usr/include/google/protobuf/thread_safe_arena.h:198: undefined reference to `google::protobuf::internal::ThreadSafeArena::thread_cache_'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/libphonenumber_test.dir/build.make:442: libphonenumber_test] Error 1
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/libphonenumber-8.13.11/x86_64-redhat-linux-gnu'
make[1]: *** [CMakeFiles/Makefile2:359: CMakeFiles/libphonenumber_test.dir/all] Error 2
make[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/libphonenumber-8.13.11/x86_64-redhat-linux-gnu'
make: *** [Makefile:159: all] Error 2
  • mysql
[ 17%] Linking CXX executable ../../../../runtime_output_directory/xprotocol_plugin
cd /home/tkloczko/rpmbuild/BUILD/mysql-8.0.33/x86_64-redhat-linux-gnu/plugin/x/protocol/plugin && /usr/bin/cmake -E cmake_link_script CMakeFiles/xprotocol_plugin.dir/link.txt --verbose=1
/usr/bin/g++ -std=c++17 -fno-omit-frame-pointer -ftls-model=initial-exec -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wall -Wextra -Wformat-security -Wvla -Wundef -Wmissing-format-attribute -Woverloaded-virtual -Wcast-qual -Wimplicit-fallthrough=5 -Wstringop-truncation -Wsuggest-override -Wmissing-include-dirs -Wextra-semi -Wlogical-op -ffunction-sections -fdata-sections -DNDEBUG -Wl,--gc-sections -Wl,--as-needed -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--as-needed -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--build-id=sha1  -Wl,--build-id=sha1 -Wl,--no-as-needed -lpthread CMakeFiles/xprotocol_plugin.dir/message_field_chain.cc.o CMakeFiles/xprotocol_plugin.dir/messages_used_by_server.cc.o CMakeFiles/xprotocol_plugin.dir/xprotocol_plugin.cc.o -o ../../../../runtime_output_directory/xprotocol_plugin  ../protobuf/libmysqlxmessages.a /usr/lib64/libprotoc.so /usr/lib64/libprotobuf.so
/usr/bin/ld: /usr/lib64/libprotoc.so: undefined reference to symbol '_ZN4absl12lts_2023012513base_internal12SpinLockWaitEPSt6atomicIjEiPKNS1_22SpinLockWaitTransitionENS1_14SchedulingModeE'
/usr/bin/ld: /usr/lib64/libabsl_spinlock_wait.so.2301.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [plugin/x/protocol/plugin/CMakeFiles/xprotocol_plugin.dir/build.make:135: runtime_output_directory/xprotocol_plugin] Error 1
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/mysql-8.0.33/x86_64-redhat-linux-gnu'
make[1]: *** [CMakeFiles/Makefile2:9718: plugin/x/protocol/plugin/CMakeFiles/xprotocol_plugin.dir/all] Error 2
make[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/mysql-8.0.33/x86_64-redhat-linux-gnu'
make: *** [Makefile:169: all] Error 2
  • opencv
[ 21%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/opencv-caffe.pb.cc.o
cd /home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu/modules/dnn && /usr/bin/g++ -DCVAPI_EXPORTS -DENABLE_PLUGINS -DHAVE_PROTOBUF=1 -DOPENCV_DNN_EXTERNAL_PROTOBUF=1 -DVK_NO_PROTOTYPES -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu -I/usr/include/vulkan -I/home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/modules/dnn/include -I/home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu/modules/dnn -I/home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/modules/core/include -I/home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/modules/imgproc/include -isystem /usr/include/eigen3 -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wundef -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -Wno-deprecated -Wno-missing-declarations -Wno-shadow -Wno-unused-parameter -Wno-sign-compare -Wno-invalid-offsetof -DNDEBUG -std=c++11 -fPIC -Wno-suggest-override -Wno-array-bounds -MD -MT modules/dnn/CMakeFiles/opencv_dnn.dir/opencv-caffe.pb.cc.o -MF CMakeFiles/opencv_dnn.dir/opencv-caffe.pb.cc.o.d -o CMakeFiles/opencv_dnn.dir/opencv-caffe.pb.cc.o -c /home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu/modules/dnn/opencv-caffe.pb.cc
In file included from /usr/include/absl/base/config.h:86,
                 from /usr/include/absl/base/attributes.h:37,
                 from /usr/include/absl/strings/string_view.h:39,
                 from /usr/include/google/protobuf/stubs/common.h:44,
                 from /usr/include/google/protobuf/io/coded_stream.h:130,
                 from /home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu/modules/dnn/opencv-caffe.pb.h:24,
                 from /home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu/modules/dnn/opencv-caffe.pb.cc:4:
/usr/include/absl/base/policy_checks.h:79:2: error: #error "C++ versions less than C++14 are not supported."
   79 | #error "C++ versions less than C++14 are not supported."
      |  ^~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu/modules/dnn/opencv-caffe.pb.h:11:
/usr/include/google/protobuf/port_def.inc:205:15: error: static assertion failed: Protobuf only supports C++14 and newer.
  205 | static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");
      |               ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/google/protobuf/port_def.inc:205:15: note: the comparison reduces to ‘(201103 >= 201402)’
/usr/include/absl/strings/string_view.h:52:26: error: ‘string_view’ in namespace ‘std’ does not name a type
   52 | using string_view = std::string_view;
      |                          ^~~~~~~~~~~
/usr/include/absl/strings/string_view.h:52:21: note: ‘std::string_view’ is only available from C++17 onwards
   52 | using string_view = std::string_view;
      |                     ^~~
/usr/include/absl/strings/string_view.h:686:8: error: ‘string_view’ does not name a type
  686 | inline string_view ClippedSubstr(string_view s, size_t pos,
      |        ^~~~~~~~~~~
/usr/include/absl/strings/string_view.h:697:11: error: ‘string_view’ does not name a type
  697 | constexpr string_view NullSafeStringView(const char* p) {
      |           ^~~~~~~~~~~
In file included from /usr/include/google/protobuf/stubs/port.h:45,
                 from /usr/include/google/protobuf/stubs/common.h:46:
/usr/include/google/protobuf/port_def.inc:205:15: error: static assertion failed: Protobuf only supports C++14 and newer.
  205 | static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");
      |               ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/google/protobuf/port_def.inc:205:15: note: the comparison reduces to ‘(201103 >= 201402)’
In file included from /usr/include/google/protobuf/stubs/common.h:56:
/usr/include/google/protobuf/port_def.inc:205:15: error: static assertion failed: Protobuf only supports C++14 and newer.
  205 | static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");
      |               ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/google/protobuf/port_def.inc:205:15: note: the comparison reduces to ‘(201103 >= 201402)’
In file included from /usr/include/absl/log/internal/check_op.h:36,
                 from /usr/include/absl/log/internal/check_impl.h:19,
                 from /usr/include/absl/log/absl_check.h:38,
                 from /usr/include/google/protobuf/io/coded_stream.h:132:
/usr/include/absl/log/internal/nullstream.h:49:32: error: ‘absl::string_view’ has not been declared
   49 |   NullStream& AtLocation(absl::string_view, int) { return *this; }
      |                                ^~~~~~~~~~~
In file included from /usr/include/absl/time/time.h:89,
                 from /usr/include/absl/log/log_entry.h:35,
                 from /usr/include/absl/log/internal/log_message.h:41,
                 from /usr/include/absl/log/internal/strip.h:24,
                 from /usr/include/absl/log/internal/check_op.h:37:
/usr/include/absl/time/civil_time.h:489:27: error: ‘string_view’ is not a member of ‘absl’
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |                           ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:489:53: error: expected primary-expression before ‘*’ token
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |                                                     ^
/usr/include/absl/time/civil_time.h:489:55: error: ‘c’ was not declared in this scope
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |                                                       ^
/usr/include/absl/time/civil_time.h:489:56: error: expression list treated as compound expression in initializer [-fpermissive]
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |                                                        ^
/usr/include/absl/time/civil_time.h:490:6: error: redefinition of ‘bool absl::lts_20230125::ParseCivilTime’
  490 | bool ParseCivilTime(absl::string_view s, CivilMinute* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:489:6: note: ‘bool absl::lts_20230125::ParseCivilTime’ previously defined here
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:490:27: error: ‘string_view’ is not a member of ‘absl’
  490 | bool ParseCivilTime(absl::string_view s, CivilMinute* c);
      |                           ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:490:53: error: expected primary-expression before ‘*’ token
  490 | bool ParseCivilTime(absl::string_view s, CivilMinute* c);
      |                                                     ^
/usr/include/absl/time/civil_time.h:490:55: error: ‘c’ was not declared in this scope
  490 | bool ParseCivilTime(absl::string_view s, CivilMinute* c);
      |                                                       ^
/usr/include/absl/time/civil_time.h:491:6: error: redefinition of ‘bool absl::lts_20230125::ParseCivilTime’
  491 | bool ParseCivilTime(absl::string_view s, CivilHour* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:489:6: note: ‘bool absl::lts_20230125::ParseCivilTime’ previously defined here
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:491:27: error: ‘string_view’ is not a member of ‘absl’
  491 | bool ParseCivilTime(absl::string_view s, CivilHour* c);
      |                           ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:491:51: error: expected primary-expression before ‘*’ token
  491 | bool ParseCivilTime(absl::string_view s, CivilHour* c);
      |                                                   ^
/usr/include/absl/time/civil_time.h:491:53: error: ‘c’ was not declared in this scope
  491 | bool ParseCivilTime(absl::string_view s, CivilHour* c);
      |                                                     ^
/usr/include/absl/time/civil_time.h:492:6: error: redefinition of ‘bool absl::lts_20230125::ParseCivilTime’
  492 | bool ParseCivilTime(absl::string_view s, CivilDay* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:489:6: note: ‘bool absl::lts_20230125::ParseCivilTime’ previously defined here
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:492:27: error: ‘string_view’ is not a member of ‘absl’
  492 | bool ParseCivilTime(absl::string_view s, CivilDay* c);
      |                           ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:492:50: error: expected primary-expression before ‘*’ token
  492 | bool ParseCivilTime(absl::string_view s, CivilDay* c);
      |                                                  ^
/usr/include/absl/time/civil_time.h:492:52: error: ‘c’ was not declared in this scope
  492 | bool ParseCivilTime(absl::string_view s, CivilDay* c);
      |                                                    ^
/usr/include/absl/time/civil_time.h:493:6: error: redefinition of ‘bool absl::lts_20230125::ParseCivilTime’
  493 | bool ParseCivilTime(absl::string_view s, CivilMonth* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:489:6: note: ‘bool absl::lts_20230125::ParseCivilTime’ previously defined here
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:493:27: error: ‘string_view’ is not a member of ‘absl’
  493 | bool ParseCivilTime(absl::string_view s, CivilMonth* c);
      |                           ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:493:52: error: expected primary-expression before ‘*’ token
  493 | bool ParseCivilTime(absl::string_view s, CivilMonth* c);
      |                                                    ^
/usr/include/absl/time/civil_time.h:493:54: error: ‘c’ was not declared in this scope
  493 | bool ParseCivilTime(absl::string_view s, CivilMonth* c);
      |                                                      ^
/usr/include/absl/time/civil_time.h:494:6: error: redefinition of ‘bool absl::lts_20230125::ParseCivilTime’
  494 | bool ParseCivilTime(absl::string_view s, CivilYear* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:489:6: note: ‘bool absl::lts_20230125::ParseCivilTime’ previously defined here
  489 | bool ParseCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:494:27: error: ‘string_view’ is not a member of ‘absl’
  494 | bool ParseCivilTime(absl::string_view s, CivilYear* c);
      |                           ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:494:51: error: expected primary-expression before ‘*’ token
  494 | bool ParseCivilTime(absl::string_view s, CivilYear* c);
      |                                                   ^
/usr/include/absl/time/civil_time.h:494:53: error: ‘c’ was not declared in this scope
  494 | bool ParseCivilTime(absl::string_view s, CivilYear* c);
      |                                                     ^
/usr/include/absl/time/civil_time.h:509:34: error: ‘string_view’ is not a member of ‘absl’
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |                                  ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:509:60: error: expected primary-expression before ‘*’ token
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |                                                            ^
/usr/include/absl/time/civil_time.h:509:62: error: ‘c’ was not declared in this scope
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |                                                              ^
/usr/include/absl/time/civil_time.h:509:63: error: expression list treated as compound expression in initializer [-fpermissive]
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |                                                               ^
/usr/include/absl/time/civil_time.h:510:6: error: redefinition of ‘bool absl::lts_20230125::ParseLenientCivilTime’
  510 | bool ParseLenientCivilTime(absl::string_view s, CivilMinute* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:509:6: note: ‘bool absl::lts_20230125::ParseLenientCivilTime’ previously defined here
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:510:34: error: ‘string_view’ is not a member of ‘absl’
  510 | bool ParseLenientCivilTime(absl::string_view s, CivilMinute* c);
      |                                  ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:510:60: error: expected primary-expression before ‘*’ token
  510 | bool ParseLenientCivilTime(absl::string_view s, CivilMinute* c);
      |                                                            ^
/usr/include/absl/time/civil_time.h:510:62: error: ‘c’ was not declared in this scope
  510 | bool ParseLenientCivilTime(absl::string_view s, CivilMinute* c);
      |                                                              ^
/usr/include/absl/time/civil_time.h:511:6: error: redefinition of ‘bool absl::lts_20230125::ParseLenientCivilTime’
  511 | bool ParseLenientCivilTime(absl::string_view s, CivilHour* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:509:6: note: ‘bool absl::lts_20230125::ParseLenientCivilTime’ previously defined here
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:511:34: error: ‘string_view’ is not a member of ‘absl’
  511 | bool ParseLenientCivilTime(absl::string_view s, CivilHour* c);
      |                                  ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:511:58: error: expected primary-expression before ‘*’ token
  511 | bool ParseLenientCivilTime(absl::string_view s, CivilHour* c);
      |                                                          ^
/usr/include/absl/time/civil_time.h:511:60: error: ‘c’ was not declared in this scope
  511 | bool ParseLenientCivilTime(absl::string_view s, CivilHour* c);
      |                                                            ^
/usr/include/absl/time/civil_time.h:512:6: error: redefinition of ‘bool absl::lts_20230125::ParseLenientCivilTime’
  512 | bool ParseLenientCivilTime(absl::string_view s, CivilDay* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:509:6: note: ‘bool absl::lts_20230125::ParseLenientCivilTime’ previously defined here
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:512:34: error: ‘string_view’ is not a member of ‘absl’
  512 | bool ParseLenientCivilTime(absl::string_view s, CivilDay* c);
      |                                  ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:512:57: error: expected primary-expression before ‘*’ token
  512 | bool ParseLenientCivilTime(absl::string_view s, CivilDay* c);
      |                                                         ^
/usr/include/absl/time/civil_time.h:512:59: error: ‘c’ was not declared in this scope
  512 | bool ParseLenientCivilTime(absl::string_view s, CivilDay* c);
      |                                                           ^
/usr/include/absl/time/civil_time.h:513:6: error: redefinition of ‘bool absl::lts_20230125::ParseLenientCivilTime’
  513 | bool ParseLenientCivilTime(absl::string_view s, CivilMonth* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:509:6: note: ‘bool absl::lts_20230125::ParseLenientCivilTime’ previously defined here
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:513:34: error: ‘string_view’ is not a member of ‘absl’
  513 | bool ParseLenientCivilTime(absl::string_view s, CivilMonth* c);
      |                                  ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:513:59: error: expected primary-expression before ‘*’ token
  513 | bool ParseLenientCivilTime(absl::string_view s, CivilMonth* c);
      |                                                           ^
/usr/include/absl/time/civil_time.h:513:61: error: ‘c’ was not declared in this scope
  513 | bool ParseLenientCivilTime(absl::string_view s, CivilMonth* c);
      |                                                             ^
/usr/include/absl/time/civil_time.h:514:6: error: redefinition of ‘bool absl::lts_20230125::ParseLenientCivilTime’
  514 | bool ParseLenientCivilTime(absl::string_view s, CivilYear* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:509:6: note: ‘bool absl::lts_20230125::ParseLenientCivilTime’ previously defined here
  509 | bool ParseLenientCivilTime(absl::string_view s, CivilSecond* c);
      |      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:514:34: error: ‘string_view’ is not a member of ‘absl’
  514 | bool ParseLenientCivilTime(absl::string_view s, CivilYear* c);
      |                                  ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:514:58: error: expected primary-expression before ‘*’ token
  514 | bool ParseLenientCivilTime(absl::string_view s, CivilYear* c);
      |                                                          ^
/usr/include/absl/time/civil_time.h:514:60: error: ‘c’ was not declared in this scope
  514 | bool ParseLenientCivilTime(absl::string_view s, CivilYear* c);
      |                                                            ^
/usr/include/absl/time/civil_time.h:540:26: error: ‘string_view’ is not a member of ‘absl’
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:540:52: error: expected primary-expression before ‘*’ token
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |                                                    ^
/usr/include/absl/time/civil_time.h:540:54: error: ‘c’ was not declared in this scope
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |                                                      ^
/usr/include/absl/time/civil_time.h:540:68: error: expected primary-expression before ‘*’ token
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |                                                                    ^
/usr/include/absl/time/civil_time.h:540:70: error: ‘error’ was not declared in this scope; did you mean ‘perror’?
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |                                                                      ^~~~~
      |                                                                      perror
/usr/include/absl/time/civil_time.h:540:75: error: expression list treated as compound expression in initializer [-fpermissive]
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |                                                                           ^
/usr/include/absl/time/civil_time.h:541:6: error: redefinition of ‘bool absl::lts_20230125::time_internal::AbslParseFlag’
  541 | bool AbslParseFlag(absl::string_view s, CivilMinute* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:540:6: note: ‘bool absl::lts_20230125::time_internal::AbslParseFlag’ previously defined here
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:541:26: error: ‘string_view’ is not a member of ‘absl’
  541 | bool AbslParseFlag(absl::string_view s, CivilMinute* c, std::string* error);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:541:52: error: expected primary-expression before ‘*’ token
  541 | bool AbslParseFlag(absl::string_view s, CivilMinute* c, std::string* error);
      |                                                    ^
/usr/include/absl/time/civil_time.h:541:54: error: ‘c’ was not declared in this scope
  541 | bool AbslParseFlag(absl::string_view s, CivilMinute* c, std::string* error);
      |                                                      ^
/usr/include/absl/time/civil_time.h:541:68: error: expected primary-expression before ‘*’ token
  541 | bool AbslParseFlag(absl::string_view s, CivilMinute* c, std::string* error);
      |                                                                    ^
/usr/include/absl/time/civil_time.h:541:70: error: ‘error’ was not declared in this scope; did you mean ‘perror’?
  541 | bool AbslParseFlag(absl::string_view s, CivilMinute* c, std::string* error);
      |                                                                      ^~~~~
      |                                                                      perror
/usr/include/absl/time/civil_time.h:542:6: error: redefinition of ‘bool absl::lts_20230125::time_internal::AbslParseFlag’
  542 | bool AbslParseFlag(absl::string_view s, CivilHour* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:540:6: note: ‘bool absl::lts_20230125::time_internal::AbslParseFlag’ previously defined here
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:542:26: error: ‘string_view’ is not a member of ‘absl’
  542 | bool AbslParseFlag(absl::string_view s, CivilHour* c, std::string* error);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:542:50: error: expected primary-expression before ‘*’ token
  542 | bool AbslParseFlag(absl::string_view s, CivilHour* c, std::string* error);
      |                                                  ^
/usr/include/absl/time/civil_time.h:542:52: error: ‘c’ was not declared in this scope
  542 | bool AbslParseFlag(absl::string_view s, CivilHour* c, std::string* error);
      |                                                    ^
/usr/include/absl/time/civil_time.h:542:66: error: expected primary-expression before ‘*’ token
  542 | bool AbslParseFlag(absl::string_view s, CivilHour* c, std::string* error);
      |                                                                  ^
/usr/include/absl/time/civil_time.h:542:68: error: ‘error’ was not declared in this scope; did you mean ‘perror’?
  542 | bool AbslParseFlag(absl::string_view s, CivilHour* c, std::string* error);
      |                                                                    ^~~~~
      |                                                                    perror
/usr/include/absl/time/civil_time.h:543:6: error: redefinition of ‘bool absl::lts_20230125::time_internal::AbslParseFlag’
  543 | bool AbslParseFlag(absl::string_view s, CivilDay* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:540:6: note: ‘bool absl::lts_20230125::time_internal::AbslParseFlag’ previously defined here
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:543:26: error: ‘string_view’ is not a member of ‘absl’
  543 | bool AbslParseFlag(absl::string_view s, CivilDay* c, std::string* error);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:543:49: error: expected primary-expression before ‘*’ token
  543 | bool AbslParseFlag(absl::string_view s, CivilDay* c, std::string* error);
      |                                                 ^
/usr/include/absl/time/civil_time.h:543:51: error: ‘c’ was not declared in this scope
  543 | bool AbslParseFlag(absl::string_view s, CivilDay* c, std::string* error);
      |                                                   ^
/usr/include/absl/time/civil_time.h:543:65: error: expected primary-expression before ‘*’ token
  543 | bool AbslParseFlag(absl::string_view s, CivilDay* c, std::string* error);
      |                                                                 ^
/usr/include/absl/time/civil_time.h:543:67: error: ‘error’ was not declared in this scope; did you mean ‘perror’?
  543 | bool AbslParseFlag(absl::string_view s, CivilDay* c, std::string* error);
      |                                                                   ^~~~~
      |                                                                   perror
/usr/include/absl/time/civil_time.h:544:6: error: redefinition of ‘bool absl::lts_20230125::time_internal::AbslParseFlag’
  544 | bool AbslParseFlag(absl::string_view s, CivilMonth* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:540:6: note: ‘bool absl::lts_20230125::time_internal::AbslParseFlag’ previously defined here
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:544:26: error: ‘string_view’ is not a member of ‘absl’
  544 | bool AbslParseFlag(absl::string_view s, CivilMonth* c, std::string* error);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:544:51: error: expected primary-expression before ‘*’ token
  544 | bool AbslParseFlag(absl::string_view s, CivilMonth* c, std::string* error);
      |                                                   ^
/usr/include/absl/time/civil_time.h:544:53: error: ‘c’ was not declared in this scope
  544 | bool AbslParseFlag(absl::string_view s, CivilMonth* c, std::string* error);
      |                                                     ^
/usr/include/absl/time/civil_time.h:544:67: error: expected primary-expression before ‘*’ token
  544 | bool AbslParseFlag(absl::string_view s, CivilMonth* c, std::string* error);
      |                                                                   ^
/usr/include/absl/time/civil_time.h:544:69: error: ‘error’ was not declared in this scope; did you mean ‘perror’?
  544 | bool AbslParseFlag(absl::string_view s, CivilMonth* c, std::string* error);
      |                                                                     ^~~~~
      |                                                                     perror
/usr/include/absl/time/civil_time.h:545:6: error: redefinition of ‘bool absl::lts_20230125::time_internal::AbslParseFlag’
  545 | bool AbslParseFlag(absl::string_view s, CivilYear* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:540:6: note: ‘bool absl::lts_20230125::time_internal::AbslParseFlag’ previously defined here
  540 | bool AbslParseFlag(absl::string_view s, CivilSecond* c, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/civil_time.h:545:26: error: ‘string_view’ is not a member of ‘absl’
  545 | bool AbslParseFlag(absl::string_view s, CivilYear* c, std::string* error);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/civil_time.h:545:50: error: expected primary-expression before ‘*’ token
  545 | bool AbslParseFlag(absl::string_view s, CivilYear* c, std::string* error);
      |                                                  ^
/usr/include/absl/time/civil_time.h:545:52: error: ‘c’ was not declared in this scope
  545 | bool AbslParseFlag(absl::string_view s, CivilYear* c, std::string* error);
      |                                                    ^
/usr/include/absl/time/civil_time.h:545:66: error: expected primary-expression before ‘*’ token
  545 | bool AbslParseFlag(absl::string_view s, CivilYear* c, std::string* error);
      |                                                                  ^
/usr/include/absl/time/civil_time.h:545:68: error: ‘error’ was not declared in this scope; did you mean ‘perror’?
  545 | bool AbslParseFlag(absl::string_view s, CivilYear* c, std::string* error);
      |                                                                    ^~~~~
      |                                                                    perror
/usr/include/absl/time/time.h:619:26: error: ‘string_view’ is not a member of ‘absl’
  619 | bool ParseDuration(absl::string_view dur_string, Duration* d);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/time.h:619:58: error: expected primary-expression before ‘*’ token
  619 | bool ParseDuration(absl::string_view dur_string, Duration* d);
      |                                                          ^
/usr/include/absl/time/time.h:619:60: error: ‘d’ was not declared in this scope
  619 | bool ParseDuration(absl::string_view dur_string, Duration* d);
      |                                                            ^
/usr/include/absl/time/time.h:619:61: error: expression list treated as compound expression in initializer [-fpermissive]
  619 | bool ParseDuration(absl::string_view dur_string, Duration* d);
      |                                                             ^
/usr/include/absl/time/time.h:626:26: error: ‘string_view’ is not a member of ‘absl’
  626 | bool AbslParseFlag(absl::string_view text, Duration* dst, std::string* error);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/time.h:626:52: error: expected primary-expression before ‘*’ token
  626 | bool AbslParseFlag(absl::string_view text, Duration* dst, std::string* error);
      |                                                    ^
/usr/include/absl/time/time.h:626:54: error: ‘dst’ was not declared in this scope
  626 | bool AbslParseFlag(absl::string_view text, Duration* dst, std::string* error);
      |                                                      ^~~
/usr/include/absl/time/time.h:626:70: error: expected primary-expression before ‘*’ token
  626 | bool AbslParseFlag(absl::string_view text, Duration* dst, std::string* error);
      |                                                                      ^
/usr/include/absl/time/time.h:626:72: error: ‘error’ was not declared in this scope; did you mean ‘perror’?
  626 | bool AbslParseFlag(absl::string_view text, Duration* dst, std::string* error);
      |                                                                        ^~~~~
      |                                                                        perror
/usr/include/absl/time/time.h:626:77: error: expression list treated as compound expression in initializer [-fpermissive]
  626 | bool AbslParseFlag(absl::string_view text, Duration* dst, std::string* error);
      |                                                                             ^
/usr/include/absl/time/time.h:934:6: error: redefinition of ‘bool absl::lts_20230125::AbslParseFlag’
  934 | bool AbslParseFlag(absl::string_view text, Time* t, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/time.h:626:6: note: ‘bool absl::lts_20230125::AbslParseFlag’ previously defined here
  626 | bool AbslParseFlag(absl::string_view text, Duration* dst, std::string* error);
      |      ^~~~~~~~~~~~~
/usr/include/absl/time/time.h:934:26: error: ‘string_view’ is not a member of ‘absl’
  934 | bool AbslParseFlag(absl::string_view text, Time* t, std::string* error);
      |                          ^~~~~~~~~~~
/usr/include/absl/time/time.h:934:48: error: expected primary-expression before ‘*’ token
  934 | bool AbslParseFlag(absl::string_view text, Time* t, std::string* error);
      |                                                ^
/usr/include/absl/time/time.h:934:50: error: ‘t’ was not declared in this scope; did you mean ‘tm’?
  934 | bool AbslParseFlag(absl::string_view text, Time* t, std::string* error);
      |                                                  ^
      |                                                  tm
/usr/include/absl/time/time.h:934:64: error: expected primary-expression before ‘*’ token
  934 | bool AbslParseFlag(absl::string_view text, Time* t, std::string* error);
      |                                                                ^
/usr/include/absl/time/time.h:934:66: error: ‘error’ was not declared in this scope; did you mean ‘perror’?
  934 | bool AbslParseFlag(absl::string_view text, Time* t, std::string* error);
      |                                                                  ^~~~~
      |                                                                  perror
/usr/include/absl/time/time.h:1138:32: error: ‘string_view’ is not a member of ‘absl’
 1138 | inline bool LoadTimeZone(absl::string_view name, TimeZone* tz) {
      |                                ^~~~~~~~~~~
/usr/include/absl/time/time.h:1138:58: error: expected primary-expression before ‘*’ token
 1138 | inline bool LoadTimeZone(absl::string_view name, TimeZone* tz) {
      |                                                          ^
/usr/include/absl/time/time.h:1138:60: error: ‘tz’ was not declared in this scope; did you mean ‘tm’?
 1138 | inline bool LoadTimeZone(absl::string_view name, TimeZone* tz) {
      |                                                            ^~
      |                                                            tm
/usr/include/absl/time/time.h:1138:62: error: expression list treated as compound expression in initializer [-fpermissive]
 1138 | inline bool LoadTimeZone(absl::string_view name, TimeZone* tz) {
      |                                                              ^
/usr/include/absl/time/time.h:1375:59: error: ‘string_view’ is not a member of ‘absl’
 1375 | ABSL_ATTRIBUTE_PURE_FUNCTION std::string FormatTime(absl::string_view format,
      |                                                           ^~~~~~~~~~~
/usr/include/absl/time/time.h:1376:58: error: expected primary-expression before ‘t’
 1376 |                                                     Time t, TimeZone tz);
      |                                                          ^
/usr/include/absl/time/time.h:1376:70: error: expected primary-expression before ‘tz’
 1376 |                                                     Time t, TimeZone tz);
      |                                                                      ^~
/usr/include/absl/time/time.h:1381:72: error: ‘std::string absl::lts_20230125::FormatTime(Time, TimeZone)’ redeclared as different kind of entity
 1381 | ABSL_ATTRIBUTE_PURE_FUNCTION std::string FormatTime(Time t, TimeZone tz);
      |                                                                        ^
/usr/include/absl/time/time.h:1375:42: note: previous declaration ‘std::string absl::lts_20230125::FormatTime’
 1375 | ABSL_ATTRIBUTE_PURE_FUNCTION std::string FormatTime(absl::string_view format,
      |                                          ^~~~~~~~~~
/usr/include/absl/time/time.h:1382:59: error: ‘std::string absl::lts_20230125::FormatTime(Time)’ redeclared as different kind of entity
 1382 | ABSL_ATTRIBUTE_PURE_FUNCTION std::string FormatTime(Time t);
      |                                                           ^
/usr/include/absl/time/time.h:1375:42: note: previous declaration ‘std::string absl::lts_20230125::FormatTime’
 1375 | ABSL_ATTRIBUTE_PURE_FUNCTION std::string FormatTime(absl::string_view format,
      |                                          ^~~~~~~~~~
/usr/include/absl/time/time.h: In function ‘std::ostream& absl::lts_20230125::operator<<(std::ostream&, Time)’:
/usr/include/absl/time/time.h:1386:26: error: no match for call to ‘(std::string {aka std::__cxx11::basic_string<char>}) (absl::lts_20230125::Time&)’
 1386 |   return os << FormatTime(t);
      |                ~~~~~~~~~~^~~
/usr/include/absl/time/time.h: At global scope:
/usr/include/absl/time/time.h:1438:22: error: ‘string_view’ is not a member of ‘absl’
 1438 | bool ParseTime(absl::string_view format, absl::string_view input, Time* time,
      |                      ^~~~~~~~~~~
/usr/include/absl/time/time.h:1438:48: error: ‘string_view’ is not a member of ‘absl’
 1438 | bool ParseTime(absl::string_view format, absl::string_view input, Time* time,
      |                                                ^~~~~~~~~~~
/usr/include/absl/time/time.h:1438:71: error: expected primary-expression before ‘*’ token
 1438 | bool ParseTime(absl::string_view format, absl::string_view input, Time* time,
      |                                                                       ^
/usr/include/absl/time/time.h:1439:27: error: expected primary-expression before ‘*’ token
 1439 |                std::string* err);
      |                           ^
/usr/include/absl/time/time.h:1439:29: error: ‘err’ was not declared in this scope; did you mean ‘erf’?
 1439 |                std::string* err);
      |                             ^~~
      |                             erf
/usr/include/absl/time/time.h:1439:32: error: expression list treated as compound expression in initializer [-fpermissive]
 1439 |                std::string* err);
      |                                ^
/usr/include/absl/time/time.h:1448:6: error: redefinition of ‘bool absl::lts_20230125::ParseTime’
 1448 | bool ParseTime(absl::string_view format, absl::string_view input, TimeZone tz,
      |      ^~~~~~~~~
/usr/include/absl/time/time.h:1438:6: note: ‘bool absl::lts_20230125::ParseTime’ previously defined here
 1438 | bool ParseTime(absl::string_view format, absl::string_view input, Time* time,
      |      ^~~~~~~~~
/usr/include/absl/time/time.h:1448:22: error: ‘string_view’ is not a member of ‘absl’
 1448 | bool ParseTime(absl::string_view format, absl::string_view input, TimeZone tz,
      |                      ^~~~~~~~~~~
/usr/include/absl/time/time.h:1448:48: error: ‘string_view’ is not a member of ‘absl’
 1448 | bool ParseTime(absl::string_view format, absl::string_view input, TimeZone tz,
      |                                                ^~~~~~~~~~~
/usr/include/absl/time/time.h:1448:76: error: expected primary-expression before ‘tz’
 1448 | bool ParseTime(absl::string_view format, absl::string_view input, TimeZone tz,
      |                                                                            ^~
/usr/include/absl/time/time.h:1449:20: error: expected primary-expression before ‘*’ token
 1449 |                Time* time, std::string* err);
      |                    ^
/usr/include/absl/time/time.h:1449:39: error: expected primary-expression before ‘*’ token
 1449 |                Time* time, std::string* err);
      |                                       ^
/usr/include/absl/time/time.h:1449:41: error: ‘err’ was not declared in this scope; did you mean ‘erf’?
 1449 |                Time* time, std::string* err);
      |                                         ^~~
      |                                         erf
In file included from /usr/include/absl/types/span.h:69,
                 from /usr/include/absl/log/log_entry.h:36:
/usr/include/absl/types/internal/span.h:119:26: error: ‘remove_const_t’ in namespace ‘std’ does not name a template type; did you mean ‘remove_const’?
  119 |   using Container = std::remove_const_t<T>;
      |                          ^~~~~~~~~~~~~~
      |                          remove_const
/usr/include/absl/types/internal/span.h:121:44: error: parse error in template argument list
  121 |       decltype(span_internal::GetData(std::declval<const Container&>()));
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/types/internal/span.h:122:64: error: ‘Container’ was not declared in this scope
  122 |   using MutData = decltype(span_internal::GetData(std::declval<Container&>()));
      |                                                                ^~~~~~~~~
/usr/include/absl/types/internal/span.h:122:56: error: parse error in template argument list
  122 |   using MutData = decltype(span_internal::GetData(std::declval<Container&>()));
      |                                                        ^~~~~~~~~~~~~~~~~~~
/usr/include/absl/types/internal/span.h:130:29: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
  130 | using EnableIfIsView = std::enable_if_t<IsView<T>::value, int>;
      |                             ^~~~~~~~~~~
/usr/include/absl/types/internal/span.h:130:24: note: ‘std::enable_if_t’ is only available from C++14 onwards
  130 | using EnableIfIsView = std::enable_if_t<IsView<T>::value, int>;
      |                        ^~~
/usr/include/absl/types/internal/span.h:133:32: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
  133 | using EnableIfNotIsView = std::enable_if_t<!IsView<T>::value, int>;
      |                                ^~~~~~~~~~~
/usr/include/absl/types/internal/span.h:133:27: note: ‘std::enable_if_t’ is only available from C++14 onwards
  133 | using EnableIfNotIsView = std::enable_if_t<!IsView<T>::value, int>;
      |                           ^~~
/usr/include/absl/types/span.h:201:39: error: ‘EnableIfNotIsView’ in namespace ‘absl::lts_20230125::span_internal’ does not name a template type
  201 |             typename = span_internal::EnableIfNotIsView<V>>
      |                                       ^~~~~~~~~~~~~~~~~
/usr/include/absl/types/span.h:201:56: error: expected ‘>’ before ‘<’ token
  201 |             typename = span_internal::EnableIfNotIsView<V>>
      |                                                        ^
/usr/include/absl/types/span.h:210:39: error: ‘EnableIfNotIsView’ in namespace ‘absl::lts_20230125::span_internal’ does not name a template type
  210 |             typename = span_internal::EnableIfNotIsView<V>>
      |                                       ^~~~~~~~~~~~~~~~~
/usr/include/absl/types/span.h:210:56: error: expected ‘>’ before ‘<’ token
  210 |             typename = span_internal::EnableIfNotIsView<V>>
      |                                                        ^
/usr/include/absl/types/span.h:222:28: error: ‘absl::lts_20230125::span_internal::EnableIfIsView’ has not been declared
  222 |             span_internal::EnableIfIsView<V> = 0>
      |                            ^~~~~~~~~~~~~~
/usr/include/absl/types/span.h:222:42: error: expected ‘>’ before ‘<’ token
  222 |             span_internal::EnableIfIsView<V> = 0>
      |                                          ^
/usr/include/absl/types/span.h:223:12: error: ‘template<class T> template<class V, class, class, <typeprefixerror><anonymous> > absl::lts_20230125::Span<T>::Span(V&)’ cannot be overloaded with ‘template<class T> template<class V, class, class, class> absl::lts_20230125::Span<T>::Span(V&)’
  223 |   explicit Span(V& v) noexcept  // NOLINT(runtime/references)
      |            ^~~~
/usr/include/absl/types/span.h:202:12: note: previous declaration ‘template<class T> template<class V, class, class, class> absl::lts_20230125::Span<T>::Span(V&)’
  202 |   explicit Span(
      |            ^~~~
/usr/include/absl/types/span.h:227:28: error: ‘absl::lts_20230125::span_internal::EnableIfIsView’ has not been declared
  227 |             span_internal::EnableIfIsView<V> = 0>
      |                            ^~~~~~~~~~~~~~
/usr/include/absl/types/span.h:227:42: error: expected ‘>’ before ‘<’ token
  227 |             span_internal::EnableIfIsView<V> = 0>
      |                                          ^
/usr/include/absl/types/span.h:228:13: error: ‘template<class T> template<class V, class, class, <typeprefixerror><anonymous> > constexpr absl::lts_20230125::Span<T>::Span(const V&)’ cannot be overloaded with ‘template<class T> template<class V, class, class, class> constexpr absl::lts_20230125::Span<T>::Span(const V&)’
  228 |   constexpr Span(const V& v) noexcept  // NOLINT(runtime/explicit)
      |             ^~~~
/usr/include/absl/types/span.h:211:13: note: previous declaration ‘template<class T> template<class V, class, class, class> constexpr absl::lts_20230125::Span<T>::Span(const V&)’
  211 |   constexpr Span(
      |             ^~~~
/usr/include/absl/log/log_entry.h:75:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
   75 |   absl::string_view source_filename() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:78:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
   78 |   absl::string_view source_basename() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:144:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  144 |   absl::string_view text_message_with_prefix_and_newline() const
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:150:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  150 |   absl::string_view text_message_with_prefix() const
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:156:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  156 |   absl::string_view text_message_with_newline() const
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:162:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  162 |   absl::string_view text_message() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:177:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  177 |   absl::string_view encoded_message() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:193:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  193 |   absl::string_view stacktrace() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:200:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  200 |   absl::string_view full_filename_;
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:201:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  201 |   absl::string_view base_filename_;
      |         ^~~~~~~~~~~
/usr/include/absl/log/log_entry.h:210:9: error: ‘string_view’ in namespace ‘absl’ does not name a type
  210 |   absl::string_view encoding_;
      |         ^~~~~~~~~~~
In file included from /usr/include/absl/log/internal/log_message.h:43:
/usr/include/absl/strings/internal/has_absl_stringify.h:35:15: error: ‘string_view’ has not been declared
   35 |   void Append(string_view v);
      |               ^~~~~~~~~~~
/usr/include/absl/strings/internal/has_absl_stringify.h:38:62: error: ‘absl::string_view’ has not been declared
   38 |   friend void AbslFormatFlush(UnimplementedSink* sink, absl::string_view v);
      |                                                              ^~~~~~~~~~~
/usr/include/absl/strings/internal/has_absl_stringify.h:46:13: error: ‘enable_if_t’ is not a member of ‘std’
   46 |     T, std::enable_if_t<std::is_void<decltype(AbslStringify(
      |             ^~~~~~~~~~~
/usr/include/absl/strings/internal/has_absl_stringify.h:46:13: note: ‘std::enable_if_t’ is only available from C++14 onwards
/usr/include/absl/strings/internal/has_absl_stringify.h:46:13: error: ‘enable_if_t’ is not a member of ‘std’
/usr/include/absl/strings/internal/has_absl_stringify.h:46:13: note: ‘std::enable_if_t’ is only available from C++14 onwards
/usr/include/absl/strings/internal/has_absl_stringify.h:48:41: error: type/value mismatch at argument 2 in template parameter list for ‘template<class T, class> struct absl::lts_20230125::strings_internal::HasAbslStringify’
   48 |            std::declval<const T&>()))>::value>> : std::true_type {};
      |                                         ^~~~~
/usr/include/absl/strings/internal/has_absl_stringify.h:48:41: note:   expected a type, got ‘(<expression error> < std::is_void<decltype (AbslStringify(std::declval<absl::lts_20230125::strings_internal::UnimplementedSink&>(), declval<const T&>()))>::value)’
/usr/include/absl/strings/internal/has_absl_stringify.h:48:46: error: expected unqualified-id before ‘>’ token
   48 |            std::declval<const T&>()))>::value>> : std::true_type {};
      |                                              ^~
/usr/include/absl/log/internal/log_message.h:63:32: error: ‘absl::string_view’ has not been declared
   63 |   LogMessage& AtLocation(absl::string_view file, int line);
      |                                ^~~~~~~~~~~
/usr/include/absl/log/internal/log_message.h:134:32: error: ‘absl::string_view’ has not been declared
  134 |   LogMessage& operator<<(absl::string_view v);
      |                                ^~~~~~~~~~~
/usr/include/absl/log/internal/log_message.h:134:15: error: ‘absl::lts_20230125::log_internal::LogMessage& absl::lts_20230125::log_internal::LogMessage::operator<<(int)’ cannot be overloaded with ‘absl::lts_20230125::log_internal::LogMessage& absl::lts_20230125::log_internal::LogMessage::operator<<(int)’
  134 |   LogMessage& operator<<(absl::string_view v);
      |               ^~~~~~~~
/usr/include/absl/log/internal/log_message.h:106:15: note: previous declaration ‘absl::lts_20230125::log_internal::LogMessage& absl::lts_20230125::log_internal::LogMessage::operator<<(int)’
  106 |   LogMessage& operator<<(signed int v) { return operator<< <signed int>(v); }
      |               ^~~~~~~~
/usr/include/absl/log/internal/log_message.h:222:34: error: ‘absl::string_view’ has not been declared
  222 |   void CopyToEncodedBuffer(absl::string_view str,
      |                                  ^~~~~~~~~~~
/usr/include/absl/log/internal/log_message.h:259:21: error: ‘absl::string_view’ has not been declared
  259 |   void Append(absl::string_view v) {
      |                     ^~~~~~~~~~~
/usr/include/absl/log/internal/log_message.h:264:58: error: ‘absl::string_view’ has not been declared
  264 |   friend void AbslFormatFlush(StringifySink* sink, absl::string_view v) {
      |                                                          ^~~~~~~~~~~
/usr/include/absl/log/internal/log_message.h:336:25: error: ‘absl::string_view’ has not been declared
  336 |                   absl::string_view failure_msg) ABSL_ATTRIBUTE_COLD;
      |                         ^~~~~~~~~~~
/usr/include/absl/log/internal/log_message.h:344:32: error: ‘absl::string_view’ has not been declared
  344 |                          absl::string_view failure_msg) ABSL_ATTRIBUTE_COLD;
      |                                ^~~~~~~~~~~
/usr/include/absl/log/internal/check_op.h:310:1: error: ‘string_view’ in namespace ‘absl’ does not name a type
  310 | ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING_EXTERN(const absl::string_view&);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/absl/log/internal/check_op.h:310:1: error: ‘string_view’ in namespace ‘absl’ does not name a type
  310 | ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING_EXTERN(const absl::string_view&);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/absl/container/internal/compressed_tuple.h:40,
                 from /usr/include/absl/container/internal/inlined_vector.h:30,
                 from /usr/include/absl/container/inlined_vector.h:53,
                 from /usr/include/absl/strings/cord.h:78,
                 from /usr/include/google/protobuf/io/coded_stream.h:134:
/usr/include/absl/utility/utility.h:164:12: error: ‘in_place_t’ has not been declared in ‘std’
  164 | using std::in_place_t;
      |            ^~~~~~~~~~
/usr/include/absl/utility/utility.h:165:12: error: ‘in_place’ has not been declared in ‘std’
  165 | using std::in_place;
      |            ^~~~~~~~
/usr/include/absl/utility/utility.h:181:12: error: ‘in_place_type’ has not been declared in ‘std’
  181 | using std::in_place_type;
      |            ^~~~~~~~~~~~~
/usr/include/absl/utility/utility.h:182:12: error: ‘in_place_type_t’ has not been declared in ‘std’
  182 | using std::in_place_type_t;
      |            ^~~~~~~~~~~~~~~
/usr/include/absl/utility/utility.h:198:12: error: ‘in_place_index’ has not been declared in ‘std’
  198 | using std::in_place_index;
      |            ^~~~~~~~~~~~~~
/usr/include/absl/utility/utility.h:199:12: error: ‘in_place_index_t’ has not been declared in ‘std’
  199 | using std::in_place_index_t;
      |            ^~~~~~~~~~~~~~~~
/usr/include/absl/container/internal/compressed_tuple.h:107:46: error: expected ‘)’ before ‘,’ token
  107 |   explicit constexpr Storage(absl::in_place_t, V&& v)
      |                             ~                ^
      |                                              )
/usr/include/absl/container/internal/compressed_tuple.h:120:46: error: expected ‘)’ before ‘,’ token
  120 |   explicit constexpr Storage(absl::in_place_t, V&& v)
      |                             ~                ^
      |                                              )
/usr/include/absl/container/internal/compressed_tuple.h:143:58: error: expected ‘)’ before ‘,’ token
  143 |   explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args)
      |                                         ~                ^
      |                                                          )
/usr/include/absl/container/internal/compressed_tuple.h:155:58: error: expected ‘)’ before ‘,’ token
  155 |   explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args)
      |                                         ~                ^
      |                                                          )
/usr/include/absl/container/internal/compressed_tuple.h: In constructor ‘constexpr absl::lts_20230125::container_internal::CompressedTuple<Ts>::CompressedTuple(const Ts& ...)’:
/usr/include/absl/container/internal/compressed_tuple.h:242:52: error: ‘in_place’ is not a member of ‘absl’
  242 |       : CompressedTuple::CompressedTupleImpl(absl::in_place, base...) {}
      |                                                    ^~~~~~~~
/usr/include/absl/container/internal/compressed_tuple.h: In constructor ‘constexpr absl::lts_20230125::container_internal::CompressedTuple<Ts>::CompressedTuple(First&&, Vs&& ...)’:
/usr/include/absl/container/internal/compressed_tuple.h:254:52: error: ‘in_place’ is not a member of ‘absl’
  254 |       : CompressedTuple::CompressedTupleImpl(absl::in_place,
      |                                                    ^~~~~~~~
In file included from /usr/include/absl/container/internal/inlined_vector.h:31:
/usr/include/absl/memory/memory.h: At global scope:
/usr/include/absl/memory/memory.h:97:12: error: ‘make_unique’ has not been declared in ‘std’
   97 | using std::make_unique;
      |            ^~~~~~~~~~~
In file included from /usr/include/absl/crc/internal/crc_cord_state.h:23,
                 from /usr/include/absl/strings/cord.h:79:
/usr/include/absl/crc/crc32c.h:72:37: error: ‘absl::string_view’ has not been declared
   72 |                               absl::string_view buf_to_add);
      |                                     ^~~~~~~~~~~

[..] 

In other words looks likke protobuf 23.0 is not ready to be used.

@kloczek
Copy link
Author

kloczek commented May 11, 2023

Gentle ping .. any update?

I was able to rebuild protobuf-c usimg 22.5 however still on rebuilding libphonenumber, mysql, opencv are failing on missing symbols.

@fowles
Copy link
Contributor

fowles commented May 12, 2023

@coryan do you have a moment to take a look at this?

@coryan
Copy link
Contributor

coryan commented May 12, 2023

Happy to do a drive-by. It would be useful to know what platform (Linux, Windows, etc.) this was on, and what version of the compiler. Looks like some Linux distro, with GCC.

The dependency on utf8_range

Is utf8_range a hard dependency? If it is, then the install instructions should say so. Consider adding step-by-step instructions to build all the dependencies from source in https://github.com/protocolbuffers/protobuf/blob/main/src/README.md

If it is not a hard dependency, then this:

list(APPEND _pc_targets "utf8_range")

Needs to have a conditional:

if (some_variable_enabled_when_utf8_is_required)
    list(APPEND _pc_targets "utf8_range")
endif ()

The broken build for libphonenumber

This error:

/usr/bin/ld: /tmp/ccOihmdo.lto.o: in function `google::protobuf::RepeatedField<int>::GrowNoAnnotate(int, int)':
/usr/include/google/protobuf/thread_safe_arena.h:198: undefined reference to `google::protobuf::internal::ThreadSafeArena::thread_cache_'

was fixed in #12700. I think @fowles already backported that fix to the 22.x and 23.x branches.

The broken build for mysql

This error

/usr/bin/ld: /usr/lib64/libprotoc.so: undefined reference to symbol '_ZN4absl12lts_2023012513base_internal12SpinLockWaitEPSt6atomicIjEiPKNS1_22SpinLockWaitTransitionENS1_14SchedulingModeE'
/usr/bin/ld: /usr/lib64/libabsl_spinlock_wait.so.2301.0.0: error adding symbols: DSO missing from command line

Seems like a missing -labsl*. Most likely mysql is using find_package(protobuf), using the FindProtobuf embedded with CMake and missing all the new deps. That is indeed the case:

https://github.com/mysql/mysql-server/blob/ea7087d885006918ad54458e7aad215b1650312c/cmake/protobuf.cmake#L124

That needs to change to find_package(protobuf CONFIG). See #12292. It is becoming a FAQ, the Protobuf team should consider updating the release notes.

The broken build for opencv

I think in this case the error explains itself:

   79 | #error "C++ versions less than C++14 are not supported."

The opencv library was configured (or maybe defaults to) compile as C++11:

[ 21%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/opencv-caffe.pb.cc.o
cd /home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu/modules/dnn && /usr/bin/g++ \
... stuff omitted for clarity ...
 -DNDEBUG \
 -std=c++11 \
 -fPIC -Wno-suggest-override -Wno-array-bounds -MD -MT modules/dnn/CMakeFiles/opencv_dnn.dir/opencv-caffe.pb.cc.o -MF CMakeFiles/opencv_dnn.dir/opencv-caffe.pb.cc.o.d -o CMakeFiles/opencv_dnn.dir/opencv-caffe.pb.cc.o -c /home/tkloczko/rpmbuild/BUILD/opencv-4.7.0/x86_64-redhat-linux-gnu/modules/dnn/opencv-caffe.pb.cc

I am not familiar with the configuration options for opencv. It may be necessary to use cmake -DCMAKE_CXX_STANDARD=14 ..., or maybe just omit the -DCMAKE_CXX_STANDARD=14 altogether. Most compilers default to C++14 or higher these days. There are very few cases where one needs to explicitly request C++11.


In summary:

  • Looks like the version of Protobuf you are using is missing some fixes already in the release branches.
  • Maybe there is a bug in the CMake files if utf8_range is not a hard-dependency.
  • I think there are multiple opportunities to improve the Protobuf documentation around building and installation.
  • mysql needs some patches to use Protobuf >= 22.0.
  • How you configure opencv may need some tweaks.

HTH

@kloczek
Copy link
Author

kloczek commented May 13, 2023

Happy to do a drive-by. It would be useful to know what platform (Linux, Windows, etc.) this was on, and what version of the compiler. Looks like some Linux distro, with GCC.

The dependency on utf8_range

Is utf8_range a hard dependency? If it is, then the install instructions should say so. Consider adding step-by-step instructions to build all the dependencies from source in https://github.com/protocolbuffers/protobuf/blob/main/src/README.md

If it is not a hard dependency, then this:

list(APPEND _pc_targets "utf8_range")

Needs to have a conditional:

if (some_variable_enabled_when_utf8_is_required)
    list(APPEND _pc_targets "utf8_range")
endif ()

I dont see any fix for that in 22.x branch v22.5...22.x

The broken build for libphonenumber

This error:

/usr/bin/ld: /tmp/ccOihmdo.lto.o: in function `google::protobuf::RepeatedField<int>::GrowNoAnnotate(int, int)':
/usr/include/google/protobuf/thread_safe_arena.h:198: undefined reference to `google::protobuf::internal::ThreadSafeArena::thread_cache_'

was fixed in #12700. I think @fowles already backported that fix to the 22.x and 23.x branches.

None of the commits from #12700 are on the list
v22.5...22.x

The broken build for mysql

This error

/usr/bin/ld: /usr/lib64/libprotoc.so: undefined reference to symbol '_ZN4absl12lts_2023012513base_internal12SpinLockWaitEPSt6atomicIjEiPKNS1_22SpinLockWaitTransitionENS1_14SchedulingModeE'
/usr/bin/ld: /usr/lib64/libabsl_spinlock_wait.so.2301.0.0: error adding symbols: DSO missing from command line

Seems like a missing -labsl*. Most likely mysql is using find_package(protobuf), using the FindProtobuf embedded with CMake and missing all the new deps. That is indeed the case:

https://github.com/mysql/mysql-server/blob/ea7087d885006918ad54458e7aad215b1650312c/cmake/protobuf.cmake#L124

That needs to change to find_package(protobuf CONFIG). See #12292. It is becoming a FAQ, the Protobuf team should consider updating the release notes.

mysql is not using absl API and error message shows missing symbol in libprotoc -> it points on libprotoc underlinking with some of the absl DSOs.

[tkloczko@pers-jacek SPECS]$ objdump -x /usr/lib64/libprotoc.so | grep NEED
  NEEDED               libprotobuf.so.22.5.0
  NEEDED               libabsl_log_internal_check_op.so.2301.0.0
  NEEDED               libabsl_log_internal_message.so.2301.0.0
  NEEDED               libabsl_log_internal_nullguard.so.2301.0.0
  NEEDED               libabsl_hash.so.2301.0.0
  NEEDED               libabsl_raw_hash_set.so.2301.0.0
  NEEDED               libabsl_str_format_internal.so.2301.0.0
  NEEDED               libabsl_synchronization.so.2301.0.0
  NEEDED               libabsl_strings.so.2301.0.0
  NEEDED               libabsl_throw_delegate.so.2301.0.0
  NEEDED               libabsl_spinlock_wait.so.2301.0.0
  NEEDED               libstdc++.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  VERNEED              0x0000000000014270
  VERNEEDNUM           0x0000000000000003

In summary:

  • Looks like the version of Protobuf you are using is missing some fixes already in the release branches.

As I've wrote I've tested that with 23.0.

  • Maybe there is a bug in the CMake files if utf8_range is not a hard-dependency.
  • I think there are multiple opportunities to improve the Protobuf documentation around building and installation.
  • mysql needs some patches to use Protobuf >= 22.0.

I disagree. It compiles and linking fails because missing symbols.

@coryan
Copy link
Contributor

coryan commented May 13, 2023

Happy to do a drive-by. It would be useful to know what platform (Linux, Windows, etc.) this was on, and what version of the compiler. Looks like some Linux distro, with GCC.

The dependency on utf8_range

Is utf8_range a hard dependency? If it is, then the install instructions should say so. Consider adding step-by-step instructions to build all the dependencies from source in https://github.com/protocolbuffers/protobuf/blob/main/src/README.md
If it is not a hard dependency, then this:

list(APPEND _pc_targets "utf8_range")

I dont see any fix for that in 22.x branch v22.5...22.x

Yes. I said "if it is not a hard dependency". But I looked at the code again and it is. That means this:

I've added quick hack to remove utf8_range from Requires on rpm package %install stage.

Was probably not a good idea.

was fixed in #12700. I think @fowles already backported that fix to the 22.x and 23.x branches.

None of the commits from #12700 are on the list v22.5...22.x

I am not sure why that matters since you are testing with 23.0. FWIW, the relevant commit in the 22.x series is 18fae1c and it is there:

v22.4...22.x

The relevant commit in the 23.x series is 1ca4e9c

mysql is not using absl API and error message shows missing symbol in libprotoc -> it points on libprotoc underlinking with some of the absl DSOs.

I am not sure I follow. That is intentional. libprotoc.so depends on the Abseil symbols. Some of the abseil symbols are part of the public API of libprotoc. It is not expected that -lprotoc by itself will be enough. If it did (for example by linking all the absl* libraries into the .so), I think applications that used Abseil and libprotoc at the same time would quickly run into ODR violations.

In summary:

  • Looks like the version of Protobuf you are using is missing some fixes already in the release branches.

As I've wrote I've tested that with 23.0.

Thanks that is useful. Could you also share the specific Linux distro and the steps you are using to compile Protobuf? It would make it easier to repro any bugs locally.

  • mysql needs some patches to use Protobuf >= 22.0.

I disagree. It compiles and linking fails because missing symbols.

I think you are expecting that linking with just -lprotoc should work. It does not and it is not expected to. The Protobuf team has fixed the pkg-config modules and the CMake config files to add any new -l flags. That should make it easier to migrate build scripts to add the flags where needed.

Build scripts written for Protobuf <= 21.x must be updated to take into account the new dependencies. If a build script (like mysql's) relies on CMake's FindProtobuf module it needs to be updated. That is because FindProtobuf does not know about the new dependencies.

mysql uses that module and that is why the build is missing -l flags.

I also do not think the Protobuf team should (or could) fix the FindProtobuf module. First, because they cannot go back in time and fix the version of that module that already shipped everywhere. Second, because CMake's team plan of record is to migrate to the config files that Protobuf already generates and installs.

I appreciate this is maybe surprising and/or frustrating. But I am not sure what actions are you suggesting.

@kloczek
Copy link
Author

kloczek commented May 13, 2023

I am not sure why that matters since you are testing with 23.0. FWIW, the relevant commit in the 22.x series is 18fae1c and it is there:

Nope I'm now on 22.5 because with that version I was able to compile everythiong and have now only linking issues.

@kloczek
Copy link
Author

kloczek commented May 13, 2023

Trying to figure out why libprotobuf DSO does not provdes `google::protobuf::internal::ThreadSafeArena::thread_cache_' I found another "intersting: thing.
Despite

[tkloczko@pers-jacek x86_64-redhat-linux-gnu]$ cmake -L
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


CMake Error: The source directory "/home/tkloczko/rpmbuild/BUILD/protobuf-22.5/x86_64-redhat-linux-gnu" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
-- Cache values
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
CMAKE_INSTALL_PREFIX:PATH=/usr
GTest_DIR:PATH=/usr/lib64/cmake/GTest
absl_DIR:PATH=/usr/lib64/cmake/absl
protobuf_ABSL_PROVIDER:STRING=package
protobuf_ALLOW_CCACHE:BOOL=OFF
protobuf_BUILD_CONFORMANCE:BOOL=OFF
protobuf_BUILD_EXAMPLES:BOOL=OFF
protobuf_BUILD_LIBPROTOC:BOOL=OFF
protobuf_BUILD_PROTOBUF_BINARIES:BOOL=ON
protobuf_BUILD_PROTOC_BINARIES:BOOL=ON
protobuf_BUILD_SHARED_LIBS:BOOL=ON
protobuf_BUILD_TESTS:BOOL=ON
protobuf_DISABLE_RTTI:BOOL=OFF
protobuf_INSTALL:BOOL=ON
protobuf_INSTALL_EXAMPLES:BOOL=OFF
protobuf_REMOVE_INSTALLED_HEADERS:BOOL=OFF
protobuf_TEST_XML_OUTDIR:BOOL=OFF
protobuf_USE_EXTERNAL_GTEST:BOOL=ON
protobuf_WITH_ZLIB:BOOL=ON
utf8_range_ENABLE_INSTALL:BOOL=OFF
utf8_range_ENABLE_TESTS:BOOL=OFF

in which is possible to see protobuf_BUILD_LIBPROTOC:BOOL=OFF libprotoc DSO is build, linked and installed.

@kloczek
Copy link
Author

kloczek commented May 13, 2023

I am not sure why that matters since you are testing with 23.0. FWIW, the relevant commit in the 22.x series is 18fae1c and it is there:

Nope I'm now on 22.5 because with that version I was able to compile everythiong and have now only linking issues.

BTW looks like 18fae1c is already included in 22.5.

@kloczek
Copy link
Author

kloczek commented May 13, 2023

According to

protobuf/cmake/README.md

Lines 296 to 314 in 17a2d53

## DLLs vs. static linking
Static linking is now the default for the Protocol Buffer libraries. Due to
issues with Win32's use of a separate heap for each DLL, as well as binary
compatibility issues between different versions of MSVC's STL library, it is
recommended that you use static linkage only. However, it is possible to
build libprotobuf and libprotoc as DLLs if you really want. To do this,
do the following:
* Add an additional flag `-Dprotobuf_BUILD_SHARED_LIBS=ON` when invoking cmake
* Follow the same steps as described in the above section.
* When compiling your project, make sure to `#define PROTOBUF_USE_DLLS`.
When distributing your software to end users, we strongly recommend that you
do NOT install libprotobuf.dll or libprotoc.dll to any shared location.
Instead, keep these libraries next to your binaries, in your application's
own install directory. C++ makes it very difficult to maintain binary
compatibility between releases, so it is likely that future versions of these
libraries will *not* be usable as drop-in replacements.

PROTOBUF_USE_DLLS define should be used only on Win.
Going to try to roll back 18fae1c.

@coryan
Copy link
Contributor

coryan commented May 13, 2023

PROTOBUF_USE_DLLS define should be used only on Win.

I think the documentation is very much out of date and I filed a bug requesting fixes (see #12787).

Going to try to roll back 18fae1c.

If you compile the library with PROTOBUF_USE_DLLS defined and use it with that undefined you will have an inconsistent definition for this class:

#elif defined(PROTOBUF_USE_DLLS)
// Thread local variables cannot be exposed through DLL interface but we can
// wrap them in static functions.
static ThreadCache& thread_cache();
#else
PROTOBUF_CONSTINIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_;
static ThreadCache& thread_cache() { return thread_cache_; }
#endif

And that macro is defined when CMake creates shared libraries. Both on Windows and other platforms:

if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libprotobuf
PUBLIC PROTOBUF_USE_DLLS
PRIVATE LIBPROTOBUF_EXPORTS)
endif()

That is what causes the undefined google::protobuf::internal::ThreadSafeArena::thread_cache_ symbol.

Are you sure you are using the correct .pc file when building the downstream dependency? Or if you are not using .pc files and you are using CMake: is the downstream build using the protobuf config (as opposed to the FindProtobuf module)?

@kloczek
Copy link
Author

kloczek commented May 13, 2023

Are you sure you are using the correct .pc file when building the downstream dependency? Or if you are not using .pc files and you are using CMake: is the downstream build using the protobuf config (as opposed to the FindProtobuf module)?

Yes I'm sure.
Generated .pc files have that -DPROTOBUF_USE_DLLS (I've done that without checking possible impact of that kind of change).
Of course reverte 18fae1c caused that it was not possible to build protobuf baceuse other sybols in that case where missing.
Nevertheless looks liks like something is wrong around use that define in some headers.

@kloczek
Copy link
Author

kloczek commented May 13, 2023

Or if you are not using .pc files and you are using CMake: is the downstream build using the protobuf config (as opposed to the FindProtobuf module)?

opencv, libphonenumber and Oracle mysql 8.x are usimg pkgconfig so what is in cmake module is not relevant in those cases.

@kloczek
Copy link
Author

kloczek commented May 16, 2023

Gentle ping .. any update? 🤔

@mkruskal-google
Copy link
Member

I'm having trouble figuring out where this issue is at. Did you add back the dependency on utf8_range? That is a required (private) dependency, and you'll definitely break the build by stripping it out

@kloczek
Copy link
Author

kloczek commented May 17, 2023

Did you add back the dependency on utf8_range?

Yes. On packaging after installation in DESTDIR I'm usimg sed to remove " utf8_range" from .pc files.

That is a required (private) dependency, and you'll definitely break the build by stripping it out

Af far as I've been looking utf8_range it used out of third_party/utf8_range/ and as I wrote I'm building protobuf with -D utf8_range_ENABLE_INSTALL=OFF and despite that utf8_range is added in .pc files Requires:

@mkruskal-google
Copy link
Member

Yea that's the problem. We require utf8_range, and if you set utf8_range_ENABLE_INSTALL=OFF we won't have it available. You need to install it and keep the dependency in the .pc files. We may collapse upb and utf8_range into the protobuf repo in a future release, but for 22.x and 23.x you need both

@kloczek
Copy link
Author

kloczek commented May 17, 2023

Yea that's the problem. We require utf8_range, and if you set utf8_range_ENABLE_INSTALL=OFF we won't have it available.

It does't matter. Whatever is used as bundled library should not be listed in .pc files.

@mkruskal-google
Copy link
Member

it's not used as a bundled library today. It needs to be installed and linked for protobuf to work.

At least the mysql issue is caused by mysql using find_package(protobuf). CMake's FindProtobuf is broken for 22.x and up, and find_package(protobuf CONFIG) needs to be used. Related to that, mysql also seems to be using all of our vendored logging code that's been replaced by Abseil.

@kloczek
Copy link
Author

kloczek commented May 19, 2023

I have no installed utf8_range and just tested 23.1 it still has in .pc files listed utf8_range in Requires.

@mkruskal-google
Copy link
Member

Yes, because we do require utf8_range. We ship it as a git sub-tree, and install it during protobuf installation. If you explicitly disable this installation you'll break our library

@kloczek
Copy link
Author

kloczek commented May 19, 2023

Yes, because we do require utf8_range. We ship it as a git sub-tree, and install it during protobuf installation. If you explicitly disable this installation you'll break our library

Just started plaing with 23.1 and:

  • I'm usig bumdled utf8_range
  • libpronenumber fails on linking on missing symbols as I've originally reported
[ 81%] Linking CXX executable libphonenumber_test
/usr/bin/cmake -E cmake_link_script CMakeFiles/libphonenumber_test.dir/link.txt --verbose=1
/usr/bin/g++ -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -DNDEBUG -Wl,--gc-sections -Wl,--as-needed -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--build-id=sha1 CMakeFiles/libphonenumber_test.dir/test/phonenumbers/asyoutypeformatter_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/logger_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/matcher_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumberutil_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/regexp_adapter_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/regexp_cache_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/run_tests.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/shortnumberinfo_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/stringutil_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/test_util.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/unicodestring_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/utf/unicodetext_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/area_code_map_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/geocoding_data_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/geocoding_test_data.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/mapping_file_provider_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/phonenumber_offline_geocoder_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumbermatch_test.cc.o CMakeFiles/libphonenumber_test.dir/test/phonenumbers/phonenumbermatcher_test.cc.o -o libphonenumber_test  libphonenumber_testing.a /usr/lib64/libgtest.so -lpthread /usr/lib64/libicuuc.so /usr/lib64/libicui18n.so /usr/lib64/libprotobuf.so /usr/lib64/libabsl_cord.so.2301.0.0 /usr/lib64/libabsl_cordz_info.so.2301.0.0 /usr/lib64/libabsl_cord_internal.so.2301.0.0 /usr/lib64/libabsl_cordz_functions.so.2301.0.0 /usr/lib64/libabsl_cordz_handle.so.2301.0.0 /usr/lib64/libabsl_crc_cord_state.so.2301.0.0 /usr/lib64/libabsl_crc32c.so.2301.0.0 /usr/lib64/libabsl_crc_internal.so.2301.0.0 /usr/lib64/libabsl_crc_cpu_detect.so.2301.0.0 /usr/lib64/libabsl_hash.so.2301.0.0 /usr/lib64/libabsl_city.so.2301.0.0 /usr/lib64/libabsl_bad_variant_access.so.2301.0.0 /usr/lib64/libabsl_low_level_hash.so.2301.0.0 /usr/lib64/libabsl_raw_hash_set.so.2301.0.0 /usr/lib64/libabsl_hashtablez_sampler.so.2301.0.0 /usr/lib64/libabsl_exponential_biased.so.2301.0.0 /usr/lib64/libabsl_bad_optional_access.so.2301.0.0 /usr/lib64/libabsl_synchronization.so.2301.0.0 /usr/lib64/libabsl_graphcycles_internal.so.2301.0.0 /usr/lib64/libabsl_stacktrace.so.2301.0.0 /usr/lib64/libabsl_symbolize.so.2301.0.0 /usr/lib64/libabsl_malloc_internal.so.2301.0.0 /usr/lib64/libabsl_debugging_internal.so.2301.0.0 /usr/lib64/libabsl_demangle_internal.so.2301.0.0 /usr/lib64/libabsl_time.so.2301.0.0 /usr/lib64/libabsl_strings.so.2301.0.0 /usr/lib64/libabsl_strings_internal.so.2301.0.0 /usr/lib64/libabsl_throw_delegate.so.2301.0.0 /usr/lib64/libabsl_base.so.2301.0.0 /usr/lib64/libabsl_spinlock_wait.so.2301.0.0 /usr/lib64/libabsl_int128.so.2301.0.0 /usr/lib64/libabsl_raw_logging_internal.so.2301.0.0 /usr/lib64/libabsl_log_severity.so.2301.0.0 /usr/lib64/libabsl_civil_time.so.2301.0.0 /usr/lib64/libabsl_time_zone.so.2301.0.0 /usr/lib64/libboost_date_time.so /usr/lib64/libboost_system.so -lboost_thread /usr/lib64/libboost_chrono.so /usr/lib64/libboost_atomic.so
/usr/bin/ld: /tmp/ccAR3AjZ.lto.o: in function `google::protobuf::RepeatedField<int>::GrowNoAnnotate(int, int)':
/usr/include/google/protobuf/thread_safe_arena.h:198: undefined reference to `google::protobuf::internal::ThreadSafeArena::thread_cache_'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/libphonenumber_test.dir/build.make:442: libphonenumber_test] Error 1
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/libphonenumber-8.13.11/x86_64-redhat-linux-gnu'
make[1]: *** [CMakeFiles/Makefile2:359: CMakeFiles/libphonenumber_test.dir/all] Error 2
make[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/libphonenumber-8.13.11/x86_64-redhat-linux-gnu'

That missing smbol has nothing to do with utf8_range.

Did you try to build latest Oracle mysql, opencv and libpronenumber with installes 23.1?
In all three cases build fails on that missing symbol.

And again: as I'm building protobuf with bundled utf8_range why this library appears on pkgconfig dependencies list if none of the protobuf installed header files are usong anything from utf8_range?

@kloczek
Copy link
Author

kloczek commented May 19, 2023

Other thing is question about using absl.
mysql and libpronenumber are using boost (but only header files without libking with any boost DSOs) and libstdc++ classes.
opencv is using only libstdc++.
Additionally absl has very fragmented ABI which consist out of MANY DSOs which makes LTO inefficient and adds more wasted memory on jump tables between DSOs symbols.

Is it really necessary tu use it? 🤔

@fowles
Copy link
Contributor

fowles commented May 19, 2023

Yes, absl is definitely required for protobuf. We use it for a variety of important internal optimizations and in 23.x we add support for bytes fields with type absl::Cord, which is very important for zero copy handling of large blobs.

@kloczek
Copy link
Author

kloczek commented May 19, 2023

Yes, absl is definitely required for protobuf. We use it for a variety of important internal optimizations and in 23.x we add support for bytes fields with type absl::Cord, which is very important for zero copy handling of large blobs.

If you say so ..

So what about taht missing symbol?

[tkloczko@pers-jacek protobuf-23.1]$ grep -r thread_cache_
src/google/protobuf/arena.cc:  static internal::ThreadLocalStorage<ThreadCache>* thread_cache_ =
src/google/protobuf/arena.cc:  return *thread_cache_->Get();
src/google/protobuf/arena.cc:    ThreadSafeArena::ThreadCache ThreadSafeArena::thread_cache_;
src/google/protobuf/thread_safe_arena.h:  PROTOBUF_CONSTINIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_;
src/google/protobuf/thread_safe_arena.h:  static ThreadCache& thread_cache() { return thread_cache_; }

As you see that class is not part of the utf8_range.

@mkruskal-google
Copy link
Member

mkruskal-google commented May 19, 2023

I don't think the original problem has anything to do with utf8_range, it was just some of the subsequent ones you saw when you tried to remove the dependency. I think Carlos nailed the root problem a while back:

PROTOBUF_USE_DLLS define should be used only on Win.

I think the documentation is very much out of date and I filed a bug requesting fixes (see #12787).

Going to try to roll back 18fae1c.

If you compile the library with PROTOBUF_USE_DLLS defined and use it with that undefined you will have an inconsistent definition for this class:

#elif defined(PROTOBUF_USE_DLLS)
// Thread local variables cannot be exposed through DLL interface but we can
// wrap them in static functions.
static ThreadCache& thread_cache();
#else
PROTOBUF_CONSTINIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_;
static ThreadCache& thread_cache() { return thread_cache_; }
#endif

And that macro is defined when CMake creates shared libraries. Both on Windows and other platforms:

if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libprotobuf
PUBLIC PROTOBUF_USE_DLLS
PRIVATE LIBPROTOBUF_EXPORTS)
endif()

That is what causes the undefined google::protobuf::internal::ThreadSafeArena::thread_cache_ symbol.

Are you sure you are using the correct .pc file when building the downstream dependency? Or if you are not using .pc files and you are using CMake: is the downstream build using the protobuf config (as opposed to the FindProtobuf module)?

He confirmed that at least mysql is using FindProtobuf, meaning that they'd have an inconsistent value of PROTOBUF_USE_DLLS and it would cause issues with this symbol

@kloczek
Copy link
Author

kloczek commented May 19, 2023

Also, this utf8_range_ENABLE_INSTALL flag you're using is highly unsupported and I wouldn't expect it to work...

ItWorks™️ and is causes that utf8_range static library is not installed because it is used only on linking protobuf binaries..
As it is not part of public protobuf API/ABI it does not need to be installed.

@kloczek
Copy link
Author

kloczek commented May 19, 2023

I have not seen a consistent enough set of reproduction steps to be able to reproduce this. You provided one set of cmake commands for building protobuf, but AFAICT it doesn't set protobuf_BUILD_SHARED_LIBS, which your other comments suggest you have set. It's also not clear what platform your on, is this linux or windows?

Linux and Solaris. In both cases all fails the same way.
And please one more time have look on cmake -L output .. protobuf_BUILD_SHARED_LIBS:BOOL=ON is in that output.
I did not set it but that with what end up cmake all because in main CMakeList.txt is

if (BUILD_SHARED_LIBS)
  set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON)
else (BUILD_SHARED_LIBS)
  set(protobuf_BUILD_SHARED_LIBS_DEFAULT OFF)
endif (BUILD_SHARED_LIBS)

3rd time: did you try to reproduce that issue? 🤔

@mkruskal-google
Copy link
Member

mkruskal-google commented May 19, 2023

Here cmake parames which I have in my protobuf.spec

%build
%cmake \
       -D CMAKE_PREFIX_PATH=%{_prefix} \
       -D protobuf_ABSL_PROVIDER=ON \
       -D protobuf_ABSL_PROVIDER=package \
       -D protobuf_BUILD_TESTS=ON \
       -D protobuf_USE_EXTERNAL_GTEST=ON \
       -D utf8_range_ENABLE_INSTALL=OFF \
       %{nil}

This command doesn't have BUILD_SHARED_LIBS set either... Could you please provide reproduction steps that include all the flags you use to build:

  • protobuf
  • abseil
  • libpronenumber (assuming this one is sufficient to reproduce the issue)

I'm currently unable to build libpronenumber, because it seems stuck on C++11 which is incompatible with Abseil (it's ignoring -DCMAKE_CXX_STANDARD=14)

@mkruskal-google
Copy link
Member

Manually fixing libphonenumber to C++14, I get the following error from their Abseil dependency:

/bin/ld: libphonenumber.a(phonenumber.pb.cc.o): undefined reference to symbol '_ZN4absl12lts_2023012512log_internal21CheckOpMessageBuilder7ForVar2Ev'
/bin/ld: /usr/local/lib/libabsl_log_internal_check_op.so.2301.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/geocoding_test_program.dir/build.make:141: geocoding_test_program] Error 1
make[1]: *** [CMakeFiles/Makefile2:410: CMakeFiles/geocoding_test_program.dir/all] Error 2

This looks similar to what you saw in mysql, but if I set -DBUILD_TESTING=OFF libphonenumber builds just fine. The commands I used were:

absl:

cmake . -DCMAKE_CXX_STANDARD=14 -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
make install

protobuf:

cmake . -Dprotobuf_ABSL_PROVIDER=ON -Dprotobuf_ABSL_PROVIDER=package -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_BUILD_SHARED_LIBS=ON
make install

libphonenumber:

cd cpp
cmake . -DCMAKE_PREFIX_PATH=/usr/local -DCMAKE_CXX_STANDARD=14 -DBUILD_TESTING=OFF
make

@kloczek
Copy link
Author

kloczek commented May 24, 2023

Any update? 🤔

I just created ticket against libphonenumber https://issuetracker.google.com/issues/283987730

@mkruskal-google
Copy link
Member

No, I'm waiting for you to provide the reproduction steps I asked for last week. I wasn't able to reproduce the issue you saw by guessing cmake flags.

@perezd perezd removed the untriaged auto added to all issues by default when created. label May 24, 2023
@kloczek
Copy link
Author

kloczek commented May 25, 2023

Cmake settings:

  • protobuf (22.5)
%cmake \
        -D CMAKE_PREFIX_PATH=%{_prefix} \
        -D BUILD_SHARED_LIBS=ON \
        -D protobuf_ABSL_PROVIDER=package \
        -D protobuf_BUILD_TESTS=ON \
        -D protobuf_USE_EXTERNAL_GTEST=ON \
        -D utf8_range_ENABLE_INSTALL=OFF \
        %{nil}
  • abseil-cpp (20230125.3)
%cmake \
        -D ABSL_BUILD_TESTING=ON \
        -D ABSL_BUILD_TEST_HELPERS=ON \
        -D ABSL_USE_EXTERNAL_GOOGLETEST=ON \
        %{nil}
  • libphonenumber 8.13.12 (I've added patch to bump to 17 C++ standard but it still fails on linking )
%cmake cpp \
        -D BUILD_STATIC_LIB=OFF \
        -D BUILD_TESTING=OM \
        -D PROTOBUF_USE_DLLS=ON \
        -D USE_BOOST=ON \
        -D USE_ICU_REGEXP=ON \
        -D USE_RE2=OFF \
        %{nil}
  • opncv (4.7.0)
%cmake \
        -D BUILD_DOCS=ON \
        -D BUILD_EXAMPLES=ON \
        -D BUILD_opencv_java=ON \
        -D BUILD_PROTOBUF=OFF \
        -D CMAKE_SKIP_RPATH=ON \
        -D ENABLE_PRECOMPILED_HEADERS=OFF \
        -D ENABLE_PYLINT=ON \
        -D INSTALL_C_EXAMPLES=ON \
        -D INSTALL_PYTHON_EXAMPLES=ON \
        -D OPENCV_CONFIG_INSTALL_PATH=%{_lib}/cmake/OpenCV \
        -D OPENCV_EXTRA_MODULES_PATH=$(ls -1d opencv_contrib-*/modules) \
        -D OPENCV_GENERATE_PKGCONFIG=ON \
        -D OPENCV_JAR_INSTALL_PATH=%{_jnidir} \
        -D OPENCV_PC_FILE_NAME=opencv.pc \
        -D OPENCV_SKIP_PYTHON_LOADER=ON \
        -D OPENCV_TEST_DATA_PATH=$PWD/%{name}_extra-%{version} \
        -D OpenGL_GL_PREFERENCE=GLVND \
        -D PNG_PNG_INCLUDE_DIR=%{_includedir} \
        -D PROTOBUF_UPDATE_FILES=ON \
        -D PYTHON2_EXECUTABLE=OFF \
        -D PYTHON3_EXECUTABLE=%__python3 \
        -D PYTHON3_PACKAGES_PATH=%{python3_sitearch} \
        -D VULKAN_INCLUDE_DIRS=%{_includedir}/vulkan \
        -D WITH_CAROTENE=OFF \
        -D WITH_CLP=OFF \
        -D WITH_FFMPEG=ON \
        -D WITH_GDAL=ON \
        -D WITH_GDCM=ON \
        -D WITH_GSTREAMER=ON \
        -D WITH_IPP=OFF \
        -D WITH_ITT=OFF \
        -D WITH_LAPACK=OFF \
        -D WITH_LIBV4L=ON \
        -D WITH_MFX=OFF \
        -D WITH_OPENCL=ON \
        -D WITH_OPENGL=ON \
        -D WITH_OPENJPEG=OFF \
        -D WITH_OPENMP=ON \
        -D WITH_OPENNI=ON \
        -D WITH_QT=ON \
        -D WITH_TBB=ON \
        -D WITH_UNICAP=ON \
        -D WITH_VA=ON \
        -D WITH_VTK=OFF \
        -D WITH_VULKAN=ON \
        -D WITH_XINE=OFF \
        %{?with_opencl:-D OPENCL_INCLUDE_DIR=%{_includedir}/CL } \
        -D WITH_CUDA=ON \
        -D CUDA_TOOLKIT_ROOT_DIR=%{?_cuda_prefix} \
        -D CUDA_VERBOSE_BUILD=ON \
        -D CUDA_PROPAGATE_HOST_FLAGS=OFF \
        %{nil}
  • mysql 8.0.33
%cmake \
        -D ADD_GDB_INDEX=OFF \
        -D BUILD_CONFIG=mysql_release \
        -D CMAKE_C_FLAGS="$CFLAGS" \
        -D CMAKE_C_LINK_FLAGS="$LDFLAGS" \
        -D CMAKE_CXX_FLAGS="$CXXFLAGS" \
        -D CMAKE_CXX_LINK_FLAGS="$LDFLAGS" \
        -D CMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
        -D CMAKE_SKIP_INSTALL_RPATH=ON \
        -D DAEMON_NAME="%{daemon_name}" \
        -D DAEMON_NO_PREFIX="%{daemon_no_prefix}" \
        -D ENABLED_LOCAL_INFILE=ON \
        -D ENABLED_PROFILING=OFF \
        -D FEATURE_SET="community" \
        -D INSTALL_DOCDIR="share/doc/%{_pkgdocdirname}" \
        -D INSTALL_DOCREADMEDIR="share/doc/%{_pkgdocdirname}" \
        -D INSTALL_INCLUDEDIR=include/mysql \
        -D INSTALL_INFODIR=share/info \
        -D INSTALL_LAYOUT=RPM \
        -D INSTALL_LIBDIR="%{_lib}" \
        -D INSTALL_LIBEXECDIR=libexec \
        -D INSTALL_MANDIR=share/man \
        -D INSTALL_MYSQLSHAREDIR=share/%{pkg_name} \
        -D INSTALL_MYSQLTESTDIR=share/mysql-test \
        -D INSTALL_PLUGINDIR="%{_lib}/mysql/plugin" \
        -D INSTALL_SBINDIR=bin \
        -D INSTALL_STATIC_LIBRARIES=OFF \
        -D INSTALL_SUPPORTFILESDIR=share/%{pkg_name} \
        -D LOGFILE_RPM="%{_localstatedir}/log/mysql/%{daemon_no_prefix}.log" \
        -D MYSQL_DATADIR="%{_sharedstatedir}/mysql" \
        -D MYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
        -D NICE_PROJECT_NAME="MySQL" \
        -D PID_FILE_DIR="%{_rundir}/%{daemon_name}" \
        -D REPRODUCIBLE_BUILD=OFF \
        -D RPATH_LIBDIR="%{_libdir}" \
        -D SYSCONF2DIR="%{_sysconfdir}/my.cnf.d" \
        -D SYSCONFDIR="%{_sysconfdir}" \
        -D SYSTEMD_PID_DIR="%{_rundir}/%{daemon_name}" \
        -D SYSTEMD_SERVICE_NAME="%{daemon_name}" \
        -D TMPDIR=/var/tmp \
        -D MYSQLX_ADDITIONAL_TESTS_ENABLE=OFF \
        -D WITH_AUTHENTICATION_FIDO=ON \
        -D WITH_AUTHENTICATION_KERBEROS=ON \
        -D WITH_AUTHENTICATION_LDAP=ON \
        -D WITH_BOOST=boost \
        -D WITH_FIDO=system \
        -D WITH_HYPERGRAPH_OPTIMIZER=OFF \
        -D WITH_INNODB_MEMCACHED=ON \
        -D WITH_JSON_BINLOG_LIBRARY=OFF \
        -D WITH_LIBWRAP=OFF \
        -D WITH_MECAB=system \
        -D WITH_MYSQLD_LDFLAGS="$LDFLAGS" \
        -D WITH_NDBCLUSTER=OFF \
        -D WITH_ROUTER=ON \
        -D WITH_SYSTEMD=ON \
        -D WITH_SYSTEM_LIBS=ON \
        -D WITH_VALGRIND=OFF \
        -D XPLUGIN_LOG_PROTOBUF=ON \
        %{?with_debug:-D MYSQL_MAINTAINER_MODE=OFF} \
        %{?with_debug:-D WITH_DEBUG=ON} \
        -D WITH_NUMA=ON \
        %{nil}

@kloczek
Copy link
Author

kloczek commented May 25, 2023

libphonenumber maintainers just mentioned that they are observing as well linking issue https://issuetracker.google.com/issues/283987730#comment6

copybara-service bot pushed a commit that referenced this issue Jun 6, 2023
…orms (#12983)

Hi,

It seems that until last year, the logic behind `PROTOBUF_USE_DLLS` was for Windows (MSCV) only. It was changed to all platforms here in 5a0887f

Last month, the generated pkg config files were updated to reflect the protobuf build-time value of `PROTOBUF_USE_DLLS` as it was indeed noted that it changes the ABI. This was done in #12700 In the commit message it is mentionned that most likely we shall rather have a stable ABI.

Finally in #12746 which at some point mentions https://issuetracker.google.com/issues/283987730#comment7 where a Google employee hits the linker issue:
```
undefined reference to `google::protobuf::internal::ThreadSafeArena::thread_cache_'
```
which denotes a mix of some .o or libs built `PROTOBUF_USE_DLLS` defined and some others build with `PROTOBUF_USE_DLLS` undefined, resulting in ABI incompatibilities.

I also hit this issue while trying to include protobuf in a corporate environment using it's own proprietary build system in which it is expected that .a and .so use a compatible ABI.

From my own understanding, ideally we should always use `thread_local` variables, but experience has shown that:
 - old iOS (iOS < 9) didn't seem to accept `thread_local`, leading to the `GOOGLE_PROTOBUF_NO_THREADLOCAL` macro later renamed `PROTOBUF_NO_THREADLOCAL` which allowed to disable this, but it is not set anywhere in the protobuf code base. Also I doubt you still want to support such old iOS now, so maybe you should consider removing all `PROTOBUF_NO_THREADLOCAL` related code paths (this pull request doesn't do this).
  - MSVC's DLL interface doesn't seem to accept exporting thread local variables (at least from what I understood, I know absolutely nothing about the Windows ecosystem), yet we can "hide" a thread local variable in a static function using a thread local variable. However in that case the access to TLS variable is not inlined, leading to worse performances, this hack shall be done only for Windows (actually when using MSVC) *AND* we build a shared library.
  - In all other cases, a classical `thread_local` shall be used, no matter if we build a static or a shared library. In particular on Linux which I guess is the target Google cares the more about for its own production. This pull request achieves this.

Am I right in my conclusion ?

Closes #12983

COPYBARA_INTEGRATE_REVIEW=#12983 from Romain-Geissler-1A:stable-abi-use-dll-non-windows dc23ff5
PiperOrigin-RevId: 538230923
@Romain-Geissler-1A
Copy link
Contributor

Hi,

FYI, on the main branch, the linking errors about thread_cache_ (and only this error, as this issue seems to mix several unrelated issues) should now be gone (for all non Windows users).

Note: I am not involved at all in Protobuf development, I am just an external contributor who hit this issue and decided to submit a fix for it ;)

Cheers,
Romain

fowles pushed a commit to fowles/protobuf that referenced this issue Jun 7, 2023
…orms (protocolbuffers#12983)

Hi,

It seems that until last year, the logic behind `PROTOBUF_USE_DLLS` was for Windows (MSCV) only. It was changed to all platforms here in protocolbuffers@5a0887f

Last month, the generated pkg config files were updated to reflect the protobuf build-time value of `PROTOBUF_USE_DLLS` as it was indeed noted that it changes the ABI. This was done in protocolbuffers#12700 In the commit message it is mentionned that most likely we shall rather have a stable ABI.

Finally in protocolbuffers#12746 which at some point mentions https://issuetracker.google.com/issues/283987730#comment7 where a Google employee hits the linker issue:
```
undefined reference to `google::protobuf::internal::ThreadSafeArena::thread_cache_'
```
which denotes a mix of some .o or libs built `PROTOBUF_USE_DLLS` defined and some others build with `PROTOBUF_USE_DLLS` undefined, resulting in ABI incompatibilities.

I also hit this issue while trying to include protobuf in a corporate environment using it's own proprietary build system in which it is expected that .a and .so use a compatible ABI.

From my own understanding, ideally we should always use `thread_local` variables, but experience has shown that:
 - old iOS (iOS < 9) didn't seem to accept `thread_local`, leading to the `GOOGLE_PROTOBUF_NO_THREADLOCAL` macro later renamed `PROTOBUF_NO_THREADLOCAL` which allowed to disable this, but it is not set anywhere in the protobuf code base. Also I doubt you still want to support such old iOS now, so maybe you should consider removing all `PROTOBUF_NO_THREADLOCAL` related code paths (this pull request doesn't do this).
  - MSVC's DLL interface doesn't seem to accept exporting thread local variables (at least from what I understood, I know absolutely nothing about the Windows ecosystem), yet we can "hide" a thread local variable in a static function using a thread local variable. However in that case the access to TLS variable is not inlined, leading to worse performances, this hack shall be done only for Windows (actually when using MSVC) *AND* we build a shared library.
  - In all other cases, a classical `thread_local` shall be used, no matter if we build a static or a shared library. In particular on Linux which I guess is the target Google cares the more about for its own production. This pull request achieves this.

Am I right in my conclusion ?

Closes protocolbuffers#12983

COPYBARA_INTEGRATE_REVIEW=protocolbuffers#12983 from Romain-Geissler-1A:stable-abi-use-dll-non-windows dc23ff5
PiperOrigin-RevId: 538230923
@carlocab
Copy link

carlocab commented Jul 7, 2023

Not sure what the status of this issue is, but here's some information that might be helpful. At Homebrew:

Footnotes

  1. https://github.com/Homebrew/homebrew-core/pull/133623

  2. https://github.com/Homebrew/homebrew-core/blob/244feeee298712178bd3cd60da0091d5a5b79a71/Formula/opencv.rb#L109-L110

  3. https://bugs.mysql.com/bug.php?id=111469

@LazyPlanet
Copy link

LazyPlanet commented Jul 17, 2023

Linux centos also has error:
/usr/local/include/google/protobuf/thread_safe_arena.h:198: undefined reference to google::protobuf::internal::ThreadSafeArena::thread_cache_' /usr/local/include/google/protobuf/thread_safe_arena.h:198: undefined reference to google::protobuf::internal::ThreadSafeArena::thread_cache_'
/usr/local/include/google/protobuf/thread_safe_arena.h:198: undefined reference to `google::protobuf::internal::ThreadSafeArena::thread_cache_'

if message has repeated int32 or int64, i will get errors above, why?

image

while if message has repeated other type such as message or bytes, it build success...

@Romain-Geissler-1A
Copy link
Contributor

My solution is define thread_cache_ in my own source code(.pb.cc), like this⬇️.

Why not using up to date probotuf where this very problem is fixed already, without any hack required ?

nephros pushed a commit to nephros/libphonenumber that referenced this issue Dec 9, 2023
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Dec 17, 2023
Copy link

github-actions bot commented Jan 2, 2024

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Denotes the issue/PR has not seen activity in the last 90 days.
Projects
None yet
Development

No branches or pull requests

8 participants