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

error[E0463]: can't find crate for core #837

Closed
pioneerlfn opened this issue Jul 17, 2020 · 9 comments
Closed

error[E0463]: can't find crate for core #837

pioneerlfn opened this issue Jul 17, 2020 · 9 comments

Comments

@pioneerlfn
Copy link

when run "cargo build" within blog-02,
it reports "can't find crate for core

i have already used nightly.

blog_os git:(post-02) rustc --version
rustc 1.46.0-nightly (346aec9b0 2020-07-11)

@bjorn3
Copy link
Contributor

bjorn3 commented Jul 17, 2020

You need to use cargo xbuild, not cargo build.

@pioneerlfn
Copy link
Author

You need to use cargo xbuild, not cargo build.

when run cargo xbuild, error still reported:

error[E0461]: couldn't find crate `core` with expected target triple x86_64-blog_os-10958214645806601562

@bjorn3
Copy link
Contributor

bjorn3 commented Jul 17, 2020

Run cargo clean once. After that cargo xbuild should work fine.

@pioneerlfn
Copy link
Author

Run cargo clean once. After that cargo xbuild should work fine.

thanks for helping me so patiently!
i did as what you said, but the error still exsits, as follows:

  blog_os git:(post-02) cargo clean
➜  blog_os git:(post-02) cargo xbuild
   Compiling compiler_builtins v0.1.32
   Compiling core v0.0.0 (/home/lfn/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
   Compiling rustc-std-workspace-core v1.99.0 (/home/lfn/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/tmp/cargo-xbuildkSeMac)
    Finished release [optimized] target(s) in 12.42s
   Compiling bootloader v0.9.8
   Compiling rlibc v1.0.0
error[E0461]: couldn't find crate `core` with expected target triple x86_64-blog_os-10958214645806601562
  |
  = note: the following crate versions were found:
          crate `core`, target triple x86_64-blog_os-6028079494216025267: /home/lfn/Documents/rust/projects/blog_os/target/sysroot/lib/rustlib/x86_64-blog_os/lib/libcore-8db6693f79383387.rmeta
          crate `core`, target triple x86_64-blog_os-6028079494216025267: /home/lfn/Documents/rust/projects/blog_os/target/sysroot/lib/rustlib/x86_64-blog_os/lib/libcore-8db6693f79383387.rlib

error: aborting due to previous error

error: could not compile `rlibc`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

@bjorn3
Copy link
Contributor

bjorn3 commented Jul 17, 2020

Strange. I don't know what could be the problem.

@pioneerlfn
Copy link
Author

Strange. I don't know what could be the problem.

thx all the same~~

@phil-opp
Copy link
Owner

Sorry for the confusion all! I just updated the blog to use standard cargo build instead of cargo-xbuild in #835. However, this only works on the latest nightlies, so this is likely the problem here.

On https://os.phil-opp.com/minimal-rust-kernel/#building-our-kernel I put some note about this:

Note: The unstable.build-std configuration key requires at least the Rust nightly from 2020-07-15. Right now, the rustfmt component is not available on these recent nightlies, so you might need to use rustup update nightly --force to update your nightly, which skips the rustfmt component if it's not available.

I will also add this note to the Readme to try to prevent this confusion in the future.

@phil-opp
Copy link
Owner

I will also add this note to the Readme to try to prevent this confusion in the future.

Done.

@pioneerlfn
Copy link
Author

pioneerlfn commented Jul 17, 2020

Sorry for the confusion all! I just updated the blog to use standard cargo build instead of cargo-xbuild in #835. However, this only works on the latest nightlies, so this is likely the problem here.

On https://os.phil-opp.com/minimal-rust-kernel/#building-our-kernel I put some note about this:

Note: The unstable.build-std configuration key requires at least the Rust nightly from 2020-07-15. Right now, the rustfmt component is not available on these recent nightlies, so you might need to use rustup update nightly --force to update your nightly, which skips the rustfmt component if it's not available.

I will also add this note to the Readme to try to prevent this confusion in the future.

It works!
Thx a lot!!

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

3 participants