Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Creator error : --proto_path



  • Error Message I received

    File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).


  • Lifetime Qt Champion

    Hi,

    You have to provide more context.



  • Trying to make a project with the Mingw32 toolkit and when I tried to build it with Qtcreator I get the following error message

    ../../ostinato/common/protocol.proto: File does not reside within any path specified using --proto_path (or -I).  You must specify a --proto_path which encompasses this file.  Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
    

  • Lifetime Qt Champion

    @theKid Please provide a full build log when you do a rebuild (as text please!). Thanks



  • I'm not sure as to what it needs or to edit. This is an OsP and the original developer doesn't use Qtcreator so they are unfamiliar with how to solve it


  • Lifetime Qt Champion

    Again: please provide more context.

    What project is that ?
    What OS are you working on ?
    What version of Qt are you using ?
    What version of Qt Creator are you using ?
    What version of protobuf are you using ?
    etc.



  • It sounds to me like you are trying to compile a Google Protocol Buffer file.
    This can be done using the Qt pro file with an extra compiler options.
    For example in your project file add something like this:

    PROTOC_DIR = "C:\protoc-3.6.1-win32\bin"
    PROTOS_DIR = $$PWD
    PROTOS = AxisMessage.proto
    
    message ("Protobuf Compiler for $${PROTOS}")
    gprotoc.name = protobuf_headers
    gprotoc.target = $$PWD/AxisMessage.pb.cc
    gprotoc.depends = FORCE
    gprotoc.variable_out = SOURCES
    gprotoc.commands = $$PROTOC_DIR\protoc --cpp_out=$$PWD --proto_path=$$PWD $$PROTOS
    gprotoc.CONFIG += no_link target_predeps
    
    PRE_TARGETDEPS = $$PWD/AxisMessage.pb.cc
    QMAKE_EXTRA_TARGETS += gprotoc
    
    

    If this is a CMAKE project, then I'm not sure what you do.



  • Project: Ostinato
    OS: Windows 10
    Qt: 5.11.2 MinGW 32
    Qt Creator: 4.7.2
    protobuf: 3.6.1 --- This may be a problem ---
    Winpcap : 4.1.2



  • 19:39:50: Running steps for project ost...
    19:39:50: Configuration unchanged, skipping qmake step.
    19:39:50: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" 
    cd common/ && ( test -e Makefile.ostproto || C:/Qt/5.11.2/mingw53_32/bin/qmake.exe -o Makefile.ostproto C:/Users/littl/Desktop/IntroSWE/Test/ostinato/common/ostproto.pro -spec win32-g++ CONFIG+=debug CONFIG+=qml_debug ) && C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.ostproto 
    mingw32-make[1]: Entering directory 'C:/Users/littl/Desktop/IntroSWE/Test/build-ost-Desktop_Qt_5_11_2_MinGW_32bit-Debug/common'
    C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.ostproto.Debug
    mingw32-make[2]: Entering directory 'C:/Users/littl/Desktop/IntroSWE/Test/build-ost-Desktop_Qt_5_11_2_MinGW_32bit-Debug/common'
    protoc --cpp_out=. --proto_path=. ../../ostinato/common/protocol.proto
    ../../ostinato/common/protocol.proto: File does not reside within any path specified using --proto_path (or -I).  You must specify a --proto_path which encompasses this file.  Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
    Makefile.ostproto.Debug:281: recipe for target 'protocol.pb.h' failed
    mingw32-make[2]: Leaving directory 'C:/Users/littl/Desktop/IntroSWE/Test/build-ost-Desktop_Qt_5_11_2_MinGW_32bit-Debug/common'
    Makefile.ostproto:36: recipe for target 'debug' failed
    mingw32-make[1]: Leaving directory 'C:/Users/littl/Desktop/IntroSWE/Test/build-ost-Desktop_Qt_5_11_2_MinGW_32bit-Debug/common'
    Makefile:99: recipe for target 'sub-common-ostproto-pro-make_first' failed
    mingw32-make[2]: *** [protocol.pb.h] Error 1
    mingw32-make[1]: *** [debug] Error 2
    mingw32-make: *** [sub-common-ostproto-pro-make_first] Error 2
    19:40:00: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project ost (kit: Desktop Qt 5.11.2 MinGW 32bit)
    When executing step "Make"
    19:40:01: Elapsed time: 00:11.
    

  • Lifetime Qt Champion

    Try replacing the . by $$PWD in the protobuff pri file.



  • will try, thank you


Log in to reply