Setting up Rust Lang on Alpine is relatively straight-forward. You get the dependencies that includes clang and lld from the apk repositories and curl to download and install the Rust Toolchain. 1. Getting the dependencies We will need a C compiler and a Linker. Actually only the linker will be used to link your binaries against the standard C library unless your Rust project is explicitly called C programs. I will be using the LLVM Project’s lld linker and clang compiler.
In my previous post I showed how you can build your own WSL distro from Alpine root image. If you followed along, and then proceded to use the resulting distro, you would have been very frusted….I apoligize. The first attempt at installing any real language like Go or Rust or NodeJS would have resulted in another explosion of packages. I chose Alpine thinking that since this is used so heavily to package apps into docker images, it really must have been silm and dependency free.
Setting up Clang was probably the most involved process in this series. Ironically, creating a C programming environment without any GNU utilities is a lot harder than setting up a plain Go Lang environment setup or even Rust. But that’s my goal here. To create an environment for C programming that doesn’t involve me having to rely on GNU utilities. I am using Alpine Linux which immediately eliminates the glibc dependency, the rest of the article will cover how to minimize other GNU dependencies.
Recently, I got quite frustrated with the bloated WSL Distros that are shipped by Canonical and Debian Team. It comes preinstalled with Systemd, a horribly old version of Python and for some reason insists that vim depends on sound drivers and sound themes from freedesktop.org Having no intention of trusting Microsoft store again, I create my own WSL distro in 3 simple setups: Get the latest minirootfs for your architecture from Alpine Downloads Page.