Problem with `cgmath`
Closed this issue · 4 comments
This is probably not a bug, just a case of you're holding it wrong, but building cgmath with the generated build files does not work. An issue with generated files from a build script, I presume. I have no idea how to debug and fix this though - could you add some documentation somewhere?
ERROR: /Users/hrapp/Desktop/Programming/rust/point_cloud_viewer/cargo/vendor/cgmath-0.16.0/BUILD:17:1: error executing shell command: 'set -e; rm -rf bazel-out/darwin-fastbuild/bin/cargo/vendor/cgmath-0.16.0/cgmath.deps; mkdir bazel-out/darwin-fastbuild/bin/cargo/vendor/cgmath-0.16.0/cgmath.deps
ln -sf ../../approx-0.1.1/libappro...' failed (Exit 101)
error: environment variable `OUT_DIR` not defined
--> cargo/vendor/cgmath-0.16.0/src/macros.rs:480:18
|
480 | include!(concat!(env!("OUT_DIR"), "/swizzle_operator_macro.rs"));
| ^^^^^^^^^^^^^^^
error: couldn't read "cargo/vendor/cgmath-0.16.0/src/0/swizzle_operator_macro.rs": No such file or directory (os error 2)
--> cargo/vendor/cgmath-0.16.0/src/macros.rs:480:1
|
480 | include!(concat!(env!("OUT_DIR"), "/swizzle_operator_macro.rs"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INFO: Elapsed time: 3.149s, Critical Path: 2.99s
FAILED: Build did NOT complete successfully
Heh, here's my own raze configuration verbatim:
[raze.crates.cgmath.'0.16.0']
# Generates some functions or something
gen_buildrs = true
You'll need newer-than-master rules_rust for this to work though (containing bazelbuild/rules_rust#48, bazelbuild/rules_rust#47, and bazelbuild/rules_rust#38). I use https://github.com/acmcarther/rules_rust/tree/acm-01-19-nightly , but I'm pushing these changes into upstream master ASAP
I am using your fork from the README, I think it contains your changes.
git_repository(
name = "io_bazel_rules_rust",
commit = "5bc46ddca8817072cdae1961b3f9830a2bc3afa7",
remote = "https://github.com/acmcarther/rules_rust.git",
)
Copy and pasting the snippet you suggested above results in an invalid BUILD file being generated for cgmath (gist). Notice line 14: there is a newline missing. Manually adding the newline makes cgmath
compile. 🍾
The gen_buildrs
is deep black magic for me. I would appreciate a paragraph in the readme about this.
Oops, I fixed this in the remote mode, but not under vendor. I should've caught this with cargo-raze-examples, but didnt!
Can you take a look at the google/cargo-raze readme and see if it addresses your concerns: https://github.com/google/cargo-raze#handling-unconventional-crates
Yes, that docu is excellent and clears everything up.
Closing this issue, thanks for your excellent support! In fact, I manage to build the build_octree
binary from my root crate now with bazel. I had to copy my generated proto.rs
into src for the moment, but looking into how to build protos is actually the next step.