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 using platform.io that sets up a project for an espressif’s 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:
/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.
(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?
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:
Install PlatformIO on a Debian machine (VM)
Check the output of pio run (verbose mode) on the Debian machine and compare it with the output on Guix
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.
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 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.