-
Notifications
You must be signed in to change notification settings - Fork 496
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
Don't invoke the bundled protoc binary on non-gnu Linux hosts #202
Comments
Ah, is this coming up when using |
Or, for a real challenge, convince upstream to ship fully static binaries :) |
There may be way too many corner cases; this would need to check if the libraries exist in the library path where the I'd rather suggest checking the host tuple (available from ???) or |
I’m still somewhat confused why asking users to make |
I second @nagisa's question: why do we need to handle the case where |
A compromise might be to prefer the |
@danburkert Would you accept a PR to move the order of preference from the bundled |
Just hit this, had to strace to track down the issue. I don't quite understand why prost is using a pre-compiled binary blob at all? (Using the PROTOC/PROTOC_INCLUDE workaround now) |
No, but an additional option on |
I still consider it a bug that |
@danburkert Hit the bug, is it acceptable to do something like this? We can run the binary to test if it works on the platform.
I would like to file the PR and test. |
@xhebox I recommend setting |
Just in case anyone stumbles across this and gets the wrong impression, the |
@danburkert Yeah, I can set PROTOC somehow, github.com/AdelieLinux/gcompat can even get the executable runnable under musl-host linux. But that It is not working by default, and I don't even know how to fix it before digging deep. I would prefer adding some switches to move env-protoc before the bundled, or not to use the bundled one on musl(it is not working anyway). Fallback is also a good alternative:
The most simple way I can come up with, is running the binary directly. Then we can know if we should fallback. Maybe you can check if there is
Running binary is equaivalent to ldd method, since the first thing before running is loading. And musl host does not necessarily come with a ldd program(you may not know where it is due to PATH). So running binary is the easiest and most reliable way overall. Which way do you think is acceptable? It is just not good if prost-build is not working by default on musl. |
Nice! |
Yep sorry I forgot to update this thread - I figured out there's a pretty bullet-proof way to fall back to the |
This continues to be a major pain on NixOS hosts, for what its worth. Even though a perfectly working |
For my own edification - what's different about NixOS? Does it not ship glibc? |
Also you may want to take this to a new issue, it's easy for this stuff to get lost in the noise of a closed issue. |
I did file an issue in the past (https://github.com/danburkert/prost/issues/182). Just wanted to add that the fix that was made for |
PROTOC="${pkgs.protobuf}/bin/protoc";
PROTOC_INCLUDE="${pkgs.protobuf}/include"; gets around the weird blob execution. Want to reiterate that running a third party binary blob is a security issue, and it's also completely unnecessary. |
@danburkert NixOS ships glibc, but it has a completely different filesystem layout than most distributions (package paths are basically prefixed with an integrity hash of the package build code, and are completely immutable). So much so that even if the upstream maintainers made the protobuf binary statically linked, it still wouldn't work because the linux loader's location is also at such a path, and the default burnt-in location ( |
It's really unpleasant to have random broken binaries shipped inside crates overriding the perfectly-working ones I've already provided in the environment. To be honest, it's really unpleasant to have random binaries shipped inside crates overriding my environment even if they worked fine. |
I just hit this issue on NixOS as well. Thanks for the env var fix, it works! |
Revisiting the problem reported in #182. Unfortunately, it percolates to builds that use tower-grpc-build and troubleshooting clues are currently less than ideal.
Is it possible to avoid running the bundled protoc on non-glibc (e.g. musl) Linux host environment and report that a binary needs to be supplied? Notably this is different from the build target.
The text was updated successfully, but these errors were encountered: