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

RXcodeMacosRcppLinker Warning

R Problem Overview


When I am trying to sourceCpp, it gives a warning:

> ld: warning: text-based stub file > /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd > and library file > /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation > are out of sync. Falling back to library file for linking.

But the function actually works. Just wondering how to solve this warning.

R Solutions


Solution 1 - R

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)

Solution 2 - R

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

Solution 3 - R

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.

Solution 4 - R

Reinstalling may help, but also may not.

It's Apple's fault and they need to fix it with another command line tools update.

Just ignore the warning for now.

(See a bunch of other people experiencing the issue here: https://github.com/vim/vim/issues/3445 and here: https://github.com/golang/go/issues/26073)

Solution 5 - R

I think this has nothing to do with Rcpp.

This is related to your system.

I show first lines of one tbd file below. It is just a text file. You can open it using a text editor.

--- !tapi-tbd-v3
archs:           [ i386, x86_64, x86_64h ]
uuids:           [ 'i386: 17321B27-67AB-3D26-B9DF-A69624B1C82B', 'x86_64: 358C547D-E227-3228-8218-62327F4605C8', 
                   'x86_64h: 945E5C0A-86C5-336E-A64F-5BF06E78985A' ]
platform:        macosx
install-name:    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
current-version: 1452.23
compatibility-version: 150
exports:         
  - archs:           [ i386 ]
    symbols:         [ '$ld$add$os10.5$.objc_class_name_NSObject', '$ld$add$os10.6$.objc_class_name_NSObject', 
                       '$ld$add$os10.7$.objc_class_name_NSObject', '$ld$hide$os10.4$.objc_class_name_NSArray', 
                       '$ld$hide$os10.4$.objc_class_name_NSCalendar', '$ld$hide$os10.4$.objc_class_name_NSData', 
...

As I understand, the tbd file contains the version and location of the real library file. It is like a "link". (Just my personal understanding. Please correct me if this is wrong.)

After the upgrade of Xcode, your tbd file and real library are out of sync. Then you got the warning.

I think you can ignore this warning for now, since your compiler has fallen back and found the correct library.

Solution 6 - R

The dates of CoreFoundation and CoreFoundation.tbd show that the latter is much older. This suggests it can be ignored. The out of sync problem can easily be cured by deleting the .tbd file. It is not needed and if not present cannot generate the out of sync error.

I use CoreFoundation and IOKit on 10.13.6 and this is a simple solution avoiding reloading CommandLine tools or setting links or trying to export SDKs etc.

John

Solution 7 - R

If you previously set SDKROOT in your ~/.bash_profile or ~/.zshrc you either need to update it whenever you update macOS or delete (if you do not need it).

This was the case for me export SDKROOT=macosx10.14 was in my ~/.bash_profile, after I updated to macOS Catalina 10.15.7 so it was causing the problem.

If you choose to update, it will look like this (based on previous answers)

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMOOnView Question on Stackoverflow
Solution 1 - RPaul Razvan BergView Answer on Stackoverflow
Solution 2 - RjiyongdongView Answer on Stackoverflow
Solution 3 - RHighsteadView Answer on Stackoverflow
Solution 4 - RUberFarmerView Answer on Stackoverflow
Solution 5 - RQiang KouView Answer on Stackoverflow
Solution 6 - RJohnView Answer on Stackoverflow
Solution 7 - RpapigeeView Answer on Stackoverflow