bugTiny C Compiler - Bugs: bug #59640, MacOS 11 ("Big Sur"):...


bug #59640: MacOS 11 ("Big Sur"): can't link executables

Submitter:  m-ngnsav@bodyfour.uk <mitchblank>
Submitted:  Tue 08 Dec 2020 07:52:51 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Tue 29 Nov 2022 06:23:35 PM UTC, comment #1: 

I recently committed a lot of changes for macos.
Please use:
git clone git://repo.or.cz/tinycc.git

Herman ten Brugge <hermantb>
Tue 08 Dec 2020 07:52:51 PM UTC, original submission:  

Verified on head of "mob" branch:

$ ./tcc test.c
tcc: error: library 'c' not found

This is due to the issue discussed here: https://news.ycombinator.com/item?id=23612772

Basically, the "*.dylib" files no longer exist on the filesystem, although when you call dlopen() on the paths it still works.  This breaks any code that tries to probe for the existence of a library itself rather than just calling dlopen() and seeing if it fails.

This seems to be happening inside tcc with tcc_add_library_err() -> tcc_add_library() -> tcc_add_library_internal() -> tcc_add_file_internal() -> _tcc_open()

Unfortunately after that point it gets ugly -- I don't even know if it is possible to do anything like what macho_load_dll() is currently doing.  On MacOS 11 the way that the system linker works is that it finds a yaml *.tbd file describing the library inside of the SDK (for example /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libc.tbd ) and then does some magic to map that to a symbol to use.  It's very confusing to me and I'm not sure how easy it would be to emulate.

m-ngnsav@bodyfour.uk <mitchblank>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by hermantb (Posted a comment)
  • -email is unavailable- added by mitchblank (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-c373.
    Corresponding source code