libgpiod icon indicating copy to clipboard operation
libgpiod copied to clipboard

Can't build python bindings with buildroot

Open jeanphi-francois opened this issue 1 year ago • 1 comments

There is a libgpiod2 package in buildroot, with the option --disable-bindings-python set. I modified it to pass the --enable-bindings-python, but it doesn't work. At the setup.py stage, the host compiler is used.

Here is the output :

GPIOD_WITH_TESTS= \
/home/jp/buildfarm/isp-cm4s-new/host/bin/python3 setup.py build_ext --inplace \                                                                                                        
        --include-dirs=../../include/:../../tests/gpiosim/ \                                                                                                                           
        --library-dirs=../../lib/.libs/:../../tests/gpiosim/.libs/                                                                                                                     
running build_ext                                                                                                                                                                      
building 'gpiod._ext' extension                                                                                                                                                        
/home/jp/buildfarm/isp-cm4s-new/host/bin/ccache /usr/bin/gcc -pthread -Wsign-compare -DNDEBUG -g -O3 -Wall -O2 -I/home/jp/buildfarm/isp-cm4s-new/host/include -fPIC -D_GNU_SOURCE=1 -I.
./../include/ -I../../tests/gpiosim/ -I/home/jp/buildfarm/isp-cm4s-new/host/include/python3.11 -c gpiod/ext/chip.c -o build/temp.linux-x86_64-cpython-311/gpiod/ext/chip.o -Wall -Wextr
a  

Has you can see, setup.py is not using the cross CC. I tried to mess with Makefile.am like this

	echo $(CC)  
	GPIOD_WITH_TESTS=$(BUILD_TESTS) \
	$(PYTHON) setup.py build_ext --inplace \
		--include-dirs=$(top_srcdir)/include/:$(top_srcdir)/tests/gpiosim/ \
		--library-dirs=$(top_builddir)/lib/.libs/:$(top_srcdir)/tests/gpiosim/.libs/

I added the echo $(CC) line, and the output is

make[7]: Nothing to be done for 'all-am'.                                                                                                                                     [30/4607]
echo /home/jp/buildfarm/isp-cm4s-new/host/bin/arm-none-linux-gnueabihf-gcc                                                                                                             
/home/jp/buildfarm/isp-cm4s-new/host/bin/arm-none-linux-gnueabihf-gcc                                                                                                                  
GPIOD_WITH_TESTS= \                                                                                                                                                                    
/home/jp/buildfarm/isp-cm4s-new/host/bin/python3 setup.py build_ext --inplace \                                                                                                        
        --include-dirs=../../include/:../../tests/gpiosim/ \                                                                                                                           
        --library-dirs=../../lib/.libs/:../../tests/gpiosim/.libs/                                                                                                                     
running build_ext                                                                                                                                                                      
building 'gpiod._ext' extension                                                                                                                                                        
/home/jp/buildfarm/isp-cm4s-new/host/bin/ccache /usr/bin/gcc -pthread -Wsign-compare -DNDEBUG -g -O3 -Wall -O2 -I/home/jp/buildfarm/isp-cm4s-new/host/include -fPIC -D_GNU_SOURCE=1 -I.
./../include/ -I../../tests/gpiosim/ -I/home/jp/buildfarm/isp-cm4s-new/host/include/python3.11 -c gpiod/ext/chip.c -o build/temp.linux-x86_64-cpython-311/gpiod/ext/chip.o -Wall -Wextr
a

Why is setup.py no using the CC variables ?

jeanphi-francois avatar Jul 25 '24 13:07 jeanphi-francois

I don't support the buildroot recipe but for Python: using Makefile is just a development tool. The actual recipe should fetch sources from pypi. Please look at what meta-openembedded does.

brgl avatar Jul 29 '24 08:07 brgl