xcode (clang++) 从 libstdc++.6.0.9.dylib 中找不到符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47953595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
(clang++) Symbol not found from libstdc++.6.0.9.dylib
提问by JonghoKim
I meet an error called "Symbol not found" on matlab. The error message is in below.
我在 matlab 上遇到一个名为“找不到符号”的错误。错误消息在下面。
Symbol not found: __ZNKSt5ctypeIcE13_M_widen_initEv
Referenced from: blabla/lib/buildW.mexmaci64
Expected in: /usr/lib/libstdc++.6.0.9.dylib
There are quite bunch of questions like me, but I never found the solution of this problem. The former threads mentioned conflicts between the updated clang and the clang used.
有很多像我一样的问题,但我从来没有找到这个问题的解决方案。前一个线程提到了更新的 clang 和使用的 clang 之间的冲突。
Here are exmaples of questions on the similar question.
以下是有关类似问题的问题示例。
- Need help finding Undefined Symbols
- Handling "dyld: lazy symbol binding failed: Symbol not found" error when nm does not find symbol
- https://github.com/Homebrew/homebrew-core/issues/4902
- 需要帮助查找未定义的符号
- 当 nm 找不到符号时处理“dyld:lazy symbol binding failed: Symbol not found”错误
- https://github.com/Homebrew/homebrew-core/issues/4902
I currently installed Xcode 9.2.
我目前安装了 Xcode 9.2。
And in matlab, I use MacOSX10.13.sdk like below.
在 matlab 中,我使用 MacOSX10.13.sdk,如下所示。
>> edit ([matlabroot '/bin/maci64/mexopts/clang++_maci64.xml'])
...
...
<dirExists name="$$/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk" />
<cmdReturns name="find $$ -name MacOSX10.13.sdk" />
Also, I found that there are three files in "/usr/lib"
另外,我发现“/usr/lib”中有三个文件
/usr/lib/libstdc++.6.0.9.dylib
/usr/lib/libstdc++.6.dylib
/usr/lib/libstdc++.dylib
Can anyone help me?
谁能帮我?
回答by clemens
The symbol __ZNKSt5ctypeIcE13_M_widen_initEv
(demangled std::ctype<char>::_M_widen_init() const
) is defined in libstdc++.dylib
but if you execute
符号__ZNKSt5ctypeIcE13_M_widen_initEv
(demangled std::ctype<char>::_M_widen_init() const
) 定义在libstdc++.dylib
但如果你执行
nm /usr/lib/libstdc++.dylib | fgrep __ZNKSt5ctypeIcE13_M_widen_initEv
you will get
你会得到
0000000000006a14 t __ZNKSt5ctypeIcE13_M_widen_initEv
as result. The t
means that it's defined in the TEXT section but it's a localsymbol which cannot referenced from outside the library.
结果。这t
意味着它是在 TEXT 部分中定义的,但它是一个不能从库外部引用的本地符号。
Clang in Xcode uses
Clang 在 Xcode 中使用
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib/libstdc++.tbd
for linking instead of /usr/lib/libstdc++.dylib
. This is a human readable file which contains only the name of the public symbols in libstdc++.dylib
. Since the symbol above is private it is not listed in the .tbd file.
用于链接而不是/usr/lib/libstdc++.dylib
. 这是一个人类可读的文件,其中仅包含libstdc++.dylib
. 由于上面的符号是私有的,它没有列在 .tbd 文件中。