问题标签 [otool]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
1164 浏览

python - Dynamic linking of shared object to libSystem.B.dylib

So I've been working on compiling a static version of MySQL and MySQLclient-python. I've been completely successful up to this point where I'm trying to understand a libSystem.B.dylib dependency that MySQLclient-python has.

To make it clear, MySQLclient-python is a python wrapper around the MySQL C Library. This results in the need to compile MySQLclient-python before it is used. This is currently working on OS X 10.7, and my goal is to create a compiled version of MySQLclient-python that will work on multiple versions of OS X (bundling libmysql is already taken care of). Right now, I am compiling MySQLclient-python perfectly fine, and it works on 10.7. However, when it's testing on 10.8+, it breaks. To compile MySQLclient-python, I'm using python 3.5 and running

This results in two things happening. First, a _mysql.o object file is compiled using a command similar to this. Then, a shared object file is compiled using this script. To be clear, those commands are mostly generated by setup.py.

The resulting build has the structure

Now, when running

It clearly shows there's a dependency on libSystem.B.dylib. Now dependencies aren't an issue in general, and this works fine on 10.7. I can import the python module and use it correctly. However, when switching to 10.11, this same module no produces a:

Obviously, my first thought is that there's a problem with the dependency. I do believe that is the issue. To be honest though, I'm not sure where to go from here. Obviously, OS X strongly discourages static linking, so I didn't look into that for long. Just to be clear once more, my goal is just to be able to use this on multiple OS X platforms (10.7-10.11) and this currently works on 10.7. Any ideas?

0 投票
1 回答
3351 浏览

macos - 使用 install_name_tool 修复 dylib 文件中的路径

在将操作系统更新为 El Capitan 后,我正在尝试编译我的 C++ 项目。但是,我在此过程中遇到了一些障碍:

问题是那pathB不存在。当我跑步时otool -L pathA/libIceUtil.34.dylib,我得到

install_name_tool -change pathB/libIceUtil.34.dylib pathA/libIceUtil.34.dylib pathA/libIceUtil.34.dylib没有解决问题。一篇文章提到使用libtool. 知道如何解决这个问题吗?

0 投票
2 回答
791 浏览

python - 执行失败:/usr/bin/otool -L /usr/bin/install_name_tool

我正在尝试在我的系统上执行 brew 命令。但它不断抛出同样的失败:

0 投票
1 回答
1583 浏览

c++ - 对 boost 库的依赖没有完整路径

我的动态库依赖于使用自定义前缀 ( ./b2 install --prefix=PREFIX) 构建和安装的 boost 库成功构建。但是,当我otool -L在我的库上运行时,我得到如下输出:

也就是说,与其他依赖项不同,它没有通向这些 boost 库的完整路径。当我的库被应用程序加载时,这会导致运行时错误。我知道可以使用install_name_tool手动解决此问题。但是,我试图弄清楚,为什么它只发生在 boost 库中而不发生在我的库所依赖的其他依赖项上?

编辑

我被要求给出一个构建命令的例子,但像往常一样,“现实生活”的例子有点复杂。就我而言,有一个libA.dylib依赖于 boost 的库。然后,我的库libMy.dylib也依赖于libA.dylib和提升。问题出现在configure步骤中,当执行简单的库存在检查时(类似于 的自定义测试程序AC_CHECK_LIB)。此检查尝试构建一个小测试程序,该程序被链接libA.dylib以证明可用性libA.dylib并且它失败 - 由于无法找到提升库的错误。当然它不会找到它们,因为otool -L libA.dylib给了我没有完整路径的提升库。

0 投票
1 回答
569 浏览

c++ - “dll-path”在构建boost时没有效果

我的目标是通过在编译 boost 时提供dll-path选项来在编译的 boost 库中拥有完整的运行路径:

但是,当我检查$(pwd)/build文件夹中的库时,我得到了这个:

即,而不是具有库名称的完整路径,只有库名称(libboost_system.dylib)。应该如何使用dll-path选项或者是否有“官方”方式来实现这一点(除了install_name_tool在每个库上手动运行脚本)?

0 投票
1 回答
7062 浏览

macos - dylib 库路径并在应用程序中使用它

我想在 Mac OS X El Capitan (10.11.x) 中创建一个库,并通过 qt creator 在另一个应用程序中使用它,所以我在 qt 中使用以下设置创建了一个简单的库:

