Hi all, I am not sure whether that was a bug or I simply missed something. Could you help me review, please? Thank you.
Below is what I did. 1. git clone https://github.com/protocolbuffers/protobuf.git 2. cd protobuf 3. git submodule update --init --recursive 4. cmake *-DCMAKE_CXX_STANDARD=20* -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Dprotobuf_BUILD_TESTS=OFF *-DCMAKE_INSTALL_PREFIX=`pwd`/build* . It showed: *-- The C compiler identification is GNU 14.0.0-- The CXX compiler identification is GNU 14.0.0-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Check for working C compiler: /home/myscratch/util/gcc-build/bin/gcc - skipped-- Detecting C compile features-- Detecting C compile features - done-- Detecting CXX compiler ABI info-- Detecting CXX compiler ABI info - done-- Check for working CXX compiler: /home/myscratch/util/gcc-build/bin/g++ - skipped-- Detecting CXX compile features-- Detecting CXX compile features - done-- -- 25.0.0-- Performing Test protobuf_HAVE_LD_VERSION_SCRIPT-- Performing Test protobuf_HAVE_LD_VERSION_SCRIPT - Success-- Performing Test CMAKE_HAVE_LIBC_PTHREAD-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed-- Looking for pthread_create in pthreads-- Looking for pthread_create in pthreads - not found-- Looking for pthread_create in pthread-- Looking for pthread_create in pthread - found-- Found Threads: TRUE -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7") -- Performing Test protobuf_HAVE_BUILTIN_ATOMICS-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - SuccessCMake Warning at third_party/abseil-cpp/CMakeLists.txt:77 (message): A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake 3.8 and up. We recommend enabling this option to ensure your project still builds correctly.-- Performing Test ABSL_INTERNAL_AT_LEAST_CXX17-- Performing Test ABSL_INTERNAL_AT_LEAST_CXX17 - Success-- Configuring done (3.5s)-- Generating done (4.0s)-- Build files have been written to: /home/myscratch/util/protobuf* I don't know why pthread checking failed, then I did 1. cmake --build . 2. cmake --install . 3. export PKG_CONFIG_PATH=/home/myscratch/util/protobuf/build/lib64/pkgconfig:$PKG_CONFIG_PATH I checked *pkg-config --cflags --libs protobuf* It showed: *-DNOMINMAX -I/home/myscratch/util/protobuf/build/include -L/home/myscratch/util/protobuf/build/lib64 -lprotobuf -lpthread -labsl_log_internal_check_op -labsl_leak_check -labsl_die_if_null -labsl_log_internal_conditions -labsl_log_internal_message -labsl_examine_stack -labsl_log_internal_format -labsl_log_internal_proto -labsl_log_internal_nullguard -labsl_log_internal_log_sink_set -labsl_log_sink -labsl_log_entry -labsl_flags -labsl_flags_internal -labsl_flags_marshalling -labsl_flags_reflection -labsl_flags_private_handle_accessor -labsl_flags_commandlineflag -labsl_flags_commandlineflag_internal -labsl_flags_config -labsl_flags_program_name -labsl_log_initialize -labsl_log_globals -labsl_log_internal_globals -labsl_raw_hash_set -labsl_hash -labsl_city -labsl_low_level_hash -labsl_hashtablez_sampler -labsl_statusor -labsl_status -labsl_cord -labsl_cordz_info -labsl_cord_internal -labsl_cordz_functions -labsl_exponential_biased -labsl_cordz_handle -labsl_crc_cord_state -labsl_crc32c -labsl_crc_internal -labsl_crc_cpu_detect -labsl_bad_optional_access -labsl_str_format_internal -labsl_strerror -labsl_synchronization -labsl_graphcycles_internal -labsl_kernel_timeout_internal -labsl_stacktrace -labsl_symbolize -labsl_debugging_internal -labsl_demangle_internal -labsl_malloc_internal -labsl_time -labsl_civil_time -labsl_time_zone -labsl_bad_variant_access -lutf8_validity -lutf8_range -lpthread -labsl_strings -labsl_string_view -labsl_strings_internal -labsl_base -lrt -labsl_spinlock_wait -labsl_int128 -labsl_throw_delegate -labsl_raw_logging_internal -labsl_log_severity* The path looks fine to me. If I did 1. /home/myscratch/util/protobuf/build/bin/protoc --cpp_out=. --proto_path=/home/myscratch/util/onnx/onnx/onnx onnx.proto3 It also worked fine. I had a test.cpp has one line "int main() {}", then I tried: 1. g++ -std=c++20 `pkg-config --cflags --libs protobuf` onnx.proto3.pb.cc test.cpp Many undefined reference errors! The first one was: */home/utils/binutils-2.40/bin/ld: /tmp/ccLwlOqn.o: in function `onnx::AttributeProto_AttributeType_Name[abi:cxx11](onnx::AttributeProto_AttributeType)': onnx.proto3.pb.cc:(.text+0x6d): undefined reference to `google::protobuf::internal::InitializeEnumStrings(google::protobuf::internal::EnumEntry const*, int const*, unsigned long, google::protobuf::internal::ExplicitlyConstructed<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 1ul>*)' /home/utils/binutils-2.40/bin/ld: onnx.proto3.pb.cc:(.text+0x96): undefined reference to `google::protobuf::internal::LookUpEnumName(google::protobuf::internal::EnumEntry const*, int const*, unsigned long, int)'* Any help would be appreciated... -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/9847efcd-2fb7-4ac8-9880-f35fb0b2b1e7n%40googlegroups.com.
