Op 02-10-2025 om 08:41 schreef Hubert Kauker:
I am trying to find out whether tcc is a good alternative to cc and gcc on a Mac.

It will be fine for me to have all of ANSI C (C89/C90), much of the C99 ISO standard, and many GNU C extensions including inline assembly. So I cloned from repo.or.cz/tinycc.git <http://repo.or.cz/tinycc.git> and followed the instructions.

I was able able to build the following version:
tcc version 0.9.28rc 2025-09-21 mob@ba0899d9 (x86_64 Darwin)

Fine. But “make test” obviously ran into 2 issues. Here is the output:

    /Library/Developer/CommandLineTools/usr/bin/codesign_allocate:
    fatal error: file not in an order that can be processed (symbol
    table out of place): /Users/hubert/Documents/Git/C/tinycc/tests/hello
    hello: the codesign_allocate helper tool cannot be found or used
    tcc: error: command failed 'codesign -f -s - hello'
    + ../tcc -vv
    tcc version 0.9.28rc 2025-09-21 mob@ba0899d9 (x86_64 Darwin)

    install: /usr/local/lib/tcc
    include:
    /usr/local/lib/tcc/include
    /usr/local/include
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include
    libraries:
    /usr/local/lib/tcc
      /usr/lib
      /lib
    /usr/local/lib
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
    libtcc1:
    /usr/local/lib/tcc/libtcc1.a
    + otool -L ../tcc
    ../tcc:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
    version 1281.100.1)
    + exit 1
    make[2]: *** [hello-exe] Error 1
    make[1]: *** [all] Error 2
    make: *** [test] Error 2

The first message seems to say that my codesign_allocate tool is not suitable. Both codesign and codesign_allocate are in /usr/bin and can be found.

QUESTION 1:

    What is wrong and what can I do about it?


However, changing into the examples folder, I can use “tcc -run” on ex1.c to get “Hello world”. Fine. But omitting “-run” produces the same error about codesign_allocate as above.

After searching for OSX in the changelog, I found the following remark about version 0.9.26:
/Support OSX (tcc -run only) (Milutin Jovanovic)/
Strange. What does it mean?

QUESTION 2:

    Does it mean that tcc does not fully support OSX - it’s
    experimental? TCC cannot produce native OSX executables?

    Is this state of affairs still officially present in the current
    0.9.28rc?


Then I noticed that tcc is also available via Homebrew. Now, “brew install tcc” tells me:

    *Fetching downloads for: **tcc*
    Warning:tcc has been deprecated because it is not supported
    upstream! It will be disabled on 2026-09-16.
    ==>*Downloading
    https://ghcr.io/v2/homebrew/core/tcc/manifests/0.9.27_1*
    …
    ==>*Fetching **tcc*
    ==>*Downloading
    https://ghcr.io/v2/homebrew/core/tcc/blobs/sha256:68930891a8746b*
    *…*
    ==>*Pouring tcc--0.9.27_1.catalina.bottle.tar.gz*
    🍺  /usr/local/Cellar/tcc/0.9.27_1: 20 files, 723.7KB
    ==>*Running `brew cleanup tcc`**…*
    *…*
    ==>*No outdated dependents to upgrade!*
    *
    *

QUESTION 3:

    What is that about being deprecated, not being supported upstream
    and being disabled from 2026-09-16? Is that serious?


After that I have:*
*
tcc version 0.9.27 (x86_64 Darwin)

Fine. Now back to examples and “tcc -run ex1.c” producing “Hello world”. Fine.
But “tcc ex1.c” this time produces:

    tcc: error: file 'crt1.o' not found
    tcc: error: file 'crti.o' not found
    /usr/lib/libc.dylib: error: bad architecture
    tcc: error: library 'c' not found
    tcc: error: file 'crtn.o' not found
    tcc: error: undefined symbol ‘printf'

So it seems, I didn’t make much progress.

QUESTION 4:

    How should I go on from here?

From the output of otool you probably run on a apple 10 system (google search).
You can check this by sw_vers command.
Perhaps you can try playing with configure options:
--config-new_macho=no|yes
--config-codesign=no
tcc does support osx and has been tested on osx >= 10.

There is a small incompatibility. The object files (.o) files are in elf format.
The final executable or shared library are in osx format.

    Herman

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to