protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Error message should be reported after detecting protoc execution failure

Open JackBoosY opened this issue 5 years ago • 4 comments

Hi guys, Recently, some issues in vcpkg reported that opencv4 or Darknet failed to build when using protoc(#10695 #11802 etc.). After an in-depth investigation, the reason for the build failure is that the library that protoc depends on has not been found or installed in the path where it is located. And I found that the execution command of protoc is written here: https://github.com/protocolbuffers/protobuf/blob/1dae8fdd6271d091bbf43c0fd5855603ba533c1d/cmake/protobuf-config.cmake.in#L126

Is there any way to write detailed logs to the log when protoc fails to execute?

Thanks.

What version of protobuf and what language are you using? Version: 3.12.0 Language: C++/CMake

What operating system (Linux, Windows, ...) and version? Windows What runtime / compiler are you using (e.g., python version or gcc version) N/A What did you do? Steps to reproduce the behavior(on Windows):

  1. git clone https://github.com/microsoft/vcpkg.git
  2. ./bootstrap-vcpkg.bat
  3. ./vcpkg install protobuf
  4. del PATH_TO_VCPKG/installed/x86-windows/tools/protobuf/libprotobuf.dll
  5. ./vcpkg install opencv4
  6. See error in PATH_TO_VCPKG/buildtrees/opencv4/install-x86-windows-dbg-out.log

What did you expect to see Report error info in log,

What did you see instead?

[233/470] cmd.exe /C "cd /D F:\vcpkg\buildtrees\opencv4\x86-windows-dbg\modules\dnn && F:\vcpkg\installed\x86-windows\tools\protobuf\protoc.exe --cpp_out F:/vcpkg/buildtrees/opencv4/x86-windows-dbg/modules/dnn -I F:/vcpkg/buildtrees/opencv4/src/4.1.1-fb9e10326a/modules/dnn/src/caffe -I F:/vcpkg/buildtrees/opencv4/src/4.1.1-fb9e10326a/modules/dnn/src/onnx -I F:/vcpkg/buildtrees/opencv4/src/4.1.1-fb9e10326a/modules/dnn/src/tensorflow F:/vcpkg/buildtrees/opencv4/src/4.1.1-fb9e10326a/modules/dnn/src/tensorflow/attr_value.proto" FAILED: modules/dnn/attr_value.pb.h modules/dnn/attr_value.pb.cc 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 vcpkg-latest

JackBoosY avatar Jun 11 '20 08:06 JackBoosY

If I follow, this is a bug in vcpkg, not protoc. protoc can't log anything if it isn't even launched. If I'm misreading this, please reopen.

elharo avatar Sep 01 '21 15:09 elharo

@elharo Yeah that's caused by a vcpkg bug, but I wish to print some error message when add_custom_command run failed.

JackBoosY avatar Sep 02 '21 02:09 JackBoosY

This change is not OK per the JSON spec. JSON allows "true" and "false" for boolean values. It does not allow TRUE, False, ERROR, etc.

elharo avatar Jun 29 '22 11:06 elharo

sorry, commented on wrong issue.

elharo avatar Jun 29 '22 11:06 elharo

Turning up the verbosity in CMake may help, but this doesn't seem like a problem protobuf can fix (it looks like a CMake/vcpkg issue to me)

mkruskal-google avatar Sep 01 '22 17:09 mkruskal-google