I am running tests to see if the downloaded version of gfortran (https://github.com/fxcoudert/gfortran-for-macOS/releases) works after upgrading from Monterey to Sonoma. The gfortran package is required for some work that I am doing in addition to gcc and cpp. Only gfortran was not shown when running which gfortran. The following commands for gcc and cpp yielded
which gcc
/usr/bin/gcc
which cpp
/usr/bin/cpp
To retrieve gfortran, I used the link above to download the .dmg. This resulted in gfortran being placed within the "/usr/local/gfortran" with a symbolic link to "/usr/local/bin/gfortran". To run gfortran, I also had to download Xcode version 15.3 from the App Store and run xcode-select --install to add a CommandLineTools directory. Inside that directory you see the following after running the command most recently referenced:
ls /Library/Developer/CommandLineTools/SDKs/
MacOSX.sdk MacOSX13.3.sdk MacOSX13.sdk MacOSX14.4.sdk MacOSX14.sdk
When I run gfortran on the following file I get this message:
gfortran TEST_1_fortran_only_fixed.f
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib/libSystem.tbd' for architecture arm64 collect2: error: ld returned 1 exit status
I've seen references to these errors on forums, and I have been largely following suggestions outlined in those discussions which I will elaborate more on below.
I have tried what was recommended here: https://stackoverflow.com/questions/63592445/ld-unsupported-tapi-file-type-tapi-tbd-in-yaml-file. That required an installation of home-brew followed by upgrades to gcc and llvm. Nothing is referenced in the compilation instructions about llvm for the work that I'm doing. I did run brew install llvm just in case, however, followed by the appropriate upgrades to gcc. Furthermore, I ran setenv LIBRARY_PATH {$LIBRARY_PATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib as well as all other versions within the /Library/Developer/CommandLineTools/SDKs/ directory to see if the error message above was reproduced. It was.
The bulk of suggestions online does not seem to resolve the issue I'm having, and all the discussions of the issue follow very similar approaches. What I can glean from the error message at this point is that the YAML file is not supported and that there is one error. However, I also notice that part of the error message containing for architecture arm64 may be important. My MacBook Pro is a Apple M1 Max, and I wondered if this was the issue. When looking at the gfortran version, I see the following information:
gfortran -v
Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/aarch64-apple-darwin23/13.2.0/lto-wrapper Target: aarch64-apple-darwin23 Configured with: ../gcc-13-branch/configure --prefix=/usr/local/gfortran --with-gmp=/Users/fx/devel/gcc/build_package/deps --enable-languages=c,c++,fortran,jit,lto,objc,obj-c++ --build=aarch64-apple-darwin23 --with-system-zlib --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.2.0 (GCC)
The sysroot references the MacOSX.sdk, so I decided to switch back to the original $LIBRARY_PATH containing MacOSX.sdk. Furthermore, I see a reference to aarch64, which is the same thing as arm64 from what I understand. This doesn't help me. The gcc version is also listed, which says
gcc -v
Apple clang version 15.0.0 (clang-1500.3.9.4) Target: arm64-apple-darwin23.4.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
The gcc version is apple clang version 15.0.0, but the gcc version referenced when running gfortran -v is 13.2.0. I'm not sure if that is a problem or not.
Other Information:
- /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd contains Targets and Symbols and has a list of dynamic libraries with extension .dylib.
- There are discussions that mention a mismatch between the linker and SDKs. I suspect that this may be the case, but I'm not sure yet. I notice an ld referenced at the beginning of the error message.
I plan to continue to research online to see what I can find, but if anyone has some immediate insights that would be helpful at resolving this issue, that would be great.
Thanks in advance for any help.
ldis gfortran calling out to? It can't be the one from Xcode...