如您所见,我在 MyFrm 框架中创建了“DynminLinkingLib”库;之后,我创建了一个 Qt 应用程序来使用该库。

当我在 qt 中运行我的应用程序时,它给了我这个错误:

为了解决 Qt 项目中的这个错误,我将DYLD_LIBRARY_PATH变量设置为/System/Library/Frameworks/MyFrm.framework/dylib并且它运行良好,但是当我运行捆绑应用程序时它不起作用并给我这个错误:

在此处输入图像描述

这是因为“libDynminLinkingLib.1.dylib”不在应用程序路径中。

我有两个问题:

  1. 我知道如何解决这个问题,install_name_tool但我想在 qmake 和 .pro 文件中解决这个问题。那么如何通过 pro config 文件解决这个问题呢?

  2. DYLD_LIBRARY_PATH在 El Capitan,出于安全原因,我无法使用。为了使用它,我必须停用 SIP(​​系统完整性保护)。那么有什么方法可以在不停用 SIP 的情况下使用 DYLD_LIBRARY_PATH 吗?

0 投票
1 回答
1187 浏览

macos - 无法在 osx 上更改 @rpath

我有一个具有以下依赖项的外部库“libspecial.dylib”。

因为@rpath 会导致问题,所以我有一个脚本将所有@rpath 替换为真实路径。

但这只会替换第二个依赖项(实际上还有更多依赖项,所有依赖项都被替换了,但不是第一个指向 lib 本身的依赖项):

我不知道为什么我不能改变第一个依赖。有任何想法吗?

在 OSX 10.11.1 上运行

0 投票
0 回答
382 浏览

macports - 由于 libiconv.2.dylib,PHP 升级失败。我应该符号链接吗?

我正在尝试从 PHP 5.5 升级到 PHP 5.6。curl然后我在安装时收到以下错误:

我有:

  1. 没有为 dylib 设置环境变量
  2. otool -L /opt/local/lib/libiconv.2.dylib返回:/opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
  3. port installed返回libiconv @1.14_0 (active),最新版本。

看起来像:

otool -DL /usr/lib/libiconv.2.dylib

返回:

因此系统版本正在通过 PHP 安装访问。如何使它指向本地 lib 版本?

暂时试试sudo port -n upgrade --force libiconv。。

0 投票
1 回答
705 浏览

macos - 使用 macdeployqt 为 qt 应用程序创建 dmg 文件

我目前使用 macdeployqt 创建了一个“dmg”文件并遇到了以下错误。

然后我遇到了@cristopher bruns 的这篇文章,它解释了这种情况。本质上,我需要添加libosg.141.dylib到应用程序中,然后添加所有依赖的库libosg.141.dylib。例如,libosg.141.dylib依赖于以下 13 个文件。

我的问题是我需要将所有这 13 个文件添加到应用程序吗?我需要走多深?我怎么知道什么时候停下来。由于这些文件中的每一个都可能有自己的依赖项?

0 投票
1 回答
1005 浏览

c++ - 通过 otool 查看时 install-name-tool 不添加库路径?

我使用 Xcode 和 Qt 完成了我的 mac 应用程序。现在我想准备将其部署到其他 Mac。为了做到这一点,我使用了 macdeployqt。

我刚刚使用 macdeployqt 创建了一个应用程序包。然而,一些图书馆不见了。我试图遵循 [this][1] 的答案。原来我需要将丢失的 dylib 从我的计算机复制到 .app,然后运行安装名称工具。我还没有使用 install-name 工具,因为我对使用-id-change使用它感到困惑,尤其是在我目前的情况下。我什至需要使用它吗?这是我到目前为止所做的。

第 1 步:运行 macdeployqt - 这是 Qt 附带的程序,将 qt 的必要要求嵌入到应用程序中。

第 2 步:然后我决定在实际生成的应用程序二进制文件上运行 otool

第 3 步:但是我注意到我的 project2.app/Contents/Frameworks 里面没有这些库。所以我决定手动复制它们。

你能告诉我复制这些文件后我的下一步应该是什么吗?

这是我尝试在另一台计算机上运行应用程序而不使用 install_name_tool 时得到的输出

更新:

经过一番挣扎后,我决定执行以下操作

当我对我刚刚添加的一个库执行此操作时,这似乎并没有解决问题。

我仍然没有获得图书馆的路径,libOpenThreads.20.dylib , libosgUtil.141.dylib and libosg.141.dylib 任何建议都会受到欢迎。