-1

在 Yosemite 上安装 cunn for torch 失败并出现错误的对象错误。

 -- 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 的更新有关。我将 XCode(6.1) 中的 install_name_tool 替换为 /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 与 Torch 一起使用,我已经花了几个小时在上面,请帮忙。

4

1 回答 1

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
于 2014-11-10T04:55:59.550 回答