← All tasks
cppprotocolbuffers/protobuf #12292Not a task: not reproduced

C++: Undefine reference to functions defined in `absl::lts_20230125`

envgap__protocolbuffers__protobuf-12292

Original GitHub issue ↗Opened 2023-03-21

01 / FAILURE SIGNATURE

As reported upstream

[build] D:/Git/build-learnProtobuf-win/test.pb.cc:243: undefined reference to `absl::lts_20230125::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, std::basic_string_view<char, std::char_traits<char> >)'
Not a benchmark task.
  • No curated issue-specific recipe or verified environment fix is available.

02 / ENVIRONMENT RECIPE

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

03 / ORIGINAL ISSUE TEXT

protocolbuffers/protobuf #12292 · read the original issue
**What version of protobuf and what language are you using?**

Version: v22.2

Language: C++



**What operating system (Linux, Windows, ...) and version?**

Windows 11

**What runtime / compiler are you using (e.g., python version or gcc version)**

gcc12.2.0 (mingw)

**What did you do?**

1. Build and install protobuf from source code, and install it into the prefix of gcc.

2. Write the following cmake project containing 3 files: `CMakeLists.txt`, `test.proto` and `main.cpp`. They are located in same dir.

  

```cmake

#CMakeLists.txt

find_package(protobuf REQUIRED)



protobuf_generate_cpp(pb_src pb_hdr test.proto)



add_library(test_pb_lib ${pb_hdr} ${pb_src})

target_include_directories(test_pb_lib INTERFACE ${CMAKE_CURRENT_BINARY_DIR})

target_link_libraries(test_pb_lib PUBLIC protobuf::libprotobuf)



add_executable(test_pb main.cpp)

target_link_libraries(test_pb PRIVATE test_pb_lib)

```



```protobuf

// test.proto

syntax = "proto3";



message test {

  int32 msg = 1;

}

```



```cpp

// main.cpp

#include <iostream>



#include <test.pb.h>



int main(int, char **) {



  ::test test_msg;



  std::cout << "Hello, world!\n";

}

```



4. Configure my cmake project



```bash

cmake.EXE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=D:/ProgramFilesU/gcc-compilers/mingw-gcc12/bin/gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=D:/ProgramFilesU/gcc-compilers/mingw-gcc12/bin/g++.exe -SD:/Git/learnProtobuf -Bd:/Git/build-learnProtobuf-win -G Ninja

```

6. Build the project



```bash

cmake --build .

```



**What did you expect to see**



My code is compiled with no error.



**What did you see instead?**



22 errors was reported:

```

[main] Building folder: learnProtobuf 

[build] Starting build

[proc] Executing command: D:\ProgramFiles\CMake\bin\cmake.EXE --build d:/Git/build-learnProtobuf-win --config Debug --target all --parallel --

[build] [1/1 100% :: 0.167] Linking CXX executable test_pb.exe

[build] FAILED: test_pb.exe 

[build] cmd.exe /C "cd . && D:\ProgramFilesU\gcc-compilers\mingw-gcc12\bin\g++.exe -g  CMakeFiles/test_pb.dir/main.obj -o test_pb.exe -Wl,--out-implib,libtest_pb.dll.a -Wl,--major-image-version,0,--minor-image-version,0  libtest_pb_lib.a  D:/ProgramFilesU/gcc-compilers/mingw-gcc12/lib/libprotobuf.dll.a  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."

[build] D:/ProgramFilesU/gcc-compilers/mingw-gcc12/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libtest_pb_lib.a(test.pb.obj): in function `test::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':

[build] D:/Git/build-learnProtobuf-win/test.pb.cc:243: undefined reference to `absl::lts_20230125::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, std::basic_string_view<char, std::char_traits<char> >)'

[build] D:/ProgramFilesU/gcc-compilers/mingw-gcc12/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-m
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

underspecification
Label rules and the text that matched
[
  {
    "category": "underspecification",
    "rule": "signature.missing_system_requirement",
    "source": "failure_signature",
    "excerpt": "[build] D:/Git/build-learnProtobuf-win/test.pb.cc:243: undefined reference to `absl::lts_20230125::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, std::basic_string_view<char, std::char_traits<char> >)'"
  }
]

Issue targets Windows/MinGW consumer linking; legacy run instead reports missing submodule/configuration.

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