protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Cannot specify link libraries for target "libprotobuf" which is not built

Open kongen opened this issue 2 months ago • 2 comments

What version of protobuf and what language are you using? Version: main/v3.6.0/v3.5.0 etc. (NOTE: please try updating to the latest version of protoc/runtime possible beforehand to attempt to resolve your problem) Language: C++/Java/Python/C#/Ruby/PHP/Objective-C/Javascript Language: C++

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

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

What did you do? Steps to reproduce the behavior: cmake -DCMAKE_C_COMPILER=mipsel-axon-linux-gnu-gcc -DCMAKE_CXX_COMPILER=mipsel-axon-linux-gnu-g++ -DCMAKE_SYSTEM_PROCESSOR=arm ..

What did you expect to see A Makefile in the build root.

What did you see instead? CMake Error at cmake/protobuf-configure-target.cmake:11 (target_link_libraries): Cannot specify link libraries for target "libprotobuf" which is not built by this project. Call Stack (most recent call first): cmake/libprotobuf-lite.cmake:28 (protobuf_configure_target) CMakeLists.txt:278 (include)

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment We can reproduce this issue with arm-linux-gnueabi, mips-linux-gnu & mipsel-linux-gnu architectures, but not with aarch64-linux-gnu and x86_64-linux-gnu.

cmake -DCMAKE_C_COMPILER=mipsel-axon-linux-gnu-gcc -DCMAKE_CXX_COMPILER=mipsel-axon-linux-gnu-g++ -DCMAKE_SYSTEM_PROCESSOR=arm .. CMake Deprecation Warning at CMakeLists.txt:7 (cmake_policy): The OLD behavior for policy CMP0141 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

-- The C compiler identification is GNU 15.2.0 -- The CXX compiler identification is GNU 15.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/mipsel-axon-linux-gnu-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: /usr/bin/mipsel-axon-linux-gnu-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- protobuf version: 33.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 - Success -- Found Threads: TRUE -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -- Performing Test protobuf_HAVE_BUILTIN_ATOMICS -- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Failed -- Could NOT find GTest (missing: GTest_DIR) -- Fallback to downloading GTest 1.15.2 from GitHub -- Could NOT find absl (missing: absl_DIR) -- Fallback to downloading Abseil 20250512.1 from GitHub -- Performing Test ABSL_INTERNAL_AT_LEAST_CXX17 -- Performing Test ABSL_INTERNAL_AT_LEAST_CXX17 - Success -- Performing Test ABSL_INTERNAL_AT_LEAST_CXX20 -- Performing Test ABSL_INTERNAL_AT_LEAST_CXX20 - Failed CMake Error at cmake/protobuf-configure-target.cmake:11 (target_link_libraries): Cannot specify link libraries for target "libprotobuf" which is not built by this project. Call Stack (most recent call first): cmake/libprotobuf-lite.cmake:28 (protobuf_configure_target) CMakeLists.txt:278 (include)

kongen avatar Oct 18 '25 15:10 kongen

Forgot to mention, this has been reproduced with protobuf-32.1 and protobuf-33.0.

kongen avatar Oct 18 '25 15:10 kongen

Could you please include your CMake file to help us troubleshoot/investigate this?

bellspice avatar Oct 21 '25 17:10 bellspice