Problems compiling TCC on OS X

Aaron Gough picture Aaron Gough · Sep 14, 2010 · Viewed 7.7k times · Source

Has anyone successfully compiled TCC on OS X?

From what I know it should be possible but when I run make I get the following error:

$ make
gcc -o tcc tcc.c -DTCC_TARGET_I386 -O2 -g -Wall -fno-strict-aliasing -mpreferred-stack-                boundary=2 -march=i386 -falign-functions=0 -Wno-pointer-sign -Wno-sign-compare -D_FORTIFY_SOURCE=0 -lm -ldl
tcc.c:1: error: CPU you selected does not support x86-64 instruction set
tcc.c:1: error: CPU you selected does not support x86-64 instruction set
tcc.c:1: error: -mpreferred-stack-boundary=2 is not between 4 and 12
make: *** [tcc] Error 1

./configure runs fine and gives the following output:

$ ./configure 
Binary  directory   /usr/local/bin
TinyCC directory    /usr/local/lib/tcc
Library directory   /usr/local/lib
Include directory   /usr/local/include
Manual directory    /usr/local/man
Doc directory       /usr/local/share/doc/tcc
Target root prefix  
Source path      /Users/aaron/Downloads/tcc-0.9.25
C compiler       gcc
CPU              x86
Big Endian       no
gprof enabled    no
cross compilers  no
use libgcc       no
Creating config.mak and config.h

I'm pretty sure the issue is something simple, but I haven't compiled enough programs on OS X to be aware of the pratfalls...

The primary purpose for installing TCC was to get libtcc so I could start experimenting with dynamic code generation from Ruby (in case that makes a difference :-p)

Thanks!

Answer

mikijov picture mikijov · Mar 6, 2012

I have just spent some serious time trying to make tcc run on osx. I have included several fixes, including the one from the answer above, and now they are all in the development repository at http://repo.or.cz/w/tinycc.git. Building, some tests and all examples should work.

I am not sure if you are aware, but http://bellard.org/tcc/ site that belongs to Fabrice Bellard who started this project, is not being updated very regularly. Mostly because there are not many 'official' tcc releases. tcc is one of those projects that mostly lives off of live sources and updates. So if you want to give this another try, please go to http://repo.or.cz/w/tinycc.git and get the 'mob' branch (not 'master'). Please see http://repo.or.cz/w/tinycc.git for details, and do join the mailing list to get involved.