building opencv4.0.0 on nano failed with make at [ 98%] Built target opencv_stitching

I followed this script:
https://github.com/AastaNV/JEP/blob/master/script/install_opencv4.0.0_Nano.sh

problem happened at sudo make -j2

[ 96%] Building NVCC (Device) object modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o
[ 97%] Built target opencv_cudaobjdetect
[ 98%] Built target opencv_stitching
In file included from /usr/local/opencv-4.0.0/modules/core/include/opencv2/core/cuda/functional.hpp:50:0,
from /usr/local/opencv_contrib-4.0.0/modules/cudaoptflow/src/cuda/pyrlk.cu:47:
/usr/local/cuda/include/device_functions.h:54:2: warning: #warning “device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.” [-Wcpp]
#warning “device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.”
^~~~~~~
In file included from /usr/local/opencv-4.0.0/modules/core/include/opencv2/core/cuda/functional.hpp:50:0,
from /usr/local/opencv_contrib-4.0.0/modules/cudaoptflow/src/cuda/pyrlk.cu:47:
/usr/local/cuda/include/device_functions.h:54:2: warning: #warning “device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.” [-Wcpp]
#warning “device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.”
^~~~~~~
In file included from /usr/local/opencv-4.0.0/modules/core/include/opencv2/core/cuda/functional.hpp:50:0,
from /usr/local/opencv_contrib-4.0.0/modules/cudaoptflow/src/cuda/pyrlk.cu:47:
/usr/local/cuda/include/device_functions.h:54:2: warning: #warning “device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.” [-Wcpp]
#warning “device_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.”
^~~~~~~
Killed
CMake Error at cuda_compile_1_generated_pyrlk.cu.o.RELEASE.cmake:281 (message):
Error generating file
/usr/local/opencv-4.0.0/release/modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_pyrlk.cu.o

modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/build.make:676: recipe for target ‘modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o’ failed
make[2]: *** [modules/cudaoptflow/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_pyrlk.cu.o] Error 1
CMakeFiles/Makefile2:9941: recipe for target ‘modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all’ failed
make[1]: *** [modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow.dir/all] Error 2
Makefile:162: recipe for target ‘all’ failed
make: *** [all] Error 2

this is my camke script:

sudo cmake -D WITH_CUDA=ON
-D CUDA_ARCH_BIN=“5.3”
-D CUDA_ARCH_PTX=“”
-D OPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib-4.0.0/modules
-D WITH_GSTREAMER=ON
-D WITH_LIBV4L=ON
-D BUILD_opencv_python2=ON
-D BUILD_opencv_python3=ON
-D BUILD_TESTS=OFF
-D BUILD_PERF_TESTS=OFF
-D BUILD_EXAMPLES=OFF
-D OPENCV_ENABLE_NONFREE=ON
-D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local …

Hi vxking,

I got the same error, did you figure it out a fix?

Best regards,

Sjoerd