Cross compiling OpenCV 3.4.0 failed on PX2

I tried to cross compiled OpenCV 3.4.0 on PX2 following this site:
https://devtalk.nvidia.com/default/topic/1032772/faq/cross-compiling-opencv-3-4-0-on-pdk-5-0-5-0/
I don’t know where to download PDK,then I used my SDK(5.0.5.0.a).

I copied these commonds:

cmake -DCMAKE_BUILD_TYPE=Release -DVIBRANTE_PDK:STRING=<path to vibrante-t186ref-linux> -DCMAKE_TOOLCHAIN_FILE=/usr/local/driveworks/samples/cmake/Toolchain-V4L.cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_PNG=ON -DBUILD_TIFF=ON -DBUILD_TBB=OFF -DBUILD_JPEG=ON -DBUILD_JASPER=ON -DBUILD_ZLIB=ON -DBUILD_EXAMPLES=ON -DBUILD_FFMPEG=ON -DBUILD_opencv_java=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DENABLE_NEON=ON -DWITH_OPENCL=OFF -DWITH_OPENMP=OFF -DWITH_FFMPEG=ON -DWITH_GSTREAMER=OFF -DWITH_GSTREAMER_0_10=OFF -DWITH_CUDA=ON -DWITH_GTK=OFF -DWITH_VTK=OFF -DWITH_TBB=OFF -DWITH_1394=OFF -DWITH_OPENEXR=OFF -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.0 -DCUDA_64_BIT_DEVICE_CODE=ON -DCUDA_ARCH_BIN=6.2 -DCUDA_ARCH_PTX="" -DINSTALL_C_EXAMPLES=ON -DINSTALL_TESTS=OFF -DVIBRANTE=TRUE VERBOSE=1 -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata ..

and changed some codes in my host PC like this:

# -DVIBRANTE_PDK:STRING=<path to vibrante-t186ref-linux>
-DVIBRANTE_PDK:STRING=/home/server/NVIDIA/Drive/5050aL_SDK/DriveSDK/drive-t186ref-linux 
# -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata
-DOPENCV_TEST_DATA_PATH=/home/server/opencv/opencv_extra/testdata

Then it reported an error:

CMake Error: The source directory "/home/server/opencv/opencv/build/VERBOSE=1" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

I deleted this command and tried again:

VERBOSE=1

It reported another error:

CMake Error: The source directory "/home/server/opencv/opencv/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

Is this error related to that I didn’t use PDK for cross compiling? If so, can you tell me where to download PDK? If it doesn’t matter, what else caused this error?Thanks.

Could anyone help me to solve this problem?

I REALLY need to cross compile OpenCV.

Thanks.

Dear 949707878,

You can download the latest PDK @ https://developer.nvidia.com/nvidia-drive-downloads Thanks.

Dear SteveNY,

Thanks for your reply.

I did as your words and ran the latest version(DriveInstall 5.0.5.0b), but i can not download any packages basing on it. It will try 10 times to download each package then show as below:

Error:Component is missing

Though I use other host PCs and change my internet connection, unfortunately it did not work. And we have been already under this situation for some days.

Could you give me a Link which i can download all packages i need directly.

Thank you.

Best Regard

Dear 949707878,
Please check if it has issue with internet proxy. You should be able to download without any issue if you connected to internet directly. Before that, Can you double check the cross compilation instructions? The error CMake Error: The source directory “/home/server/opencv/opencv/build” does not appear to contain CMakeLists.txt makes me suspicious that you forgot to add … in the end of cmake command. Also, check if you are the cmake command from build folder

Dear SteveNY,

thank you for your suggestion and I very appreciate that!

However, when I ran cmake command, another error reported:

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_nppi_LIBRARY (ADVANCED)
    linked by target "opencv_cudev" in directory /home/server/opencv/opencv/modules/cudev
    linked by target "opencv_cudev" in directory /home/server/opencv/opencv/modules/cudev
    linked by target "opencv_core" in directory /home/server/opencv/opencv/modules/core
    linked by target "opencv_core" in directory /home/server/opencv/opencv/modules/core
    linked by target "opencv_test_core" in directory /home/server/opencv/opencv/modules/core
    linked by target "opencv_perf_core" in directory /home/server/opencv/opencv/modules/core
    .
    .
    .
    
-- Configuring incomplete, errors occurred!

To solve this problem, I checked my FindCUDA.cmake file following this site:
https://devtalk.nvidia.com/default/topic/1032172/faq/drivepx2-opencv3-cuda9-patch/

I found the codes in local FindCUDA.cmake is the same with your patch and make sure the cmake command is from build folder. How can I solve this problem?

Thanks!

Dear 949707878,

Did you apply the patch file like below?
$patch –p1 < patch file
$path –p1 < px2_opencv3_cuda9.patch

Hello SteveNV,

i believe i have already change the original codes in my FindCUDA.cmake however it does not work.

and then i take your advice and install this patch following what you wrote. Every time after i applied the command: patch -p1 < FindCUDA.cmake( i download from your website), i see **** only garbage was found in this patch. naja, i do not how to solve it…

can you give me some other advice?

Thank you