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

docs.rs should ignore .cargo/config #647

Closed
jamwaffles opened this issue Mar 20, 2020 · 8 comments
Closed

docs.rs should ignore .cargo/config #647

jamwaffles opened this issue Mar 20, 2020 · 8 comments
Labels
C-build-failure Category: This is a crate that failed to build

Comments

@jamwaffles
Copy link

Crate name: sh1106
Build failure link: https://docs.rs/crate/sh1106/0.3.0/builds/231814

Additional details:

I'm building a no_std crate targeting thumbv7m-none-eabi, etc. To get docs.rs builds working again, I added the following to my Cargo.toml:

[package.metadata.docs.rs]
default-target = "x86_64-unknown-linux-gnu"

Which doesn't seem to have an effect, but only on docs.rs. If I build it locally using the docs.rs repo and the following command, it builds fine.

docker-compose run -v "$(realpath ~/Repositories/sh1106)":/build web build crate --local /build

I do have a .cargo/config with the following at the end which may be causing issues?

[build]
target = "thumbv7m-none-eabi"
@jamwaffles jamwaffles added the C-build-failure Category: This is a crate that failed to build label Mar 20, 2020
@jyn514
Copy link
Member

jyn514 commented Mar 20, 2020

Hmm I thought we fixed this in #633 ... In the meantime you can workaround it by removing .cargo/config.

Maybe the issue is that since we don't pass --target to cargo it uses the value in .cargo/config? In that case setting default-target to anything other than x86_64-unknown-linux-gnu should also fix the build error.

I wish there were a way to get cargo to tell us what target it plans to build ... cargo metadata might have that info?

@jyn514
Copy link
Member

jyn514 commented Mar 20, 2020

The fact that it works locally but not in production is also very confusing, I have no idea what could cause that.

@jyn514
Copy link
Member

jyn514 commented Mar 20, 2020

The fact that it works locally but not in production is also very confusing, I have no idea what could cause that.

Oh I do have an idea - if you'd set default-target = "thumbv7m-none-eabi" earlier and run a build it would have cached the toolchain, so it would still be installed even when docs.rs didn't install it later.

@jamwaffles
Copy link
Author

jamwaffles commented Mar 21, 2020

That makes sense! I removed every image and volume I had locally and reran the build which reproduces the error I see on docs.rs.

I've changed the docs.rs config in Cargo.toml to this now:

[package.metadata.docs.rs]
targets = [ "thumbv7m-none-eabi", "thumbv7em-none-eabihf" ]

The local build now passes on a fresh cache. Is that the best way to go? I realise it's a very recent addition but if it works on docs.rs then it works great for me 😁.

@jyn514
Copy link
Member

jyn514 commented Mar 21, 2020

Yes, that should work. Thanks for working with us, I'm glad the new feature is helpful!

@jyn514 jyn514 changed the title Failure to build no_std crate, even with default-target = "x86_64-unknown-linux-gnu" docs.rs should ignore .cargo/config Mar 21, 2020
@jyn514
Copy link
Member

jyn514 commented Mar 21, 2020

Fixing the root problem should be basically the same steps as #555 (comment), rustwide should remove .cargo/config before starting the build.

@jamwaffles
Copy link
Author

Thanks for the suggestions! My builds are working again. Please close this issue if you think it should be :)

@jyn514
Copy link
Member

jyn514 commented Mar 21, 2020

I'll open a new issue for ignoring .cargo/config so you don't get spammed with notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-build-failure Category: This is a crate that failed to build
Projects
None yet
Development

No branches or pull requests

2 participants