pimoroni / fanshim-python

Python library for the Fan SHIM for Raspberry Pi
https://shop.pimoroni.com/products/fan-shim
MIT License
295 stars 86 forks source link

install.sh fails on ubuntu server 21.04 #100

Closed clancia closed 3 years ago

clancia commented 3 years ago

Hi there

I tried to install fanshim on my RPi4 running ubuntu server 21.04 (64-bit) This OS is not shipped with python 2.x I had troubles with the install script, which would not manage to install rpi.gpio So I installed it manually via

$ export CFLAGS=-fcommon
$ pip3 install RPi.GPIO

Then I could import the package in the interpreter but still the install.sh script would try to install rpi.gpio anyway and the installation would not be successful (see below)

Then I let apt install rpi.gpio via sudo apt install python3-rpi.gpio and voilá, it works.

clancia commented 3 years ago

Checking for rpi.gpio >= 0.7.0 (for Pi 4 support)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'RPi'
Installing rpi.gpio
Collecting rpi.gpio>=0.7.0
  Using cached RPi.GPIO-0.7.0.tar.gz (30 kB)
Building wheels for collected packages: rpi.gpio
  Building wheel for rpi.gpio (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-xcil89aa
       cwd: /tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/
  Complete output (102 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-aarch64-3.9
  creating build/lib.linux-aarch64-3.9/RPi
  copying RPi/__init__.py -> build/lib.linux-aarch64-3.9/RPi
  creating build/lib.linux-aarch64-3.9/RPi/GPIO
  copying RPi/GPIO/__init__.py -> build/lib.linux-aarch64-3.9/RPi/GPIO
  running build_ext
  building 'RPi._GPIO' extension
  creating build/temp.linux-aarch64-3.9
  creating build/temp.linux-aarch64-3.9/source
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/c_gpio.c -o build/temp.linux-aarch64-3.9/source/c_gpio.o
  source/c_gpio.c: In function ‘setup’:
  source/c_gpio.c:130:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    130 |     if ((uint32_t)gpio_mem % PAGE_SIZE)
        |         ^
  source/c_gpio.c:131:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    131 |         gpio_mem += PAGE_SIZE - ((uint32_t)gpio_mem % PAGE_SIZE);
        |                                  ^
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/common.c -o build/temp.linux-aarch64-3.9/source/common.o
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/constants.c -o build/temp.linux-aarch64-3.9/source/constants.o
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/cpuinfo.c -o build/temp.linux-aarch64-3.9/source/cpuinfo.o
  source/cpuinfo.c: In function ‘get_rpi_info’:
  source/cpuinfo.c:139:28: warning: format ‘%llx’ expects argument of type ‘long long unsigned int *’, but argument 3 has type ‘uint64_t *’ {aka ‘long unsigned int *’} [-Wformat=]
    139 |       sscanf(revision, "%llx", &rev);
        |                         ~~~^   ~~~~
        |                            |   |
        |                            |   uint64_t * {aka long unsigned int *}
        |                            long long unsigned int *
        |                         %lx
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/event_gpio.c -o build/temp.linux-aarch64-3.9/source/event_gpio.o
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/py_gpio.c -o build/temp.linux-aarch64-3.9/source/py_gpio.o
  source/py_gpio.c: In function ‘PyInit__GPIO’:
  source/py_gpio.c:1046:4: warning: ‘PyEval_ThreadsInitialized’ is deprecated [-Wdeprecated-declarations]
   1046 |    if (!PyEval_ThreadsInitialized())
        |    ^~
  In file included from /usr/include/python3.9/Python.h:145,
                   from source/py_gpio.c:23:
  /usr/include/python3.9/ceval.h:129:36: note: declared here
    129 | Py_DEPRECATED(3.9) PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
        |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~
  source/py_gpio.c:1047:7: warning: ‘PyEval_InitThreads’ is deprecated [-Wdeprecated-declarations]
   1047 |       PyEval_InitThreads();
        |       ^~~~~~~~~~~~~~~~~~
  In file included from /usr/include/python3.9/Python.h:145,
                   from source/py_gpio.c:23:
  /usr/include/python3.9/ceval.h:130:37: note: declared here
    130 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
        |                                     ^~~~~~~~~~~~~~~~~~
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/py_pwm.c -o build/temp.linux-aarch64-3.9/source/py_pwm.o
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/soft_pwm.c -o build/temp.linux-aarch64-3.9/source/soft_pwm.o
  aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-xSUlVY/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-aarch64-3.9/source/c_gpio.o build/temp.linux-aarch64-3.9/source/common.o build/temp.linux-aarch64-3.9/source/constants.o build/temp.linux-aarch64-3.9/source/cpuinfo.o build/temp.linux-aarch64-3.9/source/event_gpio.o build/temp.linux-aarch64-3.9/source/py_gpio.o build/temp.linux-aarch64-3.9/source/py_pwm.o build/temp.linux-aarch64-3.9/source/soft_pwm.o -o build/lib.linux-aarch64-3.9/RPi/_GPIO.cpython-39-aarch64-linux-gnu.so
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:41: multiple definition of `module_setup'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:41: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:40: multiple definition of `setup_error'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:40: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:39: multiple definition of `rpiinfo'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:39: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:38: multiple definition of `gpio_direction'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:38: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:37: multiple definition of `pin_to_gpio'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:37: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:36: multiple definition of `pin_to_gpio_rev3'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:36: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:35: multiple definition of `pin_to_gpio_rev2'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:35: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:34: multiple definition of `pin_to_gpio_rev1'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:34: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:33: multiple definition of `gpio_mode'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:33: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:33: multiple definition of `gpio_mode'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:33: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:40: multiple definition of `setup_error'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:40: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:39: multiple definition of `rpiinfo'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:39: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:38: multiple definition of `gpio_direction'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:38: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:41: multiple definition of `module_setup'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:41: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:37: multiple definition of `pin_to_gpio'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:37: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:36: multiple definition of `pin_to_gpio_rev3'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:36: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:34: multiple definition of `pin_to_gpio_rev1'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:34: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:35: multiple definition of `pin_to_gpio_rev2'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:35: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:42: multiple definition of `both_edge'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:42: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:41: multiple definition of `falling_edge'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:41: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:40: multiple definition of `rising_edge'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:40: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:39: multiple definition of `pud_down'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:39: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:38: multiple definition of `pud_up'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:38: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:37: multiple definition of `pud_off'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:37: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:36: multiple definition of `bcm'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:36: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:35: multiple definition of `board'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:35: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:34: multiple definition of `unknown'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:34: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:33: multiple definition of `spi'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:33: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:32: multiple definition of `i2c'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:32: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:31: multiple definition of `serial'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:31: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:30: multiple definition of `pwm'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:30: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:29: multiple definition of `output'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:29: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:28: multiple definition of `input'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:28: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:27: multiple definition of `low'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:27: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:26: multiple definition of `high'; build/temp.linux-aarch64-3.9/source/constants.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/constants.h:26: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:38: multiple definition of `gpio_direction'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:38: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/py_pwm.h:23: multiple definition of `PWMType'; build/temp.linux-aarch64-3.9/source/py_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/py_pwm.h:23: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:41: multiple definition of `module_setup'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:41: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:40: multiple definition of `setup_error'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:40: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:39: multiple definition of `rpiinfo'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:39: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:37: multiple definition of `pin_to_gpio'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:37: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:36: multiple definition of `pin_to_gpio_rev3'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:36: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:35: multiple definition of `pin_to_gpio_rev2'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:35: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:34: multiple definition of `pin_to_gpio_rev1'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:34: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:33: multiple definition of `gpio_mode'; build/temp.linux-aarch64-3.9/source/common.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/common.h:33: first defined here
  /usr/bin/ld: build/temp.linux-aarch64-3.9/source/soft_pwm.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/soft_pwm.c:28: multiple definition of `threads'; build/temp.linux-aarch64-3.9/source/event_gpio.o:/tmp/pip-install-nwmca41p/rpi-gpio_da816315d76d409a90ebcd976717f7f5/source/event_gpio.c:60: first defined here
  collect2: error: ld returned 1 exit status
  error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for rpi.gpio
  Running setup.py clean for rpi.gpio
Failed to build rpi.gpio
RobinTTY commented 3 years ago

Just encountered the same problem, thanks for sharing the solution!