ProtoBuf.jl icon indicating copy to clipboard operation
ProtoBuf.jl copied to clipboard

Using ProtoBuf.protoc requires that ProtoBuf is in default environment

Open DrChainsaw opened this issue 4 years ago • 3 comments

The new bundled protoc is very convenient.

It would be even more convenient if one could run it from a project which has ProtoBuf as a dependency without having to install it to the main/default environment. Currently this fails with the error message:

ERROR: ArgumentError: Package ProtoBuf not found in current path:       
- Run `import Pkg; Pkg.add("ProtoBuf")` to install the ProtoBuf package.

Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base .\loading.jl:871
--julia_out: protoc-gen-julia: Plugin failed with status code 1.
ERROR: failed process: Process(setenv(....

Hopefully this is just a matter of adding some --project somewhere. Tested on windows 10 and protobuf 0.11.1.

Btw, it seems as users don't have execute permission to the .bat file by default. I had to add it manually or else the above failed with "access denied" even when running julia in admin mode. No idea if this is fixable or if it some general windows security thing one is not supposed to bypass.

DrChainsaw avatar Apr 11 '21 12:04 DrChainsaw

It would be even more convenient if one could run it from a project which has ProtoBuf as a dependency without having to install it to the main/default environment.

Agree. I have not found a clean way to do this... any suggestions are welcome!

it seems as users don't have execute permission to the .bat file by default.

I am not a Windows user, but it does seem like Windows security related when I tried reading up about it. Any suggestions on how to fix this will be useful!

tanmaykm avatar Apr 12 '21 07:04 tanmaykm

This has just bitten me on macOS. It would be great to have a note about this in the readme :)

killercup avatar May 15 '21 16:05 killercup

I've also noticed that protoc-gen-julia (and the bat file) are installed without executable permissions under .julia/packages/ProtoBuf/A71jO/plugin/. I don't believe it's a Windows security issue, just an oversight. chmod fixed it enough to use the ProtoBuf package.

cschiefe avatar Mar 04 '22 15:03 cschiefe

We don't use protoc anymore!

Drvi avatar Aug 18 '22 09:08 Drvi

Is there a workaround around this issue?

We are still using a ProtoBuf version with protoc because protojl cannot generate the Julia bindings for our proto files. I get the following error when I try

ERROR: LoadError: Unexpected token while parsing service definition: ProtoBuf.Tokens.Token(ProtoBuf.Tokens.SEMICOLON, ProtoBuf.Tokens.NO_ERROR, (34, 91), (34, 91), "")

I suspect this might be due to GRPC definitions. (If this is something protojl should be able to handle, please advise and I'll create a ticket for it.)

Even though the Julia project is resolved/instantiated and I can observe that protoc_jll is installed/pre-compiled, I get the following error if I run the command from a REPL started with Julia --project

LoadError: ArgumentError: Package protoc_jll [c7845625-083e-5bbe-8504-b32d602b7110] is required but does not seem to be installed:

Because of this we need to install ProtoBuf both in the default environment and in the project environment which consumes time and space.

senhalil avatar Feb 09 '23 15:02 senhalil