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

[Question] Missing files from build scripts when running crates_vendor #1831

Closed
dk333333 opened this issue Feb 9, 2023 · 1 comment
Closed

Comments

@dk333333
Copy link

dk333333 commented Feb 9, 2023

Hi, I'm playing around with rules_rust release 0.17 in an existing large monorepo targeting linux.

I had to add crate_features = ["force_unix_path_separator"], to .../rules_rust/crate_universe/3rdparty/crates/BUILD.typenum-1.16.0.bazel due to missing an env var (I don't think folks would like to modify env vars in our builds):

--> external/cui__typenum-1.16.0/src/lib.rs:80:5
   |
80 |     include!(env!("TYPENUM_BUILD_OP"));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |

This seems to be an autogenerated file, is there a way to set this create feature upstream?

With that resolved, I am now running into issues with missing .rs files that are generated in build scripts, for example:

error: couldn't read /b/f/w/bazel-out/k8-opt-exec-EA861D4F/bin/external/cui__unicode-linebreak-0.1.4/unicode-linebreak_build_script.out_dir/tables.rs: No such file or directory (os error 2)
  --> external/cui__unicode-linebreak-0.1.4/src/lib.rs:31:1
   |
31 | include!(concat!(env!("OUT_DIR"), "/tables.rs"));
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

and

error: couldn't read /b/f/w/bazel-out/k8-opt-exec-EA861D4F/bin/external/cui__typenum-1.16.0/typenum_build_script.out_dir/op.rs: No such file or directory (os error 2)
  --> external/cui__typenum-1.16.0/src/lib.rs:72:5
   |
72 |     include!(concat!(env!("OUT_DIR"), "/op.rs"));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |

any ideas how to debug this? The bazel-out directory seems reasonable?

load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_vendor")

crates_vendor(
    name = "crates_vendor",
    mode = "remote",
    tags = ["manual"],
    vendor_path = "crates",
)

in workspace:

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

rules_rust_dependencies()

rust_register_toolchains(
    edition = "2021",
    extra_target_triples = [],
    urls = [".../static.rust-lang.org/dist/{}.tar.gz"],
    versions = ["1.66.1"],
)

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")

crate_universe_dependencies(rust_version = "1.66.1")
@dk333333
Copy link
Author

dk333333 commented Mar 2, 2023

This is fixed by #1781 ! Running into different issues now but will make new issues for those

@dk333333 dk333333 closed this as completed Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants