When compiling a c++ project in a conda environment on MacOS Big Sur, the error
ld: unsupported tapi file type '!tapi-tbd' in YAML file
may occur. How to proceed?
2 Answers
On Big Sur, the SDK that comes with Command Line Tools is too new. An older one needs to be downloaded and used:
- Download the 10.10 SDK "MacOSX10.10.sdk.tar.xz" from here.
- Extract it:
tar xf MacOSX10.10.sdk.tar.xz -C /opt
- Add following lines to
~/.condarc
:
conda_build:
config_file: ~/.conda/conda_build_config.yaml
- create
~/.conda/conda_build_config.yaml
if it doesn't exist and add:
CONDA_BUILD_SYSROOT:
- /opt/MacOSX10.10.sdk # [osx]
Many thanks to ihnorton
on this thread.
-
1I was a bit skeptical about this, particularly because it is such an old version of the SDK. However, looking into how Conda Forge builds their
osx-64
packages, I found they are currently downloading SDK 10.9. So, yes this appears to just be how things are.– mervSep 19, 2021 at 18:07 -
2I used 10.10 because this thread says that is what the anaconda team is targeting (in 2018), but there are also suggestions there that newer SDK versions work too, e.g. up to 10.13 Sep 19, 2021 at 20:08
-
1Woops, I deleted my comment, for the record, I was saying that the conda recipe @merv linked to used whatever SDK was installed but defaulted to 10.9. And yeah, looks like Conda Forge targets 10.9, while Anaconda targets 10.10 as OP mentioned.– rmwenzApr 5, 2022 at 22:27
-
1Also FWIW I got the same error as OP trying to install packages in RStudio. In case anyone else has the same issue, you may need to update
.Rprofile
withSys.setenv(CONDA_BUILD_SYSROOT = "/opt/MacOSX10.10.sdk")
, as a comment at the GitHub issue thread referenced in this answer indicates.– rmwenzApr 5, 2022 at 22:31 -
1Or just
export CONDA_BUILD_SYSROOT="/opt/MacOSX10.10.sdk"
in your terminal config file, e.g..bash_profile
or.zshrc
– rmwenzApr 5, 2022 at 22:53
Alternatively, if you don't want to build against conda (but just happen to be in a conda environment), you may be unwittingly using a conda-distributed ld
that's incompatible with the newer system tools and libraries.
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.