安装环境:
虚拟机+Ubuntu14.04
安装依赖:
curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps
|
bash
安装LuaJIT, LuaRocks并LuaRocks安装Torch 和其他的包
git
clone https://github.com/torch/distro.git ~/torch --recursive
cd
~/torch;
./install.sh
特别注意:在./install.sh时出现了错误
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_BC_POW':
buildvm_x86.dasc:(.text+0x84b): undefined reference to `lj_wrap_pow'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_log':
buildvm_x86.dasc:(.text+0x269c): undefined reference to `lj_wrap_log'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_log10':
buildvm_x86.dasc:(.text+0x26cb): undefined reference to `lj_wrap_log10'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_exp':
buildvm_x86.dasc:(.text+0x26fa): undefined reference to `lj_wrap_exp'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_sin':
buildvm_x86.dasc:(.text+0x2729): undefined reference to `lj_wrap_sin'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_cos':
buildvm_x86.dasc:(.text+0x2758): undefined reference to `lj_wrap_cos'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_tan':
buildvm_x86.dasc:(.text+0x2787): undefined reference to `lj_wrap_tan'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_asin':
buildvm_x86.dasc:(.text+0x27b6): undefined reference to `lj_wrap_asin'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_acos':
buildvm_x86.dasc:(.text+0x27e5): undefined reference to `lj_wrap_acos'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_atan':
buildvm_x86.dasc:(.text+0x2814): undefined reference to `lj_wrap_atan'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_sinh':
buildvm_x86.dasc:(.text+0x2843): undefined reference to `lj_wrap_sinh'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_cosh':
buildvm_x86.dasc:(.text+0x2872): undefined reference to `lj_wrap_cosh'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_tanh':
buildvm_x86.dasc:(.text+0x28a1): undefined reference to `lj_wrap_tanh'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_pow':
buildvm_x86.dasc:(.text+0x28e5): undefined reference to `lj_wrap_pow'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_atan2':
buildvm_x86.dasc:(.text+0x2929): undefined reference to `lj_wrap_atan2'
CMakeFiles/luajit.dir/lj_vm.s.o: In function `lj_ff_math_fmod':
buildvm_x86.dasc:(.text+0x296d): undefined reference to `lj_wrap_fmod'
collect2: error: ld returned 1 exit status
exe/luajit-rocks/luajit-2.1/CMakeFiles/luajit.dir/build.make:220: recipe for target 'exe/luajit-rocks/luajit-2.1/luajit' failed
make[2]: *** [exe/luajit-rocks/luajit-2.1/luajit] Error 1
CMakeFiles/Makefile2:184: recipe for target 'exe/luajit-rocks/luajit-2.1/CMakeFiles/luajit.dir/all' failed
make[1]: *** [exe/luajit-rocks/luajit-2.1/CMakeFiles/luajit.dir/all] Error 2
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
./install.sh: line 64: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 65: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 66: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 68: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 69: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 70: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 71: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 72: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 73: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 74: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 75: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 76: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 77: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 78: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 79: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 80: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 90: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 91: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 92: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 93: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 94: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 95: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 96: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 97: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 98: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 99: /home/peter/torch/install/bin/luarocks: No such file or directory
./install.sh: line 102: /home/peter/torch/install/bin/luarocks: No such file or directory
解决方法如下:
修改install.sh如下:
echo "Installing Lua version: ${TORCH_LUA_VERSION}"
mkdir -p install
mkdir -p build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=Release -DWITH_${TORCH_LUA_VERSION}=OFF 2>&1 >>$PREFIX/install.log || exit 1
(make 2>&1 >>$PREFIX/install.log || exit 1) && (make install 2>&1 >>$PREFIX/install.log || exit 1)
cd ..
即将
-DWITH_${TORCH_LUA_VERSION}=ON 修改为OFF