# Cross compile libcore

**URL:** <https://internals.rust-lang.org/t/cross-compile-libcore/22372>\
**Category:** libs\
**Created:** [February 10, 2025, 1:52pm UTC](https://internals.rust-lang.org/t/cross-compile-libcore/22372 "2025-02-10T13:52:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ARK](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@ARK](https://internals.rust-lang.org/u/ARK)\
**Post date:** [February 10, 2025, 1:52pm UTC](https://internals.rust-lang.org/t/cross-compile-libcore/22372/1 "2025-02-10T13:52:17Z")

</div>

Hi

Rust beginner here.

I am trying create a custom target for RISC-V architecture, I would like to build the core library and share it as precompiled library. I was successful in compiling the core library for custom target using -Z build-std feature.

Next if I share this as precompiled library, how do I make rustc use this version of the core library?

Any hint much appreciated. Thanks

---

<div class="post-metadata">

**Author:** ![Sky9](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/sky9/32/12959_2.png) [@Sky9](https://internals.rust-lang.org/u/Sky9)\
**Post date:** [February 10, 2025, 3:21pm UTC](https://internals.rust-lang.org/t/cross-compile-libcore/22372/2 "2025-02-10T15:21:22Z")

</div>

Have you tried `--sysroot`?

[https://doc.rust-lang.org/rustc/command-line-arguments.html#--sysroot-override-the-system-root](https://doc.rust-lang.org/rustc/command-line-arguments.html#--sysroot-override-the-system-root)

---

<div class="post-metadata">

**Author:** ![ARK](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@ARK](https://internals.rust-lang.org/u/ARK)\
**Post date:** [February 12, 2025, 1:05pm UTC](https://internals.rust-lang.org/t/cross-compile-libcore/22372/3 "2025-02-12T13:05:03Z")

</div>

@Sky9 Where do I set the --sysroot, as a link-arg?

---

<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:** [August 6, 2026, 1:05pm UTC](https://internals.rust-lang.org/t/cross-compile-libcore/22372/4 "2026-08-06T13:05:29Z")

</div>

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