xcode dyld:库未加载:/usr/local/lib/libmpfr.4.dylib
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49457773/
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
dyld: Library not loaded: /usr/local/lib/libmpfr.4.dylib
提问by Elizabeth Haker
When I run "make" on a project I get this error:
当我在项目上运行“make”时,出现此错误:
dyld: Library not loaded: /usr/local/lib/libmpfr.4.dylib
Referenced from: /Users/Petrov/Downloads/mips/bin/../libexec/gcc/mipsel-elf/4.8.1/cc1
Reason: image not found
There is no libmpfr.4.dylib
file in /usr/local/lib
, but there is libmpfr.6.dylib
. I have mpfr 4.0.1 installed. I have tried reinstalling Xcode and mpfr already.
中没有libmpfr.4.dylib
文件/usr/local/lib
,但有libmpfr.6.dylib
. 我安装了 mpfr 4.0.1。我已经尝试重新安装 Xcode 和 mpfr。
回答by Utpal Kumar
I had similar problem in Mac. I fixed it by upgrading the "gawk" using brew
我在 Mac 上遇到了类似的问题。我通过使用 brew 升级“gawk”来修复它
brew upgrade gawk
回答by neosarchizo
I solved it like this.
我是这样解决的。
ln -s /usr/local/opt/mpfr/lib/libmpfr.6.dylib /usr/local/opt/mpfr/lib/libmpfr.4.dylib
回答by Nicholas Hamilton
@Vinc17 is right in his comment to @neosarchizo's proposed solutiion, symlinks can be problematic if referencing a different version, HOWEVER, in my case, running the following command:
@Vinc17 在他对@neosarchizo 提议的解决方案的评论中是正确的,如果引用不同的版本,符号链接可能会出现问题,但是,在我的情况下,运行以下命令:
locate libmpfr.4.dylib
locate libmpfr.4.dylib
Showed that I did have the right library in a different directory:
表明我确实在不同的目录中有正确的库:
/opt/local/lib/libmpfr.4.dylib
/opt/local/lib/libmpfr.4.dylib
So for me, I felt it was perfectly safe to use the symlink approach, ie:
所以对我来说,我觉得使用符号链接方法是完全安全的,即:
sudo ln -s /opt/local/lib/libmpfr.4.dylib /usr/local/lib/libmpfr.4.dylib
sudo ln -s /opt/local/lib/libmpfr.4.dylib /usr/local/lib/libmpfr.4.dylib
Probably a hack, but problem solved.
可能是一个黑客,但问题解决了。
回答by vinc17
The cause of the error is that you have upgraded from MPFR 3.1.x to MPFR 4.0.x, which is ABI-incompatible with MPFR 3.1.x (a MPFR 4.0.x library cannot be used with a program compiled against MPFR 3.1.x). Hence the change from libmpfr.4.dylib (used for MPFR 3.0.x and MPFR 3.1.x) to libmpfr.6.dylib (used for MPFR 4.0.x at least).
错误的原因是您已从 MPFR 3.1.x 升级到 MPFR 4.0.x,它与 MPFR 3.1.x ABI 不兼容(MPFR 4.0.x 库不能与针对 MPFR 3.1.x 编译的程序一起使用)。因此,从 libmpfr.4.dylib(用于 MPFR 3.0.x 和 MPFR 3.1.x)更改为 libmpfr.6.dylib(至少用于 MPFR 4.0.x)。
What you should have done instead, in order to avoid the error, is to install MPFR 4.0.x without uninstalling libmpfr.4.dylib from MPFR 3.1.x: all new compiled software would use MPFR 4.0.x and libmpfr.6.dylib, but older binaries depending on MPFR would have still been able to run by using libmpfr.4.dylib (a possible exception is when there are two different dependencies on MPFR, via libraries, where both libmpfr.4.dylib and libmpfr.6.dylib could be needed, in which case this might not work).
为了避免错误,您应该做的是安装 MPFR 4.0.x 而不从 MPFR 3.1.x 卸载 libmpfr.4.dylib:所有新编译的软件都将使用 MPFR 4.0.x 和 libmpfr.6.dylib ,但依赖 MPFR 的旧二进制文件仍然可以通过使用 libmpfr.4.dylib 运行(一个可能的例外是当 MPFR 有两个不同的依赖项时,通过库,其中 libmpfr.4.dylib 和 libmpfr.6.可能需要 dylib,在这种情况下这可能不起作用)。
Now, you should recompile Xcode. If you get Xcode already compiled (from a binary package), make sure that you get either one compiled against MPFR 4.0.x, or one that includes the libmpfr.4.dylib file. If this is not possible, you should reinstall MPFR 3.1.x. Then you should be able to install MPFR 4.0.x without removing libmpfr.4.dylib, as said above.
现在,您应该重新编译 Xcode。如果您已经编译了 Xcode(从二进制包),请确保您获得的是针对 MPFR 4.0.x 编译的,或者包含 libmpfr.4.dylib 文件的。如果这不可能,您应该重新安装 MPFR 3.1.x。然后您应该能够安装 MPFR 4.0.x,而无需删除 libmpfr.4.dylib,如上所述。
回答by roidinev
Use the system toolchains to compile:
使用系统工具链编译:
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH.