Tiny Core Extensions > Extension requests
Adjustment to python packages
(1/1)
polikuo:
Hi, all.
It bugs me whenever the compile flag -O3 pop-up out of no where.
It turns out python is responsible. (main package)
--- Code: ---$ py1=/usr/local/lib/python3.11/config-3.11-arm-linux-gnueabihf/Makefile
$ py2=/usr/local/lib/python3.11/_sysconfigdata__linux_arm-linux-gnueabihf.py
$ grep O3 $py1
OPT= -DNDEBUG -g -fwrapv -O3 -Wall
$ grep O3 $py2
'CFLAGS': '-Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -pipe '
'LIBEXPAT_CFLAGS': '-I./Modules/expat -Wsign-compare -DNDEBUG -g -fwrapv -O3 '
'-Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -pipe '
'OPT': '-DNDEBUG -g -fwrapv -O3 -Wall',
'PY_BUILTIN_MODULE_CFLAGS': '-Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os '
'PY_CFLAGS': '-Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -pipe '
'PY_CORE_CFLAGS': '-Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -pipe '
'PY_STDMODULE_CFLAGS': '-Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os '
--- End code ---
The easy fix is sed one-liner
--- Code: ---sed -i 's/-g -fwrapv -O3/-fwrapv/g' squashfs-root/$py1 squashfs-root/$py2
--- End code ---
Could someone spares a couple of minutes to address that on all port ?
Many thanks :)
Juanito:
The correct piCore flags should be inserted, no?
Building python like this http://tinycorelinux.net/14.x/x86/tcz/src/python3.9/compile_python3.9 seems to build python with the correct ones already present.
polikuo:
Hi, Juanito.
It's a different matter.
It appears that I didn't explain quite clearly in my previous post, let me try again.
They are hard-coded configuration which won't be touched unless you edit it manually.
What we're having here:
1. Download python source code (data files contain -O3)
2. configure, make --> /usr/local/bin/python built with -Os
3. make install --> ( config-3.11-arm-linux-gnueabihf/Makefile, _sysconfigdata__linux_arm-linux-gnueabihf.py ) got installed
4. Whenever you compile a new package (python setup.py, pip install, ...etc)
python would first append (-Os) from environment variables, then override it with (-O3) from the hard-coded data files mentioned above.
P.S.
Node.js does this as well.
You can checkout what I've done here
http://tinycorelinux.net/13.x/armv7/tcz/src/node/
Specifically, the Favor4Size.patch
Juanito:
That was the point I was making, see, for example:
/usr/local/lib/python3.9/config-3.9-x86_64-linux-gnu/Makefile
/usr/local/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py
polikuo:
I see, things may vary with different platform, version ... etc.
This is what we have with armhf
--- Code: ---tc@pi4-1:~$ (. /etc/init.d/tc-functions; getBuild)
armhf
tc@pi4-1:~$ tce-load -i python3.11
python3.11 is already installed!
tc@pi4-1:~$ grep "'OPT'" /tmp/tcloop/python3.11/usr/local/lib/python3.11/_sysconfigdata__linux_arm-linux-gnueabihf.py
'OPT': '-DNDEBUG -g -fwrapv -O3 -Wall',
tc@pi4-1:~$ grep '^OPT=' /tmp/tcloop/python3.11/usr/local/lib/python3.11/config-3.11-arm-linux-gnueabihf/Makefile
OPT= -DNDEBUG -g -fwrapv -O3 -Wall
--- End code ---
When I was building distcc.tcz, [-O3] kept popping up.
I had to "sed" those files to set things right.
Navigation
[0] Message Index
Go to full version