Cross compilation driveworks + OpenCV +Cuda

How to cross compile driveworks sdk + opencv + cuda?

I added Opencv Cuda functions in some of the driveworks sdk samples, and I am willing to cross compile the modified samples.

The following are the steps I have tried.

  1. Cross compile opencv with cuda enabled.

I added the following cmake command for cross compilation.

cmake -DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=opencv/platforms/linux/aarch64-gnu.toolchain.cmake
-DVIBRANTE_PDK:STRING=/path/to/drive-t186ref-qnx
/path/to/driveworks/samples/folder …

  1. Add opencv libraries in CMakeLists.txt under the driveworks sdk samples folder.

  2. Cross compile the samples with the following cmake command
    cmake -DCMAKE_BUILD_TYPE=Release
    -DCMAKE_TOOLCHAIN_FILE=/path/to/driveworks/samples/cmake/Toolchain-V5Q.cmake
    -DVIBRANTE_PDK:STRING=/path/to/drive-t186ref-qnx
    /path/to/driveworks/samples/folder …

I got the following errors at the 3rd step.

/nvidia/nvidia_sdk/DRIVE_Software_9.0_Linux_hyperion_E3550/DriveSDK/toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/…/…/libexec/aarch64-gnu-linux/gcc/aarch64-gnu-linux/4.9.4/ld: /opencv/build/lib/libopencv_core.a(stl.cpp.o): Relocations in generic ELF (EM: 62)

Can anyone help me on these problems? Thank you!!!

Dear yz176,

Can I know you are DrivePX2 user or DriveAGX user?
And from what you said, it sounds like you’re using QNX, right?

I am using ubuntu 16.04 on the host machine.

And I am DriveAGX user.

Thank you!

Dear yz176,

Thank you for your update.
One more question, according to the log, it looks like you are trying to compile with the QNX Tool chain and QNX OS. Is that right?

[i]-DVIBRANTE_PDK:STRING=/path/to/drive-t186ref-qnx \

-DCMAKE_TOOLCHAIN_FILE=/path/to/driveworks/samples/cmake/Toolchain-V5Q.cmake
-DVIBRANTE_PDK:STRING=/path/to/drive-t186ref-qnx [/i]

There is something wrong with my initial post. I used Toolchain-V5L.cmake, instead of Toolchain-V5L.cmake.

cmake -DCMAKE_BUILD_TYPE=Realease
-DCMAKE_TOOLCHAIN_FILE=/path/to/Toolchain-V5L.cmake
-DVIBRANTE_PDK:STRING=/path/to/drive-t186ref-linux
-DCMAKE_PREFIX_PATH=/path/to/3rdparty/linux-aarch64

I am trying to compile with Linux toolchain and GNU/linux OS.

The cross compilation works with the settings for driveworks itself. But it does not work together with cuda enbaled opencv.

Thank you!

Dear yz176,

Thank you for clarification.

Can you tell me what kind of features you have on OpenCV?
Because there are source codes in DriveWorks that can implement many various functions.
I’d like to know if there’s anything missing in what you’re trying to implement. Thanks.

Thank you, Steve,

I got it work. It was because of the cross compilation of cuda + opencv.