Re: Python compiled by tcc

2017-05-21 Thread Christian Gollwitzer

Am 21.05.17 um 12:38 schrieb bartc:

On 21/05/2017 10:32, Christian Gollwitzer wrote:

Am 18.05.17 um 10:10 schrieb Christian Gollwitzer:

The whole discussion reminds me of the "bumblebees can't fly" thing.
tcc is a very small compiler (some 100kb) which supports most of C99.


For what it's worth, I compiled Python 3.6.1 on Linux/x86 using tcc. It
was a simple matter of cloning tcc, compiling/installing it and the doing

CC=tcc ./configure
make


BTW, how long did an incremental change take to build? I've measured 5 
seconds before with gcc. Tcc might be slower in its generated code, but 
if you just want to quickly see the result of a modification, that the 
result might run at half the speed is irrelevant.


If I do

touch Python/Python-ast.c
time make python

it says

real0m0.564s
user0m0.394s
sys 0m0.149s


BTW the Xlinker option is a good example to see why autoconf is needed. 
They were lazy and had a simple switch on `uname` to find the option, 
instead of testing it with the compile-macros of autoconf.


(Not such good news for me, as now I feel obliged to make my own C 
compiler manage it. And it sort of competes with tcc for compilation 
speed (and size too but that wasn't intentional). However it lacks some 
C99 features at the minute.)


haha :) Good luck with that. Remember, tcc supports x86, x86_64, MIPS, 
ARM, ARM64, and C67, so it is a serious beast.


Christian
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python compiled by tcc

2017-05-21 Thread bartc

On 21/05/2017 10:32, Christian Gollwitzer wrote:

Am 18.05.17 um 10:10 schrieb Christian Gollwitzer:

The whole discussion reminds me of the "bumblebees can't fly" thing.
tcc is a very small compiler (some 100kb) which supports most of C99.


For what it's worth, I compiled Python 3.6.1 on Linux/x86 using tcc. It
was a simple matter of cloning tcc, compiling/installing it and the doing

CC=tcc ./configure
make

in the Python source folder. It only failed at the final linker step,
because the tcc linker does not understand the flags -Xlinker
-export-dynamic.

The compilation was extremely fast, it took 5s of wall clock time and 3s
of user time to go from the sources to the python executable.


That's good news, the fact that such a small compiler can go a good way 
towards compiling quite an elaborate project, with only some 
technicalities getting in the way. (And it makes you wonder what on 
earth those other tools are up to.)


BTW, how long did an incremental change take to build? I've measured 5 
seconds before with gcc. Tcc might be slower in its generated code, but 
if you just want to quickly see the result of a modification, that the 
result might run at half the speed is irrelevant.


(Not such good news for me, as now I feel obliged to make my own C 
compiler manage it. And it sort of competes with tcc for compilation 
speed (and size too but that wasn't intentional). However it lacks some 
C99 features at the minute.)


--
bartc
--
https://mail.python.org/mailman/listinfo/python-list


Python compiled by tcc

2017-05-21 Thread Christian Gollwitzer

Am 18.05.17 um 10:10 schrieb Christian Gollwitzer:
The whole discussion reminds me of the "bumblebees can't fly" thing. 

tcc is a very small compiler (some 100kb) which supports most of C99. 


For what it's worth, I compiled Python 3.6.1 on Linux/x86 using tcc. It 
was a simple matter of cloning tcc, compiling/installing it and the doing


CC=tcc ./configure
make

in the Python source folder. It only failed at the final linker step, 
because the tcc linker does not understand the flags -Xlinker 
-export-dynamic.


The compilation was extremely fast, it took 5s of wall clock time and 3s 
of user time to go from the sources to the python executable.


The ./python executable generated this way does work as far as I can 
tell, however "make test" fails with an import error - module "socket" 
is not available. Additionally, after linking "python", the compilation 
went on and required a C++ compiler, which was no problem in itself, but 
of course fell back to g++  - tcc only supports pure C.


So IMHO it should be a breeze to compile a pure C Python extension into 
something which successfully runs with the gcc compiled python.


On OSX, it was not successfull, because tcc cannot yet create executable 
binaries on disk in Mach-O format, however, ibraries are possible and 
runtime-linking (JIT) works without problems.


I guess that compiling the full thing on Windows could work with CC=tcc, 
if the GNU utils arae available (Cygwin/MSYS/Linux subsystem)


Christian

--
https://mail.python.org/mailman/listinfo/python-list