jimmont
jimmont12mo ago

cargo compile size 160M

When using cargo install deno the result is 160M, if there's info on shrinking this somewhere please let me know. (Or if this question belongs in another channel.) Thanks very much. Side Note: I'm doing this on a Raspberry Pi which works fine and I'm also not aware of other working option(s) for the latest version. The snap option wouldn't install correctly on some of these raspberry pi's and the deno from the pi4 works on all the pi3's I have which are running the Raspberry Pi OS with Debian 11 (64bit all).
3 Replies
Kyiro
Kyiro12mo ago
My guess is it might be building without LTO? https://github.com/rust-lang/cargo/issues/7539
GitHub
What's the right way to install/build with lto? · Issue #7539 · rus...
Hi, I want to use LTO when i'm installing crates but doing the naive RUSTFLAGS=-Clto cargo install something doesn't quite work, it seems to fail on proc-macros Example: $ RUSTFLAGS=-Clto c...
jimmont
jimmont12mo ago
Unfortunately that doesn't work, including the possibility that the details are incomplete so I'm not doing what's necessary resulting in not being able to compile for the target platform; it's unfortunate the org hasn't prioritized this platform, specifically Raspberry Pi OS 64-bit Debian 11 Bullseye as it's a relatively broad audience and the install I did previously worked fine across all the RPi 3 and 4 devices. If there's a place to raise this separate issue happy to provide that input, tho I believe there is already something active on Github that relates.
mmastrac
mmastrac12mo ago
I have a few Pis in my basement, so I'm definitely sympathetic to this issue. We are unfortunately fighting a few issues -- the v8 library itself is extremely heavy. You can see the size of the .a file that we link on the rusty_v8 releases page (https://github.com/denoland/rusty_v8/releases). We also have a startup snapshot that is designed to make deno start up fast. The snapshot takes up a good chunk of the binary size, even compressed. While we don't have a lot of options w/making v8 smaller (LTO helps, but it's just a massive codebase), we might be able to offer options like building without a snapshot. You'd trade off slower start times for smaller binary sizes, but that might be acceptable for a lot of folks.