code compilation -- ld: unsupported tapi file type '!tapi-tbd' in YAML file

I am using MacBook pro M1 (2021 ver). Recently I update to Ventura 13.0.1, now I find that I cannot compile codes by gfortran (or gcc), suffering the “!tapi-tbd” problem, similar to that reported here, https://developer.apple.com/forums/thread/699629

Recall that there is no problem when I am using Ventura 13.0.0 (? the first version). For previous versions (Big Sur, Monterey, etc.), usually I can just re-install Xcode and CommandLineTools, and there won't be problem for the code compilation. For this time, I have re-installed the latest Xcode (ver 14.1), and using xcode-select —install to re-install the CommandLineTools I even tried the task Xcode-select —swith /Library/Developer/CommandLineTools/

But all these failed.

Anyone can help?

Answered by DTS Engineer in 736902022

To start, read An Apple Library Primer which explains a bunch of terminology I’m going to assume.

Apple’s tools only support the SDK that they are bundled with. For example, the command-line tools within Xcode 14.1, only supports the macOS 13.0 SDK embedded within Xcode 14.1. Likewise for the command-line tools in the standalone Command Line Tools for Xcode 14.1 package.

Errors like this are usually the result of a tools / SDK mismatch. Specifically, error messages related to tapi are caused by you using a linker than doesn’t understand stub libraries with an SDK that uses stub libraries. Or perhaps an SDK whose stub libraries are too new for the linker.

The first step in debugging such problems is to confirm that your Apple command-line tools work. That’s pretty straightforward: Just build and run a simple program:

% xcode-select -p 
/Applications/Xcode.app/Contents/Developer
% cat greeting.c 
#include <stdio.h>

int main(int argc, char ** argv) {
    printf("Hello Cruel World!\n");
    return 0;
}
% clang greeting.c -o greeting   
% ./greeting 
Hello Cruel World!

If that works and your third-party tooling fails, you need to look at how that tooling is invoking Apple’s tools. In this case, that means:

  • Does it use the Apple linker? Or its own linker?

  • If it’s the Apple linker, does it invoke the linker with the matching SDK?

  • If it’s a third-party linker, does that linker understand stub libraries?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

To start, read An Apple Library Primer which explains a bunch of terminology I’m going to assume.

Apple’s tools only support the SDK that they are bundled with. For example, the command-line tools within Xcode 14.1, only supports the macOS 13.0 SDK embedded within Xcode 14.1. Likewise for the command-line tools in the standalone Command Line Tools for Xcode 14.1 package.

Errors like this are usually the result of a tools / SDK mismatch. Specifically, error messages related to tapi are caused by you using a linker than doesn’t understand stub libraries with an SDK that uses stub libraries. Or perhaps an SDK whose stub libraries are too new for the linker.

The first step in debugging such problems is to confirm that your Apple command-line tools work. That’s pretty straightforward: Just build and run a simple program:

% xcode-select -p 
/Applications/Xcode.app/Contents/Developer
% cat greeting.c 
#include <stdio.h>

int main(int argc, char ** argv) {
    printf("Hello Cruel World!\n");
    return 0;
}
% clang greeting.c -o greeting   
% ./greeting 
Hello Cruel World!

If that works and your third-party tooling fails, you need to look at how that tooling is invoking Apple’s tools. In this case, that means:

  • Does it use the Apple linker? Or its own linker?

  • If it’s the Apple linker, does it invoke the linker with the matching SDK?

  • If it’s a third-party linker, does that linker understand stub libraries?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

code compilation -- ld: unsupported tapi file type '!tapi-tbd' in YAML file
 
 
Q