Tiny Core Linux
Tiny Core Extensions => TCE Talk => Topic started by: MarkF on April 03, 2019, 08:51:53 AM
-
I have been trying to create a Python extension on a rPI Z W (piCore 9.0.3) for 2 days. Every time I try to build I get an error about a missing header file (limits.h). Here are the outputs from building a C module and a Cython (.pyx) module -
tc@box:~/scripts$ python setup_cython.py build_ext --inplace
running build_ext
building 'Adafruit_SSD1306_Packer' extension
gcc -pthread -fno-strict-aliasing -O3 -pipe -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c Adafruit_SSD1306_Packer.c -o build/temp.linux-armv6l-2.7/Adafruit_SSD1306_Packer.o
gcc: error trying to exec 'as': execvp: No such file or directory
In file included from /tmp/tcloop/gcc/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/7.1.0/include-fixed/limits.h:194:0,
from /tmp/tcloop/gcc/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/7.1.0/include-fixed/syslimits.h:7,
from /tmp/tcloop/gcc/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/7.1.0/include-fixed/limits.h:34,
from /usr/local/include/python2.7/Python.h:19,
from Adafruit_SSD1306_Packer.c:24:
/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/7.1.0/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory
#include_next <limits.h> /* recurse down to the real one */
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
tc@box:~/scripts$ python setup_c.py build
running build
running build_ext
building 'packer' extension
gcc -pthread -fno-strict-aliasing -O3 -pipe -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c packer.c -o build/temp.linux-armv6l-2.7/packer.o
gcc: error trying to exec 'as': execvp: No such file or directory
In file included from /tmp/tcloop/gcc/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/7.1.0/include-fixed/limits.h:194:0,
from /tmp/tcloop/gcc/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/7.1.0/include-fixed/syslimits.h:7,
from /tmp/tcloop/gcc/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/7.1.0/include-fixed/limits.h:34,
from /usr/local/include/python2.7/Python.h:19,
from packer.c:3:
/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/7.1.0/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory
#include_next <limits.h> /* recurse down to the real one */
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
tc@box:~/scripts$
By the way, line 19 of /usr/local/include/python2.7/Python.h is -
#include <limits.h>
As you can see, the error outputs are exactly the same. The limits.h file fails in some sort of recursion.
I loaded python, python-dev, gcc, cython, linux-4.9.y_api_headers and some other TCZs. I thought python-dev would take care of any other dependencies that it has?
Any suggestions? Is the order of loading TCZs important? I'm new to piCore as a development environment so I hope this isn't an obvious or well known error. :-[ My searching didn't find it.
-
Did you load compiletc?
-
Hi MarkF
You need compiletc.tcz for a proper toolchain.
-
Thanks Juanito and Rich! I haven't loaded compiletc, but I will and will reply again.
Is there some documentation about this that I missed? (which TCs to fill out a toolchain?)
EDIT: Success!!! Thanks, again. Both compile now.
-
Hi MarkF
... Is there some documentation about this that I missed? ...
If you look at:
http://wiki.tinycorelinux.net/wiki:creating_extensions
at the top of the page it does say:
Required:
Your source code and all dependencies
compiletc extension
squash file tools extension
... (which TCs to fill out a toolchain?) ...
That's the purpose of compiletc.tcz , so you don't have to figure out which extensions are required for a toolchain. It's a meta
extension that consists of dependencies:
http://tinycorelinux.net/9.x/x86/tcz/compiletc.tcz.dep
or if you wish to see the entire dependency tree:
http://tinycorelinux.net/9.x/x86/tcz/compiletc.tcz.tree
-
Thanks Rich!
-
One last post (for me) and I'll be done.
I am making the Adafruit PiOLED and OLED Bonnet work on a Pi Z W with TC 9.0.3. The original OLED support file from Adafruit is written in Python and require Pillow to support text and drawing. I won't be drawing so I made changes so it supports FreeType for text. After getting things to work, I did a speed test using pure Python and found I got ~11 frames per sec (fps) for a full screen update rate. When I moved some of the "most executed" code into cython, I got ~20 fps. By moving the critical code to a C-Module, I now get 118 fps. Doing byte/bit/buffer manipulation (fill, bitblt, pack, unpack, etc.) in Python is slow. Thanks to your help, I increased the fps rate by an order of magnitude.
My projects and I thank you.