【问题标题】:How can I fix this "luarocks make" error when compiling a local torch7 package?编译本地torch7包时如何解决这个“luarocks make”错误?
【发布时间】:2016-06-28 10:42:36
【问题描述】:

我正在尝试从github spectral-lib(Ubuntu 14.04,cuda 7.0,安装了torch7)构建一个用torch7(C,cuda,lua)编写的包。我使用这个命令来构建它: luarocks make --local.

但是,出现了如下奇怪的错误:

...
Scanning dependencies of target spectralnet
[100%] Building CXX object CMakeFiles/spectralnet.dir/cuda/cufft.cpp.o
Linking CXX shared module libspectralnet.so
/usr/bin/ld: cannot find -lcufft
collect2: error: ld returned 1 exit status
make[2]: *** [libspectralnet.so] Error 1
make[1]: *** [CMakeFiles/spectralnet.dir/all] Error 2
make: *** [all] Error 2

我可以发现“libcufft.so”在/usr/local/cuda/lib64 中。 也许这个错误与CMakeLists.txt有关,但我不熟悉它。谁能帮帮我?

【问题讨论】:

  • 您的 LD_LIBRARY_PATH 环境变量是否设置为包含 /usr/local/cuda/lib64?
  • 您可能还想检查 libcufft.so 符号链接并确保它引用的是您实际安装在 lib64 中的 cuda fft 库版本。我看到它在驱动程序更新后偶尔会损坏。
  • 我的 LD_LIBRARY_PATH 有 /usr/local/cuda/lib64。无论如何,我通过修改 CMakeLists.txt 解决了这个问题。作者的 CMakeLists.txt 对我不起作用。
  • 很高兴听到这个消息。您应该发布您对 CMakeLists.txt 所做的修改作为答案,以防其他人将来遇到同样的问题。
  • @NicolasHolthaus,感谢您的帮助!

标签: cmake torch luarocks


【解决方案1】:

通过修改CMakeLists.txt解决。我将libcufft.so 复制到 ./cuda 并添加:

SET(PROJECT_LINK_LIBS libcufft.so )
LINK_DIRECTORIES(/net/wanggu/spectral-lib/cuda)

作者的CMakeLists.txt可能cuda动态库的方向有些问题。可能存在一些更好的解决方案,但这是暂时的解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-19
    • 1970-01-01
    • 2017-09-25
    • 2019-07-15
    • 1970-01-01
    • 1970-01-01
    • 2018-11-29
    • 1970-01-01
    相关资源
    最近更新 更多