ld:警告:基于文本的存根文件不同步.退回到库文件进行链接 [英] ld: warning: text-based stub file are out of sync. Falling back to library file for linking
问题描述
当我尝试sourceCpp
时,它会发出警告:
When I am trying to sourceCpp
, it gives a warning:
ld:警告:基于文本的存根文件 /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd 和库文件 /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation 不同步.回退到库文件进行链接.
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.
推荐答案
使用MacOS Mojave 10.14.2,对我来说,解决方法是使用此
Using MacOS Mojave 10.14.2, the fix for me was to use the solution from this comment on GitHub:
export SDKROOT=macosx10.14
将上述行放在~/.bash_profile
中.将10.14
替换为特定版本的MacOSX Xcode工具.通过执行以下操作找出您的版本:
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
它将打印类似的内容:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
只需抓住最后一个单词,将其全部用小写并替换为上面的export
命令.
Just grab the last word, make it all lower caps and replace it in the export
command above.
在最新版本中,他们从sdk中删除了版本号.只需获取完整路径并将其导出为SDKROOT
,如下所示:
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"
这篇关于ld:警告:基于文本的存根文件不同步.退回到库文件进行链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!