install_name_tool格式错误的对象(加载命令23 cmdsize为零) - Mac OS X Yosemite

时间:2014-11-08 20:57:37

标签: macos object malformed torch

在Yosemite上为火炬安装cunn失败,出现格式错误的对象错误。

 -- Install configuration: "Release"
-- Installing: /usr/local/lib/luarocks/rocks/cunn/scm-1/lib/libcunn.so
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: object: /usr/local/lib/luarocks/rocks/cunn/scm-1/lib/libcunn.so malformed object (load command 23 cmdsize is zero)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: object: /usr/local/lib/luarocks/rocks/cunn/scm-1/lib/libcunn.so malformed object (load command 23 cmdsize is zero)
-- Installing: /usr/local/lib/luarocks/rocks/cunn/scm-1/lua/cunn/init.lua
-- Installing: /usr/local/lib/luarocks/rocks/cunn/scm-1/lua/cunn/test.lua
Updating manifest for /usr/local/lib/luarocks/rocks
cunn scm-1 is now built and installed in /usr/local/ (license: BSD)

在线搜索显示这与库损坏或install_name_tool更新有关。我将install_name_tool从XCode(6.1)替换为/ usr / bin但我仍然得到相同的错误。以下是一些诊断

$ ls -l $(which install_name_tool)
-rwxr-xr-x  1 root  admin  14192 Nov  8 11:25 /opt/local/bin/install_name_tool

$ otool -L /usr/bin/install_name_tool
/usr/bin/install_name_tool:
    /usr/lib/libxcselect.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)


$ pkgutil --file-info /usr/bin/install_name_tool
volume: /
path: /usr/bin/install_name_tool

pkgid: com.apple.pkg.Essentials
pkg-version: 10.10.0.1.1.1412852630
install-time: 1413599255
uid: 0
gid: 0
mode: 755

我需要这个工作,以便我可以使用CUDA和火炬,我已经花了几个小时,请帮助。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,我通过在本地构建libcunn.so解决了这个问题。 运行以下命令:

git clone https://github.com/torch/cunn.git
ls cunn
cmake -E make_directory build
cd build/
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/usr/local/bin/.." -DCMAKE_INSTALL_PREFIX="/usr/local/lib/luarocks/rocks/cunn/scm-1" && make

然后你应该

Linking CXX shared module libcunn.so

然后只需将库复制到目标文件夹:

cp libcunn.so /usr/local/lib/lua/5.1/libcunn.so