-
Notifications
You must be signed in to change notification settings - Fork 105
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
unable to compile syn #159
Comments
This smells like I'd try manually configuring the cfg flags:
|
On Fri, May 29, 2020 at 5:20 PM Kornelijus Survila ***@***.***> wrote:
This smells like gen_buildrs not working correctly with proc-macro2
(could you check what cargo-raze generates?).
I'd try manually configuring the cfg flags:
[raze.crates.proc-macro2.'xxx']
additional_flags = [
"--cfg=use_proc_macro",
"--cfg=wrap_proc_macro",
]
Thanks, but I'm afraid that would not work; those flags must be passed as
"--cfg foo" (no = sign), as I found by examining the output of `cargo
build`. The only way I could get it working was by implementing a
cfg_flags attribute in rules_rust -
bazelbuild/rules_rust#321
The other thing that was giving me fits turned out to be the rust edition -
rules_rust defaults to 2015; setting it to 2018 fixed a whole bunch of
problems. Live and learn.
Gregg
|
I just tried your example and it builds fine after my suggested change:
It did fail with the same error beforehand. We don't really ever use
|
Why is this necessary? It seems like there are a few issues about being unable to compile without needing to add some flags to specific dependencies. Is there an issue outlining why that is? Maybe @acmcarther might know? |
Sorry I just noticed this, the issue with needed flags typically comes from If you look at proc_macro2 you will find a This file is run by cargo to configure the build, run generators, do autoconf style workloads. Even if you were to run the This ship sailed in cargo and is known to rust and us (https://internals.rust-lang.org/t/build-script-capabilities/8635). Initially AFAIK the idea was to avoid C style There is an RFC to work towards addressing this gap for the whole does my environment look like rustc using llvm on windows type deal (https://github.com/rust-lang/rfcs/blob/master/text/2523-cfg-path-version.md) With that I would guess that 80% of #[cfg(accessible(::std::u128))]
impl From<u128> for MyFancyCryptoThing {} For the record I thing the other 10% of For a reference of all the things that bite people during a build #41 I have a crazy side project to infer the bulk of these flags using symbolic execution but I doubt I will complete it any time soon. |
Any update on this? I might have hit this when trying to use https://crates.io/crates/strum_macros which depends on
|
I'm new to Rust but not to Bazel. I've spent most of the past two days trying to compile syn. I've learned a lot, but I admit defeat.
MWE using
unroll
, which depends on syn:~/tmp/unroll/WORKSPACE:
~/tmp/unroll/cargo/Cargo.toml:
Run
cargo vendor --versioned-dirs && cargo raze
from the cargo dir. Thencd cargo/vendor/syn-0.15.44 && cargo build
. Builds ok. Then try building with Bazel, from~/tmp/unroll
:$ bazel build //cargo/vendor/syn-0.15.44:syn
. Fails withDitto if you try to build unroll. If you remove
proc-macro
from the syn build targets, it builds ok, but then unroll breaks with a different error.I've tried a hundred variations on this, compared the compile commands, etc. and nothing works. I'm out of ideas, I hope somebody can help.
Thanks,
Gregg
The text was updated successfully, but these errors were encountered: