mirror of
https://github.com/ahgamut/rust-ape-example.git
synced 2024-11-21 15:30:59 +00:00
updated README.md
This commit is contained in:
parent
c504f3e9c6
commit
87d3f37776
1 changed files with 10 additions and 6 deletions
16
README.md
16
README.md
|
@ -4,9 +4,9 @@ This repository contains a simple `Hello world!` example in the [Rust][rust]
|
||||||
programming language, that builds with [Cosmopolitan Libc][cosmo].
|
programming language, that builds with [Cosmopolitan Libc][cosmo].
|
||||||
|
|
||||||
I created a [custom compilation target][custom-target] for Rust, called
|
I created a [custom compilation target][custom-target] for Rust, called
|
||||||
`x86_64-unknown-linux-cosmo`, to provide a build process the Cosmopolitan Libc
|
`x86_64-unknown-linux-cosmo`, to provide a build process that uses the
|
||||||
amalgamation and `cargo`. I followed the documentation in the [Rust
|
Cosmopolitan Libc amalgamation and `cargo`. I followed the documentation in the
|
||||||
Embedonomicon][custom-embed] to create the target.
|
[Rust Embedonomicon][custom-embed] to create the target.
|
||||||
|
|
||||||
An alternative method to build APEs with Rust would be to avoid `cargo`, just
|
An alternative method to build APEs with Rust would be to avoid `cargo`, just
|
||||||
use `rustc` or equivalent compiler to generate `.o` files, and then write a
|
use `rustc` or equivalent compiler to generate `.o` files, and then write a
|
||||||
|
@ -24,11 +24,15 @@ unzip cosmopolitan.zip
|
||||||
cd ../
|
cd ../
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Download the necessary toolchain(s) and source code for Rust:
|
2. Download the necessary *host* toolchain and source code for Rust:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# I was on Debian, so I did this
|
||||||
rustup toolchain install nightly-x86_64-unknown-linux-gnu
|
rustup toolchain install nightly-x86_64-unknown-linux-gnu
|
||||||
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
|
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
|
||||||
|
# on Alpine Linux, you may need to do
|
||||||
|
rustup toolchain install nightly-x86_64-unknown-linux-musl
|
||||||
|
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-musl
|
||||||
```
|
```
|
||||||
|
|
||||||
3. run `cargo build` to get the debug executable. This uses a bash script that
|
3. run `cargo build` to get the debug executable. This uses a bash script that
|
||||||
|
@ -54,8 +58,8 @@ that can be tested:
|
||||||
function and `#![restricted_std]`.
|
function and `#![restricted_std]`.
|
||||||
|
|
||||||
2. In the source code for Rust's `std` crate, change a `cfg_if` in
|
2. In the source code for Rust's `std` crate, change a `cfg_if` in
|
||||||
`$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/backtrace/src/backtrace/mod.rs`
|
`$HOME/.rustup/toolchains/<your-host-nightly-toolchain>/lib/rustlib/src/rust/library/backtrace/src/backtrace/mod.rs`
|
||||||
to not use the `noop` trace instead of depending on `libunwind`.
|
to use the `noop` trace instead of depending on `libunwind`.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
--- mod.rs 2022-06-21 12:52:21.724053459 +0530
|
--- mod.rs 2022-06-21 12:52:21.724053459 +0530
|
||||||
|
|
Loading…
Reference in a new issue