CMake error while installing Torch in Ubuntu

Leonardo Martins picture Leonardo Martins · Sep 25, 2018 · Viewed 9.1k times · Source

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.

Answer

Hanxue picture Hanxue · Apr 10, 2019

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 toolkit and driver compatibility