# How to get RV32 cross compiler + newlib-nano to work?

**URL:** https://discourse.nixos.org/t/how-to-get-rv32-cross-compiler-newlib-nano-to-work/80242
**Category:** Help
**Created:** [September 23, 2026, 2:55pm UTC](https://discourse.nixos.org/t/how-to-get-rv32-cross-compiler-newlib-nano-to-work/80242 "2026-09-23T14:55:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Stu](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@Stu](https://discourse.nixos.org/u/Stu)
#### Post date: [September 23, 2026, 2:55pm UTC](https://discourse.nixos.org/t/how-to-get-rv32-cross-compiler-newlib-nano-to-work/80242/1 "2026-09-23T14:55:03Z")

</div>

I’ll preface this by saying I’m a complete nix beginner.

One friend told me about Nix and NixOS and I really liked the idea so I decided to install it on a live USB and really enjoyed it, prompting me to boot it up permanently and daily drive it for the past ~2 weeks to see what it’s all about, I tried to dive deep in with flakes and home manager to configure different development environments (one for EDA with Quartus, Questa, Verilator, etc, one for normal work in C, C++ and python, one for RISCV64 cross compiling (this one is working so far!)) but I can’t get another one of them to work.

What I was trying to do specifically is: set up a devShell to cross-compile C for 32-bit RISC-V targeting rv32im with the soft-float ABI (ilp32). When linking my code (which uses newlib functions like printf and malloc), the build fails with an ABI mismatch error (can’t link double-float modules with soft-float modules) because the runtime libraries (libgcc.a and libc.a) supplied by pkgsCross.riscv32embedded are pre-compiled for hard-float (ilp32d). Overriding crossSystem in nixpkgs with arch = “rv32im” and abi = “ilp32” resolves the ABI conflict conceptually, but triggers a lengthy local source build of the entire GCC + Newlib toolchain that apparently freezes (?). Is there an existing pre-built or multilib bare-metal RISC-V toolchain package in nixpkgs for ilp32 soft-float, or a standard way to avoid rebuilding GCC from source for this target?

The cross compiler I’m trying to replicate and used on Debian can be found [here](https://github.com/gaph-pucrs/Memphis-V/blob/4ab07ec9dc9878b822bf9f528c34a12942fcad8d/docs/riscv.md).

The options so far seem to be:

1. Create a Debian distrobox container with podman or a Debian VM

2. Abandon NixOS, switch to Debian, Arch, somewhere this compiler is available but install Nix there to keep learning and playing with Nix.

---

<div class="post-metadata">

### Author: ![Stu](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@Stu](https://discourse.nixos.org/u/Stu)
#### Post date: [September 23, 2026, 3:06pm UTC](https://discourse.nixos.org/t/how-to-get-rv32-cross-compiler-newlib-nano-to-work/80242/2 "2026-09-23T15:06:07Z")

</div>

BTW: I also tried to use a buildFHS to copy exactly what they are doing in Memphis-V but it got overcomplicated too fast.
