【问题标题】:caffe cmake error by ccacheccache的caffe cmake错误
【发布时间】:2016-11-14 13:32:18
【问题描述】:

当我成功地“cmake ..” caffe 构建时,我执行了“make all”命令,但在下面出现了错误。不知道是NVCC还是gcc有问题。

[  1%] Built target proto
[  1%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_split_layer.cu.o
/usr/bin/ccache: invalid option -- 'E'
Usage:
ccache [options]
ccache compiler [compiler options]
compiler [compiler options]          (via symbolic link)

Options:
-c, --cleanup         delete old files and recalculate size counters
                      (normally not needed as this is done automatically)
-C, --clear           clear the cache completely
-F, --max-files=N     set maximum number of files in cache to N (use 0 for
                      no limit)
-M, --max-size=SIZE   set maximum size of cache to SIZE (use 0 for no
                      limit; available suffixes: G, M and K; default
                      suffix: G)
-s, --show-stats      show statistics summary
-z, --zero-stats      zero statistics counters

-h, --help            print this help text
-V, --version         print version and copyright information

See also <http://ccache.samba.org>.
CMake Error at cuda_compile_generated_split_layer.cu.o.cmake:206 (message):
Error generating
/home/gpuusr/lpq/caffe-332/build/src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_split_layer.cu.o


make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_split_layer.cu.o] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

【问题讨论】:

  • 正如它所说,ccmake没有-E选项,如果您发布相应的CMakeLists.txt会很有趣。

标签: gcc cmake deep-learning caffe


【解决方案1】:

这曾经是 CMake 中的一个错误。它已在 CMake 版本 3.4.0 中修复。

证明

here 的代码可以用下面的CMakeLists.txt 编译。

cmake_minimum_required (VERSION 2.8.9 FATAL_ERROR)
project(CudaTest)

find_package(CUDA REQUIRED)
cuda_add_executable(hello_cuda hello.cu)
  • /usr/lib/ccachePATH 上。
  • 使用 CMake 3.2 构建一次,使用 CMake 3.7.1 构建一次。
  • CMake 3.2:

    $ make
    ...
    /path/to/build-3.2
    [100%] Building NVCC (Device) object CMakeFiles/hello_cuda.dir/hello_cuda_generated_hello.cu.o
    /usr/bin/ccache: invalid option -- 'E'
    ...
    
  • CMake 3.7.1:

    $ make
    [ 50%] Building NVCC (Device) object CMakeFiles/hello_cuda.dir/hello_cuda_generated_hello.cu.o
    [100%] Linking CXX executable hello_cuda
    [100%] Built target hello_cuda
    

备案

一个小的 git bisect 在 CMake 3.2.2 -- 3.7.1 上运行表明这是修复它的提交:

commit b405f01daaeaeda98d448e2f0d71ea685757a5bd
Author: Bill Hoffman <bill.hoffman@kitware.com>
Date:   Fri Jun 12 14:16:09 2015 -0400

    FindCUDA: Resolve a host compiler symlink only if it is Apple cc - clang

    Otherwise using a "cc -> ccache" or similar symlink as the compiler
    causes FindCUDA to select ccache as the host compiler.  Update the logic
    added by commit v3.1.0-rc1~354^2 (FindCUDA: Fix OSX Clang & no C
    language enabled, 2014-06-12) to apply only in the specific case it is
    needed.

此提交进入 CMake 3.4.0。比较 git rev-list v3.4.0 | grep b405f01git rev-list v3.3.2 | grep b405f01

【讨论】:

  • 我在 cmake 3.6.2 中看到了这个错误。也许那个版本有回归?
【解决方案2】:

我在尝试构建具有 CUDA 支持的 OpenCV 时遇到了类似的问题。我不明白 CMake、CUDA 和 ccache 之间有一些奇怪的交互,它试图用无效的参数调用 ccache。您可以通过为 CUDA 指定系统编译器来绕过此问题:

cmake -DCUDA_HOST_COMPILER=/usr/bin/g++ ..

(或您正在使用的任何编译器。)

【讨论】:

  • 添加到这个答案:如果你想在 cuda 步骤中使用 ccache,请改用这一行:cmake -DCUDA_HOST_COMPILER=/usr/lib/ccache/g++
猜你喜欢
  • 2010-12-21
  • 1970-01-01
  • 1970-01-01
  • 2015-05-25
  • 2018-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多