Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failing to compile on Windows OS: "Missing output directives." #270

Closed
AndroidDeveloperLB opened this issue Apr 6, 2015 · 17 comments
Closed

Comments

@AndroidDeveloperLB
Copy link

I've downloaded those files:
Protocol Buffers 2.6.1 full source: https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
Protocol Compiler 2.6.1 binary for windows: https://github.com/google/protobuf/releases/download/v2.6.1/protoc-2.6.1-win32.zip
from here:
https://developers.google.com/protocol-buffers/docs/downloads

Then, I've decompressed them to the same folder, and created a folder "protos" within, and I called this command to compile:

 protoc –javanano_out=src/ -I protos protos/backup.proto

(as this website said : https://plus.google.com/+fabiolobrutto/posts/KJeyKMBHVT7 ).

But I get this error:

Missing output directives.

What should I do?
I just want to create a launcher, based on on the updated launcher3 app (lollipop).

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Apr 6, 2015

javanano is only available from v3.0.0-alpha-2. You can download its sources here: https://github.com/google/protobuf/releases

@xfxyjwf xfxyjwf closed this as completed Apr 6, 2015
@AndroidDeveloperLB
Copy link
Author

@xfxyjwf I still fail to compile (getting the same message), using the same command. I've tried running the command on all possible files:
protobuf-java-3.0.0-alpha-2.zip
protobuf-javanano-3.0.0-alpha-2.zip
Source code (zip)

I've used the latest compiler:
protoc-3.0.0-alpha-2-win32.zip

Can you please provide a step by step explanation?
Will it create all needed files? for example the "BackupProtos.java" file?

@cfallin
Copy link
Contributor

cfallin commented Apr 6, 2015

Is that a single dash in the option, i.e., -javanano_out ? Try it with two dashes: --javanano_out.

@AndroidDeveloperLB
Copy link
Author

@cfallin Can you please point me to the correct file? so that we could continue in the right direction?

@cfallin
Copy link
Contributor

cfallin commented Apr 6, 2015

As @xfxyjwf said above, you need 3.0.0-alpha-2. The windows compiler binary should be fine, unless I'm mistaken. Basically, I'm just pointing out a typo (two dashes instead of one).

@AndroidDeveloperLB
Copy link
Author

@cfallin But which file? I've found 3 possible candidates...

@cfallin
Copy link
Contributor

cfallin commented Apr 6, 2015

Use this to get protoc: protoc-3.0.0-alpha-2-win32.zip

Do exactly the same thing you did before, except for these changes we have suggested: (i) use 3.0.0-alpha-2 instead of the old version you had, and (ii) fix the dash typo.

@AndroidDeveloperLB
Copy link
Author

@cfallin I meant, which file should I download and perform the compilation command on? What you've provided is the compiler. For Android, which of those should I work on:

  • protobuf-java-3.0.0-alpha-2.zip
  • protobuf-javanano-3.0.0-alpha-2.zip
  • Source code (zip)

Anyway, I've tried doing it for each of those files, and now I get this error for all of them:

protos/backup.proto: No such file or directory

So I created a folder ".../protos/backup.proto" , and then I got this error (again, for all of those files):

protos/backup.proto: Permission denied

I used this command this time:

protoc --javanano_out=src/ -I protos protos/backup.proto

@cfallin
Copy link
Contributor

cfallin commented Apr 6, 2015

I'm afraid I don't understand what you're trying to do. It doesn't make sense to "perform the [protoc] compilation command" on the Protocol Buffers source code distribution. protoc is a compiler that takes your .proto source code (i.e., a .proto file that you have personally written) and generates code that implements the proto types.

If you had literally invoked protoc with a .zip file as input, you would have gotten parse errors. So you must be extracting the .zip and picking a .proto file from our source code. You shouldn't need to do this if your only goal is to use protocol buffers.

Other parts of your last message also don't make sense. Why do you create a folder with the name backup.proto? .proto files are supposed to be files, not folders. This might explain the "Permission denied" error you are getting (I don't know how Windows behaves when you try to open a folder as a plain file).

Could you explain from first principles what you are trying to do?

@AndroidDeveloperLB
Copy link
Author

Please read the first post. I don't perform the command on zipped file. I do it on the extracted one, as the instructions say.
Maybe I didn't understand it correctly? Maybe I should have done it on the "Launcher3" cloned folder?

I've tried now to run the command on the cloned "Launcher3" project, and this is what I got:

[libprotobuf WARNING google/protobuf/compiler/parser.cc:471] No syntax specified
 for the proto file. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to
specify a syntax version. (Defaulted to proto2 syntax.)

@cfallin
Copy link
Contributor

cfallin commented Apr 6, 2015

OK, making progress. It seems you've been able to invoke protoc on a .proto file now.

Do you see the output files in the output directory you specified? If so, protoc is working correctly (and any further issues should go to this "Launcher3" project). If not, let us know and we'll diagnose further.

@AndroidDeveloperLB
Copy link
Author

I assume the input is the "protos/backup.proto" file, and the output is inside the "src" folder, but all I can see there is a single file : "...src\com\android\launcher3\backup\BackupProtos.java" .

Shouldn't there be more files? Or at least a jar file?
By importing the project, I see a lot of classes that are missing. I might be wrong, but I think all start with "com.google.protobuf.nano.*" . For example:
com.google.protobuf.nano.MessageNano

@cfallin
Copy link
Contributor

cfallin commented Apr 6, 2015

protoc is a code generator -- its output is Java. It is not a full build system, so it does not produce JAR files.

The com.google.protobuf.* classes are in the runtime. These are what you will find in those other files you mentioned earlier (you want protobuf-javanano-3.0.0-alpha-2.zip).

It sounds like everything is working as intended. Please let us know if there are any other issues.

@AndroidDeveloperLB
Copy link
Author

After downloading "protobuf-java-3.0.0-alpha-2.zip" from here:
https://github.com/google/protobuf/releases

I got all source code errors figured out, so I think you've solved everything. Thank you.
Maybe I should post a tutorial about how to import the launcher, so that others would see how to do it. I could also put it into a repository.

@yuchuangu85
Copy link

How can i use this:
protoc –javanano_out=src/ -I protos protos/backup.proto
to generate the "BackupProtos.java" file?
Is there a tutorial to introduce the step?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jan 14, 2016

@yuchuangu85 see:
https://developers.google.com/protocol-buffers/docs/javatutorial

This tutorial talks about Java but it's mostly the same for javanano regarding how to compile proto files.

@yuchuangu85
Copy link

@xfxyjwf :
Thank you! I have generated the "BackupProtos.java" file.

taoso pushed a commit to taoso/protobuf that referenced this issue Aug 1, 2018
taoso pushed a commit to taoso/protobuf that referenced this issue Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants