# Guix container with glibc 32-bit library

**URL:** <https://forum.systemcrafters.net/t/guix-container-with-glibc-32-bit-library/1276>\
**Category:** Guix\
**Created:** [January 6, 2025, 11:48am UTC](https://forum.systemcrafters.net/t/guix-container-with-glibc-32-bit-library/1276 "2025-01-06T11:48:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaume](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/jaume/32/544_2.png) [@jaume](https://forum.systemcrafters.net/u/jaume)\
**Post date:** [January 6, 2025, 11:48am UTC](https://forum.systemcrafters.net/t/guix-container-with-glibc-32-bit-library/1276/1 "2025-01-06T11:48:02Z")

</div>

Hi there, seeking for help for Guix on this self-made problem:

I want to work on a hobby IoT project with [adafruit’s feather v2](https://learn.adafruit.com/adafruit-esp32-feather-v2/overview) using [platform.io](https://platformio.org/) that sets up a project for an [espressif’s](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/index.html) chip. The amount of dependencies needed are so ad-hoc that I prefer to have a `manifest.scm` to define the dependencies and use guix shell (with `--container`, because I need the `-F` option too) instead of polluting my whole guix home.

The problem comes when I run `pio run` to compile the project. After `platformio` downloads all the dependencies starts compiling, I see this error:

```auto
/gnu/store/hj3mgm7z8xsa1gkd3lmyv3vd78z4hrqa-profile/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: No such file or directory
    7 | # include <gnu/stubs-32.h>

```

My understanding after troubleshooting the problem is that `gnu/stubs-32.h` belongs only to the 32-bit (i686)'s `glibc` package and that is not included on the `x68_86` one. I’ve tried also to run `guix shell ... --system=i686-linux` forcing the whole container to be 32-bit based. But unfortunately I cannot do that because some of the dependencies in the container depend on Rust, which is not available as a package in the `i686` architecture.

My current struggle is try to create a manifest for the usual `x86_64-linux` architecture but forcing the `glibc` package to be the `i686` one. I am not sure if that is possible… This is the current status of my manifest file.

```auto
(use-modules (guix packages)
             (gnu packages base))

(define glibc-i686
  (package
   (inherit glibc)
   (<... something here to force architecture input... >)))
                          
(specifications->manifest
 (list "..."
       "glibc-i686"
       "..."))

```

So my questions are:

- It is what I am trying to achieve possible?
- If so, what are the right statements on the package inheritance to do that?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ashraz](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ashraz/32/509_2.png) [@ashraz](https://forum.systemcrafters.net/u/ashraz)\
**Post date:** [January 6, 2025, 4:02pm UTC](https://forum.systemcrafters.net/t/guix-container-with-glibc-32-bit-library/1276/2 "2025-01-06T16:02:41Z")

</div>

> My understanding after troubleshooting the problem is that `gnu/stubs-32.h` belongs only to the 32-bit (i686)'s `glibc` package and that is not included on the `x68_86` one.

**Disclaimer:** I don’t know PlatformIO. I don’t know `pio`. I don’t know Guix. Now that my credibility is out of the window, let’s see why it might be even worse.

You’re compiling for an espressif. While espressif is indeed a 32 bit platform, it is not a x86 architecture. Depending on PlatformIO’s installer, the correct version of GCC would probably have been downloaded by the installer for your convenience (I guess that’s one of the main selling points of PIO).

This brings us to the question: which compiler generates that message? And what was the target? If the compiler is your “usual” GCC for your x86\_64 machine, but your compilation target is an espressif, then there is at least a target-mismatch. There might be also a broken PlatformIO configuration on your system at the moment.

I myself would tackle this issue like this:

1. Install PlatformIO on a Debian machine (VM)
2. Check the output of `pio run` (verbose mode) on the Debian machine and compare it with the output on Guix
3. Ensure that the used compilers are the same and that the generated PIO configuration is the same.

Given that you have a `manifest.scm` at hand, you might want to share it so that others (who actually use Guix) can chime in.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![jaume](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/jaume/32/544_2.png) [@jaume](https://forum.systemcrafters.net/u/jaume)\
**Post date:** [January 6, 2025, 5:45pm UTC](https://forum.systemcrafters.net/t/guix-container-with-glibc-32-bit-library/1276/3 "2025-01-06T17:45:37Z")

</div>

Hi @ashraz ! Thanks for you quick response!

The contents of the `manifest.scm` right now are quite straightforward:

```auto
(use-modules (guix packages)
             (gnu packages base))

(specifications->manifest
 (list "clang-toolchain"
       "coreutils"
       "file"
       "gcc-toolchain"
       "git"
       "glibc"
       "nss-certs"
       "python"
       "python-pip"))

```

Once inside the guix container I run `pip install platformio` to have the `pio` utility available.

To discard the gcc misconfiguration I used the docker [python](https://hub.docker.com/_/python/) image to run `pio run -v` and compared with the guix container one as you suggested. Both use the `xtensa-esp32-elf-gcc` as expected. The `python` one finished successfully, since I guess Ubuntu’s `glibc` package includes 32-bit headers… which brings me back to the fight of being able to have glibc with 32-bit headers available on the guix container… unless someone has a better idea.

---

<div class="post-metadata">

**Author:** ![dan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@dan](https://forum.systemcrafters.net/u/dan)\
**Post date:** [April 8, 2025, 9:53am UTC](https://forum.systemcrafters.net/t/guix-container-with-glibc-32-bit-library/1276/4 "2025-04-08T09:53:08Z")

</div>

Hey @jaume

I had the same error, my host system is x86\_64 and I’m building for a 32-bit ARM embedded system.  
To overcome this I used `(make-arm-none-eabi-toolchain-12.3.rel1)` as one of the manifest packages like. It includes 32-bit ARM GCC as well as newlib (not glibc):

```scheme
(use-modules
  (gnu packages embedded) ; make-arm-none-eabi-toolchain-12.3.rel1
  (gnu packages firmware) ; qmk
)

(packages->manifest (list
  qmk
  (make-arm-none-eabi-toolchain-12.3.rel1)
))

```

I understand you might not necessarily need the ARM toolchain but `gnu/packages/embedded.scm` has some other options.

---

<div class="post-metadata">

**Author:** ![jaume](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/jaume/32/544_2.png) [@jaume](https://forum.systemcrafters.net/u/jaume)\
**Post date:** [June 11, 2025, 8:01pm UTC](https://forum.systemcrafters.net/t/guix-container-with-glibc-32-bit-library/1276/5 "2025-06-11T20:01:50Z")

</div>

Thanks for the answer @dan . I’ll give it a try.  
(and sorry for the late response)

---

<div class="post-metadata">

**Author:** ![trev](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/trev/32/81_2.png) [@trev](https://forum.systemcrafters.net/u/trev)\
**Post date:** [October 19, 2025, 8:08pm UTC](https://forum.systemcrafters.net/t/guix-container-with-glibc-32-bit-library/1276/7 "2025-10-19T20:08:24Z")

</div>

Just realized you are trying to do ESP32 stuff too.

The trick for me was unsetting the env vars set by `/etc/profile` upon entering the container and starting `bash`.

`start-shell.sh`:

```bash
#!/usr/bin/env bash

# guix /etc/profile sources these but we don't want them
# cause it interferes with esp-idf tooling
unset_env="unset CFLAGS CXXFLAGS C_INCLUDE_PATH CPLUS_INCLUDE_PATH LDFLAGS"

guix shell -m manifest.scm \
     --container \
     --pure \
     --emulate-fhs \
     --network \
     --share="$HOME/.espressif" \
     --share="$HOME/your-project" \ # any more that you need
     -- bash -i -c "$unset_env; exec bash"

```

```scheme
(specifications->manifest
 (list
  ;; Build tools
  "make" "automake" "autoconf" "cmake" "libtool" "ninja" "ccache"
  ;; Toolchains
  "gcc-toolchain"
  ;; Libraries
  "eudev"
  "libelf"
  "libffi"
  "libusb"
  "zlib"
  ;; Python
  "python"
  "python-pip"
  "python-virtualenv"
  ;; Utils
  "bash"
  "coreutils"
  "dfu-util"
  "gawk"
  "git"
  "grep"
  "less"
  "nss-certs"
  "pkg-config"
  "sed"
  "wget"
  "which"
  ))

```
