【问题标题】:CMake error while installing Torch in Ubuntu在 Ubuntu 中安装 Torch 时出现 CMake 错误
【发布时间】:2019-03-01 06:56:24
【问题描述】:

我正在尝试在我的 PC (Ubuntu) 中安装 Torch。我按照 Torch 网站中描述的步骤进行操作。但是,当我运行时

$./install.sh

我得到了错误:

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

于是我尝试分析CMake日志,出现如下错误:

/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

为什么会出现这个错误?我该如何解决?

对不起,我的英语有点生疏,如果有人看不懂,请告诉我用另一种方式解释所有这些。 感谢所有帮助我的人。

PS:我之前安装了 NVidia CUDA Toolkit,也许 Torch 很“奇怪”,因为它。

【问题讨论】:

  • 您得到的“CMake 错误”表示尚未找到对应于 CUDA_cublas_device_LIBRARY 变量的库。根据变量名,这是cublas_device 库。我不是 CUDA 专家,因此无法建议在哪里搜索这个库,即使它应该存在。但项目需要它。至于CMakeLog.txt中的编译错误,很可能只是检查,函数/变量luaL_setfuncs是否存在。根据检查结果,项目应进行相应的配置。不用担心。

标签: linux cmake installation torch


【解决方案1】:

cublas_device 库在 CUDA 9.2 中已被弃用,并在 CUDA 10 中被删除。看起来您的 Torch 版本是针对预计可与 CUDA 9.2 或更早版本一起使用的 cuDNN 构建的。

您可以:

  1. 使用与 CUDA 10 配合使用的 Torch 分支https://github.com/nagadomi/distro
  2. 降级到 CUDA 9.2 或更早版本

您需要注意的另一个方面是确保您的 NVidia GPU 驱动程序、cuDNN 和 CUDA 版本都能协同工作。请参阅https://docs.nvidia.com/deploy/cuda-compatibility/index.html

【讨论】:

  • 感谢您的回答!
【解决方案2】:

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

【讨论】:

  • 在 ./update.sh 之后,使用 . ~/torch/install/bin/torch-activate 激活火炬
【解决方案3】:

torch 似乎不支持 CUDA 10。降级到 CUDA 9.1

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

【讨论】:

    【解决方案4】:

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

    将 CMAKE 升级到 3.12 对我有用。

    安装指南:

    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
    

    【讨论】:

    • 请在您的回答中解释教程
    猜你喜欢
    • 2022-11-28
    • 2022-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多