bazelbuild / bazelbuild/rules_rust
Build fails if i try to use the crate with pkg-config feature enabled
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
We are using the sdl2 crate, that wraps the system-wide sdl library.
We want to use the "pkg-config" feature, in order it to work on different platforms.
It works with cargo.
But if I run it with bazel, it fails to run "pkg-config" during the build time.
The minimal repository reproducing the problem is here: https://github.com/golovasteek/bazel_playground/tree/f92f76e69d6c4976c3bfe509468ccf6089ca03fa
The error that I see:
```
--stderr:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Could not run `"pkg-config" "--libs" "--cflags" "sdl2"`
The pkg-config command could not be found.
Most likely, you need to install a pkg-config package for your OS.
Try `brew install pkg-config` if you have Homebrew.
If you've already installed it, ensure the pkg-config command is one of the
directories in the PATH environment variable.
If you did not expect this build to link to a pre-installed system library,
then check documentation of the sdl2-sys crate for an option to
build the library from source, or disable features or dependencies
that require pkg-config.', external/crate_index__sdl2-sys-0.35.2/build.rs
```
I'm using bazel 6.0 and rules_rust 0.18.0
Contributor guide
Assessment
This issue has not been assessed yet.