# Can't find crate for \`std\` error - new target

**URL:** <https://internals.rust-lang.org/t/cant-find-crate-for-std-error-new-target/17239>\
**Category:** internals\
**Created:** [August 22, 2022, 7:53pm UTC](https://internals.rust-lang.org/t/cant-find-crate-for-std-error-new-target/17239 "2022-08-22T19:53:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fpichet](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/fpichet/32/9547_2.png) [@fpichet](https://internals.rust-lang.org/u/fpichet)\
**Post date:** [August 22, 2022, 7:53pm UTC](https://internals.rust-lang.org/t/cant-find-crate-for-std-error-new-target/17239/1 "2022-08-22T19:53:37Z")

</div>

Hi,

I am currently porting rust to a new target (out of tree). The host compiler run on Windows (msvc) and cross-compile to an embedded target.

I am at the point where I want to use the std that was built using: python x.py build --config opus\_config.toml

I changed the default rustc using: rustup toolchain link opus3-octasic-opuskernel C:\git\sdt\_rust\build\x86\_64-pc-windows-msvc\stage1

Now if I build a project, I get this error:

C:\git\hello\_world\> cargo build

```
Compiling hello_world v0.1.0 (C:\git\hello_world)
error[E0463]: can't find crate for `std`

```

I tried using "rustup target add" but that doesn't seem to work.

I can see the std files (.rlib and stuff) for my target in: C:\git\sdt\_rust\build\x86\_64-pc-windows-msvc\stage1-std\opus3-octasic-opuskernel\release

How can I tell cargo to look there for std lib?

Thank you

---

<div class="post-metadata">

**Author:** ![fee1-dead](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/fee1-dead/32/8232_2.png) [@fee1-dead](https://internals.rust-lang.org/u/fee1-dead)\
**Post date:** [August 23, 2022, 2:42am UTC](https://internals.rust-lang.org/t/cant-find-crate-for-std-error-new-target/17239/2 "2022-08-23T02:42:31Z")

</div>

Have you tried asking on Zulip? There are more compiler people active there and it is easier to receive and provide help on there.

---

<div class="post-metadata">

**Author:** ![bjorn3](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/bjorn3/32/2736_2.png) [@bjorn3](https://internals.rust-lang.org/u/bjorn3)\
**Post date:** [August 23, 2022, 1:35pm UTC](https://internals.rust-lang.org/t/cant-find-crate-for-std-error-new-target/17239/3 "2022-08-23T13:35:55Z")

</div>

What is your `opus_config.toml` file? You probably need to add the host target to the target array to allow building build script and proc macros. Also you need `cargo build --target opus3-octasic-opuskernel` to build for this target. Rustc defaults to building for the host target.

---

<div class="post-metadata">

**Author:** ![fpichet](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/fpichet/32/9547_2.png) [@fpichet](https://internals.rust-lang.org/u/fpichet)\
**Post date:** [August 23, 2022, 3:49pm UTC](https://internals.rust-lang.org/t/cant-find-crate-for-std-error-new-target/17239/4 "2022-08-23T15:49:09Z")

</div>

Turn out I just needed to add `--target opus3-octasic-opuskernel' on the cargo build.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [November 21, 2022, 3:49pm UTC](https://internals.rust-lang.org/t/cant-find-crate-for-std-error-new-target/17239/5 "2022-11-21T15:49:53Z")

</div>

Closed on November 21, 2022, 3:49pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
