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

Building with prost-build 0.10 fails on Windows #626

Closed
bruceg opened this issue Apr 14, 2022 · 9 comments
Closed

Building with prost-build 0.10 fails on Windows #626

bruceg opened this issue Apr 14, 2022 · 9 comments

Comments

@bruceg
Copy link
Contributor

bruceg commented Apr 14, 2022

After upgrading prost and prost-build to 0.10 (or 0.10.1), the Windows build of vector reliably fails.

The proximate error appears to be this:

2022-04-14T20:50:47.6295143Z          CustomBuild:
2022-04-14T20:50:47.6295522Z            Generating C:/Users/runneradmin/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/prost-build-0.10.1/third-party/protobuf/src/google/protobuf/map_lite_unittest.pb.cc
2022-04-14T20:50:47.6295957Z            Generating C:/Users/runneradmin/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/prost-build-0.10.1/third-party/protobuf/src/google/protobuf/unittest_import_lite.pb.cc
2022-04-14T20:50:47.6296344Z            Generating C:/Users/runneradmin/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/prost-build-0.10.1/third-party/protobuf/src/google/protobuf/unittest_import_public_lite.pb.cc
2022-04-14T20:50:47.6296704Z            Generating C:/Users/runneradmin/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/prost-build-0.10.1/third-party/protobuf/src/google/protobuf/unittest_lite.pb.cc
2022-04-14T20:50:47.6296802Z        8>ClCompile:
2022-04-14T20:50:47.6296907Z            test_util_lite.cc
2022-04-14T20:50:47.6297007Z        7>CustomBuild:
2022-04-14T20:50:47.6297384Z            C:/Users/runneradmin/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/prost-build-0.10.1/third-party/protobuf/src/google/protobuf/unittest_lite.pb.h: Permission denied

The full log:
https://gist.github.com/bruceg/7b290525da8b7dde4912c1e93baa48bc

(In the error report in the tonic repository, we reported an occasional failure on Linux as well, but I have been unable to reproduce that in more controlled circumstances, so I'm going to assume that's a separate issue)

@LucioFranco
Copy link
Member

This seems like some permissions issue with yalls runner? CI for windows on prost seems to work and I am not a windows/cmake expert enough to understand why its failing here.

I would suggest two things though:

  • Avoid vendoring the protoc and just download it for the CI run from their github releases all you need is the protoc in the PATH or set the PROTOC env var.
  • Have a different crate/project for protobufs and compile them in an integration test and generate them into the project so you don't need to compile them everytime.

@seancabahug
Copy link

I was able to build successfully after getting this error by using VS2017 build tools; I'm very unfamiliar with tooling like this but it seems that VS2019 build tools and newer get this error.

@The-Mr-L
Copy link

I solved it by getting the protoc and added it to the env path, as @LucioFranco said :)

@bruceg
Copy link
Contributor Author

bruceg commented Apr 20, 2022

Indeed, pulling in protoc has solved it for us as well, thanks for the pointer. Too bad the errors obscure this issue.

@bruceg bruceg closed this as completed Apr 20, 2022
@GPSnoopy
Copy link

GPSnoopy commented May 3, 2022

I am encountering this exact same issue as well. Looks like a race condition, as the file name is not always the same.

@GPSnoopy
Copy link

GPSnoopy commented May 9, 2022

FYI. I've now got this happening on two computers that were building fine a few days ago (always been VS2022). Definitely not a "closed" issue.

@GPSnoopy
Copy link

GPSnoopy commented May 9, 2022

The failure is definitely transient and does not always happen. Tends to happen less on faster machine with 16 cores than slower laptop with 4 cores. Again strongly suspect a race condition (e.g. trying to compile a file that is not fully generated/written/closed yet).

Using a prebuilt protoc is relatively easy in a CI/CD environment (esp. GitHub Actions) but manually setting it up for every workstation is a bit of a pain. So would appreciate if this could be fixed.

@LucioFranco
Copy link
Member

Right, though the fix for this issue needs to be done in the protobuf cmake code rather than what we control since we don't want to fork any of that code.

@fercele
Copy link

fercele commented Sep 13, 2023

In my machine (Windows 11), the permission denied error was due to my "PROC" environment variable pointing to a folder, instead of to the "protoc"binary itself. What i did was change the value for the env var, instead of putting the folder where I unzipped protoc, I put the fully qualified path to the binary. Worked right away. The message in windows is misleading. Permission denied. Of course it is denied, Rust was trying to execute a folder. lol. Hope this helps. Spent a bunch of hours trying to figure this out.

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

6 participants