eutim / OPI.GPIO

A python GPIO library for Orange Pi Zero2, OrangePi Zero 2, Orange Pi3, and Orange Pi Lite2.
MIT License
57 stars 20 forks source link

doesn't build on armbian debian 11 bullseye #3

Open holla2040 opened 2 years ago

holla2040 commented 2 years ago

debian 11 bullseye Python 3.9.2

sudo python3 setup.py install

linker throws about 50 multiple definition errors

/usr/bin/ld: build/temp.linux-aarch64-3.9/source/py_gpio.o:/home/holla/OPI.GPIO/source/constants.h:30: multiple definition of `pud_off'; build/temp.linux-aarch64-3.9/source/constants.o:/home/holla/OPI.GPIO/source/constants.h:30: first defined here

KingValmond commented 2 years ago

To fix it

1) mark all declared variables in .h files as 'external' (just add 'external ' (without quotes) before any variable declaration in the .h files when you had an error)

2) declare all the PyObject pointers in the constants.c file (also declare them external in the .h)

3) In soft_pwm.c declare the pthreads_t threads : static pthreads_t threads;

and that did it for me.

Cheers & HTH

holla2040 commented 2 years ago

Thanks!