参考另一篇文章cnn-crf-stereo测试-----imageutilities安装编译方法
slackprop安装作者主页上说的,本以为会顺利进行,然后又有错误,醉啦醉啦
cd dependencies/slackprop
mkdir build
cd build
cmake ..
make
cd ../../
执行了cmake ..之后出现下面的错误:
CMake Error at CMakeLists.txt:33 (find_package):
实际原因是没有找到 ImageUtilities_DIR路径,为什么我在~/.bashrc设置的不行,哪位大佬能告诉我原因呢。设置的内容包括cuda路径和imageutilities路径By not providing "FindImageUtilities.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "ImageUtilities", but CMake did not find one. Could not find a package configuration file provided by "ImageUtilities" with any of the following names: ImageUtilitiesConfig.cmake imageutilities-config.cmake Add the installation prefix of "ImageUtilities" to CMAKE_PREFIX_PATH or set "ImageUtilities_DIR" to a directory containing one of the above files. If "ImageUtilities" provides a separate development package or SDK, be sure it has been installed. -- Configuring incomplete, errors occurred! See also "/home/jennifer/cnn-crf-stereo-master/dependencies/slackprop/build/CMakeFiles/CMakeOutput.log". jennifer@jennifer-pc:~/cnn-crf-stereo-master/dependencies/slackprop/build$
解决方法:找到ImageUtilitiesConfig.cmake,手动设置ImageUtilities_DIR的路径。
if(WIN32) string(REPLACE "\\" "/" CUDA_SDK_ROOT_DIR $ENV{CUDA_SDK_ROOT_DIR}) string(REPLACE "\\" "/" IMAGEUTILITIES_ROOT $ENV{IMAGEUTILITIES_ROOT}) else(WIN32) set(CUDA_SDK_ROOT_DIR "/usr/local/cuda/samples/") set(IMAGEUTILITIES_ROOT "/home/jennifer/cnn-crf-stereo-master/dependencies/imageutilities") endif(WIN32)
×××××××××××××××××××××××××××
整个结果:
jennifer@jennifer-pc:~/cnn-crf-stereo-master/dependencies/slackprop/build$ sudo cmake ..
-- The C compiler identification is GNU 5.4.1
-- The CXX compiler identification is GNU 5.4.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found suitable version "8.0", minimum required is "5.0")
COMPILER FLAGS:
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- BUILD_SHARED_LIBS: ON
-- CMAKE_C_FLAGS=
-- CMAKE_CXX_FLAGS = -std=c++11 -fPIC -fmax-errors=3 -fpermissive -ggdb -Wunused-result -Wno-unused-variable -Wno-unused-value -Wno-unused-but-set-variable -Wdisabled-optimization -Wdiv-by-zero -Wc++11-compat -Wno-float-equal -fopenmp -O2 -DPARALLEL -ffast-math -DNDEBUG
-- CMAKE_CXX_FLAGS_RELEASE = -O3 -DNDEBUG
-- CUDA_NVCC_FLAGS= -arch=sm_30;-expt-extended-lambda;-ftemplate-backtrace-limit=2;-lineinfo;-std=c++11;-Xcompiler=-Wno-sign-compare;-O2;-keep;-src-in-ptx;-DNDEBUG;-Xptxas=-warn-lmem-usage;-Xptxas=-warn-spills
-- CUDA_PROPAGATE_HOST_FLAGS= OFF
-- COMPILE_DEFINITIONS =
-- Imageutilities requested components: iucore;ndarray
-- Found Imageutilities: /home/jennifer/cnn-crf-stereo-master/dependencies/imageutilities/lib /home/jennifer/cnn-crf-stereo-master/dependencies/imageutilities/include;/usr/local/cuda/samples/common/inc
COMPILER FLAGS:
-- CMAKE_CXX_FLAGS= -std=c++11 -fPIC -fmax-errors=3 -fpermissive -ggdb -Wunused-result -Wno-unused-variable -Wno-unused-value -Wno-unused-but-set-variable -Wdisabled-optimization -Wdiv-by-zero -Wc++11-compat -Wno-float-equal -fopenmp -O2 -DPARALLEL -ffast-math -DNDEBUG --std=c++11
-- CUDA_NVCC_FLAGS= -arch=sm_30;-expt-extended-lambda;-ftemplate-backtrace-limit=2;-lineinfo;-std=c++11;-Xcompiler=-Wno-sign-compare;-O2;-keep;-src-in-ptx;-DNDEBUG;-Xptxas=-warn-lmem-usage;-Xptxas=-warn-spills
-- CUDA_PROPAGATE_HOST_FLAGS= OFF
INCLUDE:
-- dir='/home/jennifer/cnn-crf-stereo-master/dependencies/slackprop/src'
-- dir='/home/jennifer/cnn-crf-stereo-master/dependencies/imageutilities/src'
-- dir='/home/jennifer/cnn-crf-stereo-master/dependencies/imageutilities/include'
-- dir='/usr/local/cuda/samples/common/inc'
-- my_cuda_add_library(slack_prop,[src/slp_driver.cppsrc/slp_kernel.cu])
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jennifer/cnn-crf-stereo-master/dependencies/slackprop/build
jennifer@jennifer-pc:~/cnn-crf-stereo-master/dependencies/slackprop/build$ sudo make -j4
[ 33%] Building NVCC (Device) object CMakeFiles/slack_prop.dir/src/slack_prop_generated_slp_kernel.cu.o
ptxas warning : Local memory used for function '_Z9work_packib'
ptxas warning : Registers are spilled to local memory in function '_Z9work_packib'
ptxas warning : Local memory used for function '_Z11unrolled_smi'
ptxas warning : Registers are spilled to local memory in function '_Z11unrolled_smi'
ptxas info : 16 bytes gmem, 45256 bytes cmem[3]
ptxas info : Compiling entry function '_Z11handshake_kif' for 'sm_30'
ptxas info : Function properties for _Z11handshake_kif
0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info : Used 55 registers, 328 bytes cmem[0], 4 bytes cmem[2]
ptxas info : Compiling entry function '_Z9work_packib' for 'sm_30'
ptxas info : Function properties for _Z9work_packib
16 bytes stack frame, 8 bytes spill stores, 8 bytes spill loads
ptxas info : Used 63 registers, 325 bytes cmem[0], 4 bytes cmem[2]
ptxas info : Compiling entry function '_Z11unrolled_smi' for 'sm_30'
ptxas info : Function properties for _Z11unrolled_smi
584 bytes stack frame, 664 bytes spill stores, 1008 bytes spill loads
ptxas info : Used 63 registers, 3584 bytes smem, 324 bytes cmem[0], 16 bytes cmem[2]
Scanning dependencies of target slack_prop
[ 66%] Building CXX object CMakeFiles/slack_prop.dir/src/slp_driver.cpp.o
/home/jennifer/cnn-crf-stereo-master/dependencies/slackprop/src/slp_driver.cpp: In member function ‘const ndarray_ref<int, 2>& slack_prop_2D::get_sol(int) const’:
/home/jennifer/cnn-crf-stereo-master/dependencies/slackprop/src/slp_driver.cpp:699:26: warning: returning reference to temporary [-Wreturn-local-addr]
return sols.subdim<2>(s);
^
[100%] Linking CXX shared library libslack_prop.so
[100%] Built target slack_prop
jennifer@jennifer-pc:~/cnn-crf-stereo-master/dependencies/slackprop/build$ cd ../../
jennifer@jennifer-pc:~/cnn-crf-stereo-master/dependencies$