general:rust
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
general:rust [2022/08/26 10:13] – [Rust guides] sunkan | general:rust [2023/02/21 11:05] (current) – sunkan | ||
---|---|---|---|
Line 9: | Line 9: | ||
* mkdir -p / | * mkdir -p / | ||
* cp -dR --preserve=timestamps rustc-1.XX.X-src/ | * cp -dR --preserve=timestamps rustc-1.XX.X-src/ | ||
+ | |||
+ | ====== Add WASM support ====== | ||
+ | Found good info here [[https:// | ||
+ | |||
+ | < | ||
+ | $ wget https:// | ||
+ | $ wget https:// | ||
+ | $ gpg --verify rust-std-1.66.0-wasm32-unknown-unknown.tar.xz.asc | ||
+ | |||
+ | $ tar xvaf rust-std-1.66.0-wasm32-unknown-unknown.tar.xz | ||
+ | |||
+ | $ rustc --print sysroot | ||
+ | / | ||
+ | |||
+ | # cd rust-std-1.66.0-wasm32-unknown-unknown/ | ||
+ | # cp --preserve=timestamps -R rust-std-wasm32-unknown-unknown/ | ||
+ | </ | ||
====== Compiling Rust code with MSVC ====== | ====== Compiling Rust code with MSVC ====== | ||
Line 24: | Line 41: | ||
</ | </ | ||
+ | ====== Cross compiling for ARMv7 ====== | ||
+ | Make sure to have the necessary external libraries available if needed. | ||
+ | Example with librrd (and its dependencies) | ||
+ | |||
+ | < | ||
+ | # Needs librrd-dev: | ||
+ | |||
+ | # | ||
+ | #| Status=Not/ | ||
+ | #|/ Err? | ||
+ | #||/ Name | ||
+ | # | ||
+ | #ii librrd-dev: | ||
+ | </ | ||
+ | |||
+ | Then to compile for armv7-unknown-linux-gnueabihf | ||
+ | < | ||
+ | cargo build -r --target armv7-unknown-linux-gnueabihf --config target.armv7-unknown-linux-gnueabihf.linker=\" | ||
+ | </ | ||
====== Rust error handling ====== | ====== Rust error handling ====== | ||
Line 41: | Line 77: | ||
[[https:// | [[https:// | ||
+ | |||
====== Rust memory ====== | ====== Rust memory ====== | ||
[[https:// | [[https:// | ||
+ | |||
+ | ====== Perf and Rust ====== | ||
+ | From [[https:// | ||
+ | The basic perf command is this: | ||
+ | |||
+ | < | ||
+ | perf record -F99 --call-graph dwarf XXX | ||
+ | </ | ||
+ | |||
+ | The -F99 tells perf to sample at 99 Hz, which avoids generating too much data for longer runs (why 99 Hz you ask? It is often chosen because it is unlikely to be in lockstep with other periodic activity). The --call-graph dwarf tells perf to get call-graph information from debuginfo, which is accurate. The XXX is the command you want to profile. So, for example, you might do: | ||
+ |
general/rust.1661508795.txt.gz · Last modified: 2022/08/26 10:13 by sunkan