Python compiled by tcc

bartc bc at freeuk.com
Sun May 21 06:38:46 EDT 2017


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



More information about the Python-list mailing list