Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 673 by weegreen...@gmail.com: protoc: can't control output directory
https://code.google.com/p/protobuf/issues/detail?id=673

I am working on integrating the protoc compiler to my build system, however I'm finding it difficult to control where the output files are saved.

What steps will reproduce the problem?

1. unzip project

2. change directories
    $ cd protobuf_bug

3. execute expected use case:
$ protoc --cpp_out=src/audacity/messages/pb src/audacity/messages/pb/Type.proto

4. observe output files not placed in specified output directory:
    $ find .
    .
    ./src
    ./src/audacity
    ./src/audacity/messages
    ./src/audacity/messages/pb
    ./src/audacity/messages/pb/src
    ./src/audacity/messages/pb/src/audacity
    ./src/audacity/messages/pb/src/audacity/messages
    ./src/audacity/messages/pb/src/audacity/messages/pb
    ./src/audacity/messages/pb/src/audacity/messages/pb/Type.pb.h
    ./src/audacity/messages/pb/src/audacity/messages/pb/Type.pb.cc
    ./src/audacity/messages/pb/Type.proto

5. clean up the mess
    $ rm -rf src/audacity/messages/pb/src

6. execute next expected use case:
    $ protoc --cpp_out=. src/audacity/messages/pb/Type.proto

7. observe correct output:
    $ find .
    .
    ./src
    ./src/audacity
    ./src/audacity/messages
    ./src/audacity/messages/pb
    ./src/audacity/messages/pb/Type.pb.h
    ./src/audacity/messages/pb/Type.pb.cc
    ./src/audacity/messages/pb/Type.proto

What is the expected output? What do you see instead?

I expect the generated files to be placed in the directory specified, instead funny path manipulation is occurring.

What version of the product are you using? On what operating system?

    $ protoc --version
    libprotoc 2.5.0
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID:     Ubuntu
    Description:        Ubuntu 14.04.1 LTS
    Release:    14.04
    Codename:   trusty

Please provide any additional information below.

Please add some option to explicitly place the generated files to specified location, similar to how gcc -o works, as protoc is advertised as a compiler. The location where protoc places output files isn't explained in the documentation, if the default is to always place the output files next to the .proto file, then there should be a set of --cpp, --python, --java switches which does this, rather some --XXX_out=DIR switch.


Attachments:
        protobuf_buf.zip  1.2 KB

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to