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

hello example breaks with newer deps #158

Open
mobileink opened this issue May 23, 2020 · 1 comment
Open

hello example breaks with newer deps #158

mobileink opened this issue May 23, 2020 · 1 comment

Comments

@mobileink
Copy link
Contributor

Upgrading the deps for the hello_cargo_library example to log = "0.4.8" and fern = "0.6.0" results in:

error[E0425]: cannot find function set_boxed_logger in module log
--> cargo/vendor/fern-0.6.0/src/builders.rs:607:14
|
607 | log::set_boxed_logger(log)?;
| ^^^^^^^^^^^^^^^^ not found in log

According to the log doc, "The set_boxed_logger function is available with the std Cargo feature". Ok, cargo/vendor/log-0.4.8/BUILD.bazel has:
crate_features = [
"std",
],

Which looks about right to me (who have no experience with Rust but a fair amount of Bazel experience). So I added the same attrib to the root BUILD.bazel file; this had no discernable effect. According to the cargo-raze docs, I should see -cfg feature="std" in the compile command, but I don't. So I tried to use rustc_flags, but that attrib seems to have no effect, no matter what I put in it.

I hope this is resolvable, I'd really like to use rules_rust to bazelize a library.

Thanks, Gregg

The compile command:

/usr/bin/sandbox-exec -f /private/var/tmp/_bazel_gar/dce27a209127ac639b3875f03006c533/sandbox/darwin-sandbox/10/sandbox.sb /var/tmp/_bazel_gar/install/1d6d7a22a62da56414387a04bacbf619/process-wrapper '--timeout=0' '--kill_delay=15' /bin/bash -c 'CARGO_MANIFEST_DIR=$(pwd)/cargo/vendor/fern-0.6.0 external/rust_darwin_x86_64/bin/rustc "$@" --remap-path-prefix="$(pwd)"=__bazel_redacted_pwd' '' cargo/vendor/fern-0.6.0/src/lib.rs '--crate-name=fern' '--crate-type=lib' '--codegen=metadata=-222811272' '--out-dir=bazel-out/darwin-fastbuild/bin/cargo/vendor/fern-0.6.0' '--codegen=extra-filename=-222811272' '--codegen=opt-level=0' '--codegen=debuginfo=0' '--emit=dep-info,link' '--color=always' '--target=x86_64-apple-darwin' '--cap-lints=allow' '--edition=2018' '--codegen=linker=external/local_config_cc/cc_wrapper.sh' --codegen 'link-args=-lc++ -fobjc-link-runtime -headerpad_max_install_names -no-canonical-prefixes -mmacosx-version-min=10.15' --extern 'log=bazel-out/darwin-fastbuild/bin/cargo/vendor/log-0.4.8/liblog--2139748863.rlib' '-Ldependency=bazel-out/darwin-fastbuild/bin/cargo/vendor/log-0.4.8' '-Ldependency=bazel-out/darwin-fastbuild/bin/cargo/vendor/cfg-if-0.1.2')
@Arm1stice
Copy link
Contributor

Arm1stice commented Jun 2, 2020

This seems to be a duplicate of #110. Adding the following to your Cargo.toml and re-running cargo raze should let you build:

[raze.crates.log.'0.4.8']
additional_flags = [
    "--cfg=atomic_cas"
]

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

2 participants