Hello,
I have been trying to get the spidev module installed on my Pi Zero W running PiCore 14. I need it for a project I'm currently working on.
Unfortunately, the module contains c code, which means that pip needs to build that c code when installing the module, and it is failing while trying to build it.
Here's a dump of how the install/compile attempt looks:
tc@binclck:~$ pip install spidev
Defaulting to user installation because normal site-packages is not writeable
Collecting spidev
Using cached spidev-3.6.tar.gz (11 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: spidev
Building wheel for spidev (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for spidev (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
/tmp/pip-build-env-2cixurlr/overlay/lib/python3.11/site-packages/setuptools/dist.py:452: SetuptoolsDeprecationWarning: Invalid dash-separated options
!!
********************************************************************************
Usage of dash-separated 'description-file' will not be supported in future
versions. Please use the underscore name 'description_file' instead.
By 2024-Sep-26, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
********************************************************************************
!!
opt = self.warn_dash_deprecation(opt, section)
running bdist_wheel
running build
running build_ext
building 'spidev' extension
creating build
creating build/temp.linux-armv6l-cpython-311
gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -pipe -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I/usr/local/include/ncursesw -Os -pipe -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I/usr/local/include/ncursesw -fPIC -I/usr/local/include/python3.11 -c spidev_module.c -o build/temp.linux-armv6l-cpython-311/spidev_module.o
In file included from spidev_module.c:28:
/usr/local/include/python3.11/Python.h:23:12: fatal error: stdlib.h: No such file or directory
23 | # include <stdlib.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/local/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for spidev
Failed to build spidev
ERROR: Could not build wheels for spidev, which is required to install pyproject.toml-based projects
As you can see from the output, it is having trouble finding stdlib.h, which I know is part of the normal gcc install. I think I have all of the appropriate tcz's loaded, here's the list:
tc@binclck:~$ tce-status -i
binutils
bzip2
bzip2-dev
bzip2-lib
ca-certificates
file
firmware-rpi-wifi
flex
gcc
gdbm
gdbm-dev
gmp
isl
liblz4
liblzma
liblzma-dev
libnl
libzstd
mpc
mpfr
nano
ncurses
ncurses-dev
ncurses-terminfo
openssh
openssl
openssl-dev
python3.11
python3.11-dev
python3.11-pip
readline
readline-dev
regdb
sqlite3
sqlite3-dev
unzip
wifi
wireless-6.1.68-piCore
wireless_tools
wpa_supplicant
zstd
And with this set of tcz's loaded, stdlib.h appears to be present on the file system:
tc@binclck:~$ cd /
tc@binclck:/$ sudo find -name "stdlib*"
./usr/local/include/c++/12.2.0/tr1/stdlib.h
./usr/local/include/c++/12.2.0/stdlib.h
./tmp/tcloop/gcc/usr/local/include/c++/12.2.0/stdlib.h
./tmp/tcloop/gcc/usr/local/include/c++/12.2.0/tr1/stdlib.h
I'm not sure why gcc can't seem to find it. What am I missing here?