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

build script support does not handle cargo: stdout msgs #160

Open
mobileink opened this issue May 27, 2020 · 8 comments
Open

build script support does not handle cargo: stdout msgs #160

mobileink opened this issue May 27, 2020 · 8 comments

Comments

@mobileink
Copy link
Contributor

It looks like the current code is designed only to handle the case of passing files. Build scripts that emit e.g. cargo:rustc-env don't work. An example from crates.io is typenum 1.12.0.

Any plans to address this?

@damienmg
Copy link
Member

@mobileink Recently the build script handling have been updated and this should now works.

@hexdae
Copy link

hexdae commented Aug 5, 2020

I recently encountered the same problem, where typenum 1.12.0 just hangs forever while building with Bazel.

@damienmg
Copy link
Member

@d-asnaghi: with which version of rules_rust and cargo-raze?

@hexdae
Copy link

hexdae commented Aug 10, 2020

@d-asnaghi: with which version of rules_rust and cargo-raze?

Below you can find WORKSPACE and cargo raze info. Thanks @damienmg

WORKSPACE

http_archive(
    name = "io_bazel_rules_rust",
    sha256 = "13592b2073a2d9b00bf246eecb7c0da8f4c80b072b52fb7243881b6409e89764",
    strip_prefix = "rules_rust-69f71a92531f29eee032447098bc264eb9bece83",
    urls = ["https://github.com/bazelbuild/rules_rust/archive/69f71a92531f29eee032447098bc264eb9bece83.tar.gz"],
)

http_archive(
    name = "bazel_skylib",
    sha256 = "9a737999532daca978a158f94e77e9af6a6a169709c0cee274f0a4c3359519bd",
    strip_prefix = "bazel-skylib-1.0.0",
    url = "https://github.com/bazelbuild/bazel-skylib/archive/1.0.0.tar.gz",
)

load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
rust_repositories()

load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version")
bazel_version(name = "bazel_version")

Cargo raze

$> cargo show cargo-raze
---
id: cargo-raze
name: cargo-raze
description: A Cargo subcommand to generate Bazel BUILD files

documentation: None
homepage: None
repository: https://github.com/google/cargo-raze
max_version: 0.3.8
downloads: 10287
license: None
created: 2017-05-05T01:10:04.876511+00:00
updated: 2020-07-10T16:44:45.140499+00:00

@damienmg
Copy link
Member

Humm this is all very recent and should deal with that no issue, Can you share the cargo.toml (or even the files generated by cargo raze)? It is likely that the problem is the build.rs file stalling but I would need a repro to debug it.

(also sorry for the delay, I am currently really busy with my main task at Google so my 20% have to be less than 20%).

@hexdae
Copy link

hexdae commented Aug 11, 2020

Here's the cargo Cargo.toml, thanks a lot for looking into this. (A very similar problem to #41 (comment))

[package]
name = "Application"
version = "0.0.1"

[lib]
path = "fake_lib.rs"

[dependencies]
rusb = "0.6"
byte_struct = "0.6.0"

[raze]
workspace_path = "//cargo"
output_buildfile_suffix = "BUILD.bazel"
default_gen_buildrs = true

@damienmg
Copy link
Member

Hi sorry for the delay.

I cannot make this cargo.toml works:

$ cargo raze 
Loaded override settings: RazeSettings {
    workspace_path: "//cargo",
    target: "x86_64-unknown-linux-gnu",
    crates: {},
    gen_workspace_prefix: "raze",
    genmode: Vendored,
    output_buildfile_suffix: "BUILD.bazel",
    default_gen_buildrs: true,
}
Error: Raze failed to render with cause: "Failed to find expected vendored crates in Some("/tmp/test/./vendor/"): ["generic-array-0.14.4", "byte_struct_derive-0.4.2", "adler32-1.2.0", "vcpkg-0.2.10", "winapi-0.3.9"] and 23 others. Did you forget to run cargo vendor?"

Got that on both Linux & macOS.

@dae
Copy link
Contributor

dae commented Oct 21, 2020

The build hangs may have been caused by the issue fixed in bazelbuild/rules_rust#434

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

No branches or pull requests

4 participants