处理“dyld:懒惰符号绑定失败:找不到符号” nm找不到符号时出错 [英] Handling "dyld: lazy symbol binding failed: Symbol not found" error when nm does not find symbol

查看:174
本文介绍了处理“dyld:懒惰符号绑定失败:找不到符号” nm找不到符号时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 myBinary 的胖(32位和64位)英特尔二进制文件,无法在运行Mac OS X 10.8.2的另一个工作站上运行:

  $ myBinary 
dyld:懒符号绑定失败:找不到符号:__ZNSt8__detail15_List_node_base7_M_hookEPS0_
引用自:/ usr / local / bin / myBinary
预期于:/usr/lib/libstdc++.6.dylib

dyld:找不到符号:__ZNSt8__detail15_List_node_base7_M_hookEPS0_
引用自/ usr / local / bin / myBinary
预期于:/usr/lib/libstdc++.6.dylib

跟踪/ BPT陷阱:5

我从运行GCC 4.7.2的Mac OS X 10.8.2工作站编译它:

  $ gcc --version 
gcc(MacPorts gcc47 4.7.2_2 + universal)4.7.2

我运行 nm ,符号未定义:

  $ nm / usr / local / bin / myBinary | grep __ZNSt8__detail15_List_node_base7_M_hookEPS0_ 
U __ZNSt8__detail15_List_node_base7_M_hookEPS0_

编译<$ c $时错过了什么, C> myBinary ?我不知道我可以怎样处理 / usr / lib / libstdc ++中的缺失符号。6.dylib - 我应该将C ++库静态编译为 myBinary

解决方案

是的,您有2个选项,将不会有...(你可以提供它们作为一个dyld或框架)。

或者只是静态链接库...这实际上最终会变得更小在内存和磁盘空间,如果你的软件包只有一个进程,因为你可以去掉你不使用的符号。


I have a fat (32- and 64-bit) Intel binary called myBinary that fails to run on another workstation running Mac OS X 10.8.2:

$ myBinary
dyld: lazy symbol binding failed: Symbol not found: __ZNSt8__detail15_List_node_base7_M_hookEPS0_
  Referenced from: /usr/local/bin/myBinary
  Expected in: /usr/lib/libstdc++.6.dylib

dyld: Symbol not found: __ZNSt8__detail15_List_node_base7_M_hookEPS0_
  Referenced from: /usr/local/bin/myBinary
  Expected in: /usr/lib/libstdc++.6.dylib

Trace/BPT trap: 5

I compiled it from a Mac OS X 10.8.2 workstation running GCC 4.7.2:

$ gcc --version
gcc (MacPorts gcc47 4.7.2_2+universal) 4.7.2

I ran nm and the symbol is undefined:

$ nm /usr/local/bin/myBinary | grep __ZNSt8__detail15_List_node_base7_M_hookEPS0_
     U __ZNSt8__detail15_List_node_base7_M_hookEPS0_

What did I miss or do wrong when compiling myBinary? I'm not sure what I can do about a missing symbol in /usr/lib/libstdc++.6.dylib — should I have statically compiled the C++ library into myBinary?

解决方案

yeah you have 2 options, either not use libraries that the customer won't have... (you can provide them as a dyld or framework.)

or just statically link the library... this will actually end up being smaller in memory and disk space if your package is only one process, because you can strip symbols that you don't use.

这篇关于处理“dyld:懒惰符号绑定失败:找不到符号” nm找不到符号时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