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

Problem with cgmath #30

Closed
SirVer opened this issue Feb 13, 2018 · 4 comments · Fixed by google/cargo-raze#2
Closed

Problem with cgmath #30

SirVer opened this issue Feb 13, 2018 · 4 comments · Fixed by google/cargo-raze#2

Comments

@SirVer
Copy link

SirVer commented Feb 13, 2018

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
@acmcarther
Copy link
Owner

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

@SirVer
Copy link
Author

SirVer commented Feb 13, 2018

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.

@acmcarther
Copy link
Owner

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

@SirVer
Copy link
Author

SirVer commented Feb 13, 2018

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.

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

Successfully merging a pull request may close this issue.

2 participants