CMake build error at protobuf on C++ project with opencv

Woods Sea 10 Reputation points
2025-06-24T12:16:58.39+00:00

When building x86 of the project with opencv, I got an error as blew。 No problem buiding x64。


main] Configuring project: MyProject

[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_TOOLCHAIN_FILE=E:/Project/VCPkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-windows -DCMAKE_BUILD_TYPE=Debug -SE:/Project/GitlabPC_Dev/App/coconut/src/MyProject -BE:/Project/GitlabPC_Dev/App/coconut/src/MyProject/build/x86 -G Ninja

[cmake] -- Running vcpkg install

[cmake] Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...

[cmake] Detecting compiler hash for triplet x64-windows...

[cmake] Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe

[cmake] Detecting compiler hash for triplet x86-windows...

[cmake] Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x86/cl.exe

[cmake] The following packages will be built and installed:

[cmake] * abseil:x86-windows@20250127.1 -- git+https://github.com/microsoft/vcpkg@0230366a6b5339adce4a78c24a6177a1165e16d2

[cmake] * abseil:x64-windows@20250127.1 -- git+https://github.com/microsoft/vcpkg@0230366a6b5339adce4a78c24a6177a1165e16d2

[cmake] * libjpeg-turbo:x86-windows@3.1.0#1 -- git+https://github.com/microsoft/vcpkg@6180688844449e5724d6dc8eb49ab90124438ce2

[cmake] * liblzma:x86-windows@5.8.1 -- git+https://github.com/microsoft/vcpkg@55eb3803f1d0388aebca8fd293963721bbf0092c

[cmake] * libpng:x86-windows@1.6.46 -- git+https://github.com/microsoft/vcpkg@0074ace75112e0a4ff3465de21e692c07d6e6b5f

[cmake] * libwebp[core,libwebpmux,nearlossless,simd,unicode]:x86-windows@1.5.0#1 -- git+https://github.com/microsoft/vcpkg@4da57885ea948ff63857226aaf586d6c44b4c96d

[cmake] opencv3[core,dnn,flann,gapi,jpeg,msmf,png,quirc,tiff,webp]:x86-windows@3.4.20 -- git+https://github.com/microsoft/vcpkg@9058081f84a29712d9758047d0decc6dd61439f3

[cmake] * protobuf:x64-windows@5.29.3 -- git+https://github.com/microsoft/vcpkg@53c97b927087d1919f2a7ef6c34e4caf1a00cdf9

[cmake] * protobuf:x86-windows@5.29.3 -- git+https://github.com/microsoft/vcpkg@53c97b927087d1919f2a7ef6c34e4caf1a00cdf9

[cmake] * quirc:x86-windows@1.2 -- git+https://github.com/microsoft/vcpkg@f586c894573b92fc601590eb0e38b3e54e0c7f5c

[cmake] * tiff[core,jpeg,lzma,zip]:x86-windows@4.7.0 -- git+https://github.com/microsoft/vcpkg@54c1c045d21157ce32df8a1c8b7b9d57b0d5d6ce

[cmake] * utf8-range:x86-windows@5.29.3 -- git+https://github.com/microsoft/vcpkg@67a0b0ded179b27dc30195bab68549fab519e1e2

[cmake] * utf8-range:x64-windows@5.29.3 -- git+https://github.com/microsoft/vcpkg@67a0b0ded179b27dc30195bab68549fab519e1e2

[cmake] * vcpkg-cmake:x64-windows@2024-04-23 -- git+https://github.com/microsoft/vcpkg@e74aa1e8f93278a8e71372f1fa08c3df420eb840

[cmake] * vcpkg-cmake-config:x64-windows@2024-05-23 -- git+https://github.com/microsoft/vcpkg@97a63e4bc1a17422ffe4eff71da53b4b561a7841

[cmake] * vcpkg-get-python-packages:x64-windows@2025-04-05 -- git+https://github.com/microsoft/vcpkg@2550a21f375bb78fd3fba745a2e58a2355912767

[cmake] * zlib:x86-windows@1.3.1 -- git+https://github.com/microsoft/vcpkg@3f05e04b9aededb96786a911a16193cdb711f0c9

[cmake] Additional packages (*) will be modified to complete this operation.

[cmake] Restored 17 package(s) from C:\Users\xyz\AppData\Local\vcpkg\archives in 28 s. Use --debug to see more details.

[cmake] Installing 1/17 vcpkg-cmake-config:x64-windows@2024-05-23...

[cmake] Elapsed time to handle vcpkg-cmake-config:x64-windows: 16.5 ms

[cmake] vcpkg-cmake-config:x64-windows package ABI: 0e14b0c9feaa6019ed438a0d3162bf2a19fd5e129a5b57a19cd8f278f61acb46

[cmake] Installing 2/17 vcpkg-cmake:x64-windows@2024-04-23...

[cmake] Elapsed time to handle vcpkg-cmake:x64-windows: 16.7 ms

[cmake] vcpkg-cmake:x64-windows package ABI: cdaab5213c94b990c0574ba012b8884869a71b4b4d475611958df5a715bf6610

[cmake] Installing 3/17 libwebp[core,libwebpmux,nearlossless,simd,unicode]:x86-windows@1.5.0#1...

[cmake] Elapsed time to handle libwebp:x86-windows: 139 ms

[cmake] libwebp:x86-windows package ABI: 1f53111eae34bdbd7051980035c2d8260ce7a8066c5032c86aaf046659c61f76

[cmake] Installing 4/17 zlib:x86-windows@1.3.1...

[cmake] Elapsed time to handle zlib:x86-windows: 80.5 ms

[cmake] zlib:x86-windows package ABI: f642f050ad84f089bf9e01852eefe7202319ba1442f5119712debfc5e86024ce

[cmake] Installing 5/17 liblzma:x86-windows@5.8.1...

[cmake] Elapsed time to handle liblzma:x86-windows: 86.6 ms

[cmake] liblzma:x86-windows package ABI: 11be84ee1d1a48ff9532e316f401cfc51b5f75b049c2e880e2fd711b45b15b89

[cmake] Installing 6/17 libjpeg-turbo:x86-windows@3.1.0#1...

[cmake] Elapsed time to handle libjpeg-turbo:x86-windows: 37.5 ms

[cmake] libjpeg-turbo:x86-windows package ABI: 776e985cd182eeef1c509163f6b8447677f6291ec4f239e877e597c94fc4b47e

[cmake] Installing 7/17 tiff[core,jpeg,lzma,zip]:x86-windows@4.7.0...

[cmake] Elapsed time to handle tiff:x86-windows: 95.6 ms

[cmake] tiff:x86-windows package ABI: eddd6597aca86a7c62aa16811784fc6de7c0cd25dbcf2bf7ff632ce52565aa2f

[cmake] Installing 8/17 quirc:x86-windows@1.2...

[cmake] Elapsed time to handle quirc:x86-windows: 10.2 ms

[cmake] quirc:x86-windows package ABI: db2bf9ae29c564b311dd59da3c4c5e8698e3012e1a4b42b1a9d186f751133f6f

[cmake] Installing 9/17 libpng:x86-windows@1.6.46...

[cmake] Elapsed time to handle libpng:x86-windows: 88 ms

[cmake] libpng:x86-windows package ABI: 80c177e7329e6606b166e44bc9df6ce0417aa03be37f9eaf33ed2133831538f9

[cmake] Installing 10/17 abseil:x86-windows@20250127.1...

[cmake] Elapsed time to handle abseil:x86-windows: 950 ms

[cmake] abseil:x86-windows package ABI: b5f566409d187145abd9cc0024c6bc898b9d605dde7f076559e3ba08f107f448

[cmake] Installing 11/17 utf8-range:x86-windows@5.29.3...

[cmake] Elapsed time to handle utf8-range:x86-windows: 88.9 ms

[cmake] utf8-range:x86-windows package ABI: a5a4a6cba28b4ec0ebd0b69f24cdcb9386d7e636862ab70fa267bc96a9fdd12c

[cmake] Installing 12/17 abseil:x64-windows@20250127.1...

[cmake] Elapsed time to handle abseil:x64-windows: 684 ms

[cmake] abseil:x64-windows package ABI: d6911f0e671996d5102e5c8a79033bc8efa5ada91a23d92933bf8e9206d7e835

[cmake] Installing 13/17 utf8-range:x64-windows@5.29.3...

[cmake] Elapsed time to handle utf8-range:x64-windows: 123 ms

[cmake] utf8-range:x64-windows package ABI: 1320210e02bf0c705004d4694501a4e2c53efb55d4f8a664983f1dcd60ce4dd3

[cmake] Installing 14/17 protobuf:x64-windows@5.29.3...

[cmake] Elapsed time to handle protobuf:x64-windows: 248 ms

[cmake] protobuf:x64-windows package ABI: 9ce25292bee05def0207eea6e02fb6e8c6f6a6ed5a7612b8b668b4e68f6157b2

[cmake] Installing 15/17 protobuf:x86-windows@5.29.3...

[cmake] Elapsed time to handle protobuf:x86-windows: 218 ms

[cmake] protobuf:x86-windows package ABI: 3f6955dac709c949bc7c34463cf6820e795f5a86359cf104cbcf469bc0a7481f

[cmake] Installing 16/17 vcpkg-get-python-packages:x64-windows@2025-04-05...

[cmake] Elapsed time to handle vcpkg-get-python-packages:x64-windows: 23.4 ms

[cmake] vcpkg-get-python-packages:x64-windows package ABI: d1171bf20f406aa683d4b5c68b6f94219128c72412868384c37d26a4605410e2

[cmake] Installing 17/17 opencv3[core,dnn,flann,gapi,jpeg,msmf,png,quirc,tiff,webp]:x86-windows@3.4.20...

[cmake] Elapsed time to handle opencv3:x86-windows: 361 ms

[cmake] opencv3:x86-windows package ABI: 4cc5a2350dfe3d1dc82ebbe887636420abc9076a144b88b25c17287765009536

[cmake] Total install time: 3.5 s

[cmake] opencv3 is compatible with built-in CMake variables. In case of multiple OpenCV version installed, set OpenCV_ROOT before the find_package call:

[cmake]

[cmake] set(OpenCV_ROOT "${VCPKG_INSTALLED_DIR}/x86-windows/share/opencv3")

[cmake] find_package(OpenCV REQUIRED)

[cmake]

[cmake] -- Running vcpkg install - done

[cmake] -- The C compiler identification is Clang 20.1.0 with GNU-like command-line

[cmake] -- The CXX compiler identification is Clang 20.1.0 with GNU-like command-line

[cmake] -- Detecting C compiler ABI info

[cmake] -- Detecting C compiler ABI info - done

[cmake] -- Check for working C compiler: E:/BuildTools/clang+llvm-msvc/bin/clang.exe - skipped

[cmake] -- Detecting C compile features

[cmake] -- Detecting C compile features - done

[cmake] -- Detecting CXX compiler ABI info

[cmake] -- Detecting CXX compiler ABI info - done

[cmake] -- Check for working CXX compiler: E:/BuildTools/clang+llvm-msvc/bin/clang++.exe - skipped

[cmake] -- Detecting CXX compile features

[cmake] -- Detecting CXX compile features - done

[cmake] CMake Error at build/x86/vcpkg_installed/x86-windows/share/protobuf/vcpkg-cmake-wrapper.cmake:3 (_find_package):

[cmake] Could not find a configuration file for package "Protobuf" that is

[cmake] compatible with requested version "".

[cmake]

[cmake] The following configuration files were considered but not accepted:

[cmake]

[cmake] E:/Project/GitlabPC_Dev/App/coconut/src/MyProject/build/x86/vcpkg_installed/x86-windows/share/protobuf/protobuf-config.cmake, version: 29.3.0 (32bit)

[cmake]

[cmake] Call Stack (most recent call first):

[cmake] E:/Project/VCPkg/scripts/buildsystems/vcpkg.cmake:847 (include)

[cmake] C:/Program Files/CMake/share/cmake-4.0/Modules/CMakeFindDependencyMacro.cmake:78 (find_package)

[cmake] build/x86/vcpkg_installed/x86-windows/share/opencv3/OpenCVModules.cmake:19 (find_dependency)

[cmake] build/x86/vcpkg_installed/x86-windows/share/opencv3/OpenCVConfig.cmake:126 (include)

[cmake] E:/Project/VCPkg/scripts/buildsystems/vcpkg.cmake:893 (_find_package)

[cmake] CMakeLists.txt:49 (find_package)

[cmake]

[cmake]

[cmake] -- Configuring incomplete, errors occurred!


Can anyone help me please?

Thanks a lot.

Developer technologies C++
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Oskar-4348 0 Reputation points
    2025-06-24T12:32:13.33+00:00

    This is a CMake configuration error related to Protobuf version compatibility when building for x86 architecture. The error occurs because OpenCV3 is trying to find a compatible Protobuf configuration, but the installed x86 version (29.3.0) is marked as "32bit" and CMake considers it incompatible.

    0 comments No comments

  2. Woods Sea 10 Reputation points
    2025-06-25T00:01:33.6266667+00:00

    Hi @Oskar-4348,

    Thank you very much.

    Yes, I know the error information, But I don't know what caused this. I built x64 successfully with the same Protobuf configuration.

    By the way, the version of protobuf installed with opencv is 5.29.3. And, I wonder:

    1.Why no problem in building x64 with same configuration?

    2.It looks like that protobuf:x64-windows is also been installed though I just make x86-windows build, why?

    Is there something wrong?


    [cmake] * protobuf:x64-windows@5.29.3 -- git+https://github.com/microsoft/vcpkg@53c97b927087d1919f2a7ef6c34e4caf1a00cdf9

    [cmake] * protobuf:x86-windows@5.29.3 -- git+https://github.com/microsoft/vcpkg@53c97b927087d1919f2a7ef6c34e4caf1a00cdf9


    0 comments No comments

  3. Woods Sea 10 Reputation points
    2025-06-25T08:38:50.1233333+00:00

    It seems that Ninja can not be used to build 32-bit windows app, right?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.