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

Build the standard library for an unsupported target #3

Open
ehuss opened this issue Jul 20, 2019 · 3 comments
Open

Build the standard library for an unsupported target #3

ehuss opened this issue Jul 20, 2019 · 3 comments
Labels
use case Discussion on a high-level use case

Comments

@ehuss
Copy link
Contributor

ehuss commented Jul 20, 2019

This is a "use case" issue to try to clarify and discuss a use case, and how it will be addressed.

Building a project for a target that is not available in the Rust distribution can be challenging currently. Some use tools like cargo-xbuild or xargo, or forking rust itself. One of the goals of "std-aware Cargo" is to make this process a little easier.

Many use cases for this are for no_std environments, and use .json target specifications to specify the environment.

Cargo already supports .json targets, and most of the work for supporting #2 should enable this for basic usage.

However, from a higher level this use case has some other issues:

  • Building no_std binaries often require nightly-only features. (TODO: list which are important).
  • The core library is not always maximally portable. It might be good to explore Standard library portability to figure out what needs there are to make it more portable.
  • Bringing up std on a new platform that does not conform to an existing one can be difficult. This might be another area to explore how to lower the difficulty.
@ehuss ehuss added the use case Discussion on a high-level use case label Jul 20, 2019
@elichai
Copy link

elichai commented Jul 20, 2019

Real world example of this use case:
https://github.com/baidu/rust-sgx-sdk

This replaces the std using one of two options:

  1. Xargo, which is a bit broken.
  2. GlobalAlloc + Nightly + no_std + Using their std as a "regular" crate.

@ids1024
Copy link

ids1024 commented Jul 20, 2019

As far as porting std for a new OS, I suppose something like my Minix port is a fairly minimal example of this, since it requires changes to std (and more substantial changes to libc) but doesn't require too much since it uses the Unix backend.

I started with xargo for it, but had too much many problems with that and just ended up invoking cargo directly in my Makefile to build std.

Even something this simple suffers from a reasonable amount of bit rot, since the changes are spread throughout std (and particularly libc) leading to merge conflicts. Also, to keep it building, the compiler has to be pinned to a specific nightly, or it will soon fail to compile with the newer rustc for one reason or another.

I'm not sure there's any easy solution to that though.

@PiDelport
Copy link

Here's the Rust SGX SDK's issue for using std-aware Cargo: apache/incubator-teaclave-sgx-sdk#311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
use case Discussion on a high-level use case
Projects
None yet
Development

No branches or pull requests

4 participants