简体   繁体   中英

CMake error while installing Torch in Ubuntu

I'm trying to install Torch in my PC (Ubuntu). I follow the steps described in the Torch website. However, when I run

$./install.sh

I got the error:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cublas_device_LIBRARY (ADVANCED)
    linked by target "THC" in directory /home/leonardo/torch/extra/cutorch/lib/THC

So I tried to analyze the CMake log and there is this following error:

/home/leonardo/torch/extra/cutorch/build/CMakeFiles/CMakeTmp/src.c:5:20: error: ‘luaL_setfuncs’ undeclared (first use in this function); did you mean ‘lua_setfenv’?
   long i = sizeof(&luaL_setfuncs);
                    ^~~~~~~~~~~~~
                    lua_setfenv
/home/leonardo/torch/extra/cutorch/build/CMakeFiles/CMakeTmp/src.c:5:20: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_0eb19.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_0eb19.dir/src.c.o' failed

Why I have got this error? And how can I resolve it?

Sorry for my english, it's a little rusty, if anyone can't understand it, tell me to explain all of this in another way. Thanks for everyone who helps me with it.

PS: I installed NVidia CUDA Toolkit before all of it, maybe the Torch is "strange", because of it.

The cublas_device library was deprecated in CUDA 9.2 and removed in CUDA 10. Looks like your version of Torch is building against cuDNN that is expected to work with CUDA 9.2 or older.

You can either:

  1. Use this fork of Torch that works with CUDA 10 https://github.com/nagadomi/distro
  2. Downgrade to CUDA 9.2 or older

Another aspect that you need to be aware of is to ensure your NVidia GPU driver, cuDNN and CUDA versions all works together. Refer to https://docs.nvidia.com/deploy/cuda-compatibility/index.html .

CUDA 工具包和驱动程序兼容性

https://github.com/nagadomi/waifu2x/issues/253#issuecomment-445448928

git clone https://github.com/nagadomi/distro.git ~/torch --recursive
cd ~/torch
./install-deps
./clean.sh
./update.sh

It appears that torch does not support CUDA 10. Downgrade to CUDA 9.1

https://developer.nvidia.com/cuda-91-download-archive

https://github.com/clab/dynet/issues/1457#issuecomment-424347220

Upgrade CMAKE to 3.12 worked for me.

Installation guide:

https://askubuntu.com/questions/1125808/how-to-upgrade-cmake-in-arm-based-ubuntu

sudo apt remove cmake
wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz
tar xf cmake-3.8.2.tar.gz
cd cmake-3.8.2
./configure
sudo make install
cmake --version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM