当我试图在Mac OS X中运行一个可执行文件时,我得到以下错误

dyld: Library not loaded: libboost_atomic.dylib
  Referenced from: /Users/"Directory my executable is in"
  Reason: image not found
Trace/BPT trap:5

我已经安装了boost库,它们位于/opt/local/lib中。我认为这个问题与可执行文件只在它所在的目录中查找有关,因为当我粘贴'libboost_atomic。Dylib '在那里,它不再介意了。不幸的是,它会抱怨找不到下一个增强库。

有没有简单的方法来解决这个问题?


当前回答

如果您在终端中使用Conda环境,请更新samtools以解决该问题。

第二个install -c bioconda samtools

其他回答

在我们的例子中,它是一个基于Xcode 11.5构建的iOS应用,使用cocoapods(如果你愿意,也可以是cocoapods-binary)。

我们看到了这样的崩溃:

dyld: Library not loaded: @rpath/PINOperation.framework/PINOperation
  Referenced from: /private/var/containers/Bundle/Application/4C5F5E4C-8B71-4351-A0AB-C20333544569/Tellus.app/Frameworks/PINRemoteImage.framework/PINRemoteImage
  Reason: image not found

原来我必须删除pod缓存并重新运行pod安装,所以Xcode会指出这个差异:

如https://gist.github.com/berkedel/d1fc6d13651c16002f64653096d1fded中所说,你可以试试

brew uninstall --ignore-dependencies node icu4c
brew install node
brew link --overwrite node

我通过使用产品>清洁构建文件夹(CommandShiftK)修复了这个问题,这使得一个新的清洁构建,真的很奇怪。

选择您的项目 瞄准目标 转到框架、库和嵌入式内容 单击+图标 你应该得到一个提示=>搜索你错过的库;-我的例子是OpenSSL-。 选择它并添加它。 清理项目。 重建。

您可以对可执行文件使用otool命令和-L选项,这将显示可执行文件期望这些库的位置。

如果需要更改这些库的路径,请使用install_name_tool命令,该命令允许您设置库的路径。