我试图通过CPAN安装XML :: LibXSLT,这似乎工作正常,直到我尝试加载谷歌浏览器或Microsoft Office。我在启动这些程序时出错,但出现以下错误:
Dyld Error Message:
Library not loaded: /usr/lib/libxslt.1.dylib
Referenced from: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks
/DictionaryServices.framework/Versions/A/DictionaryServices
Reason: no suitable image found. Did find:
/usr/lib/libxslt.1.dylib: mach-o, but wrong architecture
/usr/lib/libxslt.1.dylib: mach-o, but wrong architecture
显然问题是XSLT安装的新dylib,但这些似乎都是X86_64所以我不应该看到任何问题,我正在运行Mac OS X 10.6.8。
运行file /opt/local/lib/libxslt.dylib
时
我明白了:
/opt/local/lib/libxslt.dylib: Mach-O 64-bit dynamically linked shared library x86_64
和libxslt.1.dylib一样。
有没有办法解决此问题,并恢复必须更换的原始文件?
编辑:如果要从另一台Mac 10.6.8 64位获取这些库的副本并用这些替换我那些显而易见的混淆库,这至少会解决它们全部混合的问题起来。
还在跑步
[/usr/lib]$ ls | grep libxslt
给了我:
libxslt 2.dylib
libxslt-plugins
libxslt.1.dylib
libxslt.a
libxslt.dylib
libxslt.la
libxslt.pc
答案 0 :(得分:0)
您是否在/usr/lib
中安装或以其他方式替换了Apple提供的原始库?你应该从不那样做。否则,您可能会破坏依赖于这些库的OS X的其他部分。您应该从备份还原原始库或重新安装OS X.如果您想要更新版本,则应将其安装在其他地方,例如/usr/local/lib
。或者更好的是你应该使用第三方软件包管理器,如Homebrew或MacPorts;实际上,从/opt/local/lib
路径判断,您似乎正在使用MacPorts。使用它并且不要更改/usr
(/usr/local
)或/System/Library
以外的系统文件。
答案 1 :(得分:0)
This may be relevant: How to compile universal binaries on Mac OS X.
I ran into this same issue where I had re-compiled libxslt and libxml to support python bindings, then started getting the /usr/lib/libxslt.1.dylib: mach-o, but wrong architecture
error and an immediate crash when starting some apps (Specifically Synergy, which is a 32-bit/i386 app)
I solved this by recompiling libxml2
and libxslt
using these configure options:
./configure CFLAGS="-arch i386 -arch x86_64" \
CXXFLAGS="-arch i386 -arch x86_64" \
LDFLAGS="-arch i386 -arch x86_64" \
--disable-dependency-tracking
Now libxml2 and libxslt libraries are properly showing as universal binaries:
$ file /usr/local/lib/libxslt.1.dylib /usr/local/lib/libxslt.1.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/libxslt.1.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/local/lib/libxslt.1.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
$ file /usr/local/lib/libxml2.2.dylib
/usr/local/lib/libxml2.2.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/libxml2.2.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/local/lib/libxml2.2.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64