DdDani20
DdDani20

Reputation: 81

Can't compile fortran on MacOS Monterey: ld: unsupported tapi file type '!tapi-tbd' in YAML file

I am facing an error whenever I try to compile fortran code:

% gfortran Testing_Fortran.f90 -o Testing_Fortran

ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/lib/libSystem.tbd' for architecture x86_64 collect2: error: ld returned 1 exit status

Looking at similar issues through the internet, the most common solutions I've found are to downgrade the XCode command line tools, and to reinstall gcc, but none of this worked.

I tried CLTools 14.1 and 13.4, and I am installing gcc via homebrew. The gfortran version is 12.2.0. I'm on MacOS Monterey 12.6.

Any ideas? Thanks in advance.

Upvotes: 8

Views: 7130

Answers (4)

Rahul Ranjan
Rahul Ranjan

Reputation: 1

I also had the same problem and deactivating conda worked for me

Upvotes: 0

jedi.lafond
jedi.lafond

Reputation: 1

While running the install on Anaconda it automatically makes the conda the base run environment on startup. Most people don't pay attention an select yes. To undo this run conda config --set auto_activate_base false in your shell to have it not run on startup.

Upvotes: 0

Sonic
Sonic

Reputation: 141

I had a similar issue. I just deactivated Anaconda and run the fortran code.

conda deactivate
gfortran Testing_Fortran.f90 -o Testing_Fortranc

Again you can go back to Anaconda environment as,

conda activate

Upvotes: 14

Seth Johnson
Seth Johnson

Reputation: 15192

It's likely that your ld isn't the latest system linker: both on this help ticket and with a coworker the problem was that ld pointed to one from Anaconda. If your $PATH is set up so that Anaconda's ld has higher preference over the system linker, this will explain it:

$ which -a ld
/blah/anaconda3/bin/ld
/usr/bin/ld

If that's the case, reorder your PATH to put anaconda's directory after /usr/bin. Then, which ld should point to the system ld, and you should be good to go.

Upvotes: 11

Related Questions