ld: warning: text-based stub file are out of sync. Falling back to library file for linking ld: warning: text-based stub file are out of sync. Falling back to library file for linking r r

ld: warning: text-based stub file are out of sync. Falling back to library file for linking


Using MacOS Mojave 10.14.2, the fix for me was to use the solution from this comment on GitHub:

export SDKROOT=macosx10.14

Put the line above in your ~/.bash_profile. Replace 10.14 with your specific version of MacOSX Xcode tools. Find out what version you have by doing:

xcrun --show-sdk-path

It will print something like:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

Just grab the last word, make it all lower caps and replace it in the export command above.

Update Sep 2019

In the latest release, they removed the version number from the sdk. Just grab the full path and export it as SDKROOT, like this:

export SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"

Update Aug 2021

To avoid having to continuously update the exported value whenever you upgrade your OS, you can place the xcrun command directly in the shell script:

export SDKROOT=$(xcrun --show-sdk-path)


I had this problem while compiling Go code on my Mac too.

The tld files were out of sync in /System/Library/Frameworks/.

The solution:

Just links the recent frameworks from MacOSX.sdk to /Library/Frameworks/

sudo ln -s  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework /Library/Frameworks/CoreFoundation.framework


Edit: this seems to have stopped working post 10.13.16. Trying it will not hurt your mac after the re-install but i'm not sure how to fix it going forward.

Came across this recently, just remove the command line tools for mac and re-install.

$ rm -rf /Library/Developer/CommandLineTools$ xcode-select --install

After these steps you will see a pop to install the new version of the tools.