当我试图在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 '在那里,它不再介意了。不幸的是,它会抱怨找不到下一个增强库。

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


当前回答

在我们的例子中,它是一个基于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会指出这个差异:

其他回答

Install_name_tool -add_rpath new_path可执行文件 Install_name_tool -delete_rpath old_path可执行文件

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

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

第二个install -c bioconda samtools

在我的情况下,这是节点是过时的,你需要升级后,去BigSur - brew升级节点

这招对我很管用:

brew upgrade node