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

7

55

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.

Pirozzo answered 12/7, 2018 at 21:42 Comment(1)
This seems to be a common problem since a certain XCode update. I've encountered it myself when compiling C++ code. It is discussed on the Apple forums, but I haven't tried out their solution: forums.developer.apple.com/thread/97850Kaenel
L
39

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)
Logistician answered 25/3, 2019 at 18:46 Comment(4)
Worked perfectly for me with MacOSX10.12.sdk on OS X 10.12.6.Angry
Worked like a charm on OSX 10.13.6. Thanks for including the xcrun tip. I use Visual Studio Code instead of XCode, so I didn't know off the top of my head which XCode version I had.Erectile
worked for me by exporting full path of the command, something like export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdkBlender
Perfect. I used export SDKROOT=$(xcrun --show-sdk-path) and it eliminated the error. Thanks.Beam
M
13

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
Misdemeanant answered 2/11, 2018 at 1:57 Comment(4)
This removed the warnings I was seeing with MacOS High Sierra (10.13.6) and XCode 10.1. Reinstalling xcode CLI did not fix it for me. I needed to link a lot of frameworks. Here's the script.Subdiaconate
The script posted by @redwizard792 fixed almost all warnings. One more link from PrivateFrameworks helped: sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/UIFoundation.framework /Library/FrameworksKaenel
@redwizard792 The script fixed most of the warnings for me as well except for the file TrustEvaluationAgent. ThanksRerun
FWIW, this solution caused a link error: ld: in '/Library/Frameworks//CoreFoundation.framework/Versions/A/CoreFoundation.tbd', file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Frameworks//CoreFoundation.framework/Versions/A/CoreFoundation.tbd for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)Abigail
T
6

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.

Turpin answered 31/7, 2018 at 17:42 Comment(1)
The above isn't working for me. Does anyone have other ideas on how to fix this? I've uninstalled xcode & tools. Then re-installed and I still get the same error. It seems to be causing configure to fail thinking a library isn't installed. ld: warning: text-based stub file .../Foundation.tbd and library file .../Foundation are out of sync. Falling back to library file for linking. ld: warning: text-based stub file ...CoreFoundation.tbd and library file ...CoreFoundation are out of sync. Falling back to library file for linking.Skricki
L
3

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)

Lengthwise answered 9/10, 2018 at 22:36 Comment(0)
D
0

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.

Dior answered 13/7, 2018 at 17:3 Comment(0)
M
0

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

Mervin answered 10/4, 2020 at 16:11 Comment(0)
R
0

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"
Region answered 10/2, 2021 at 0:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.