PX2 cross-compile problems with toolchain

Hi there,

I’m facing problems with cross-compiling on my host pc. I followed all steps from development guide to install SDK5.0.5.0bL on my host pc with ubuntu16.04LTS system. And I also followed the guide to set up environment. My cross-compile command is like this:

$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=/usr/local/driveworks-0.6/samples/cmake/Toolchain-V4L.cmake
-DVIBRANTE_PDK:STRING=/home/adas/NVIDIA/Drive/5050bL_SDK/DriveSDK/drive-t186ref-linux
/usr/local/driveworks-0.6/samples/
$ make -j
$ make install

when I execute my cmake command, the results looks like this:

– The C compiler identification is GNU 5.4.0
– The CXX compiler identification is GNU 5.4.0
– 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
– Found CUDA: /usr/local/cuda (found version “9.0”)
– 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 TensorRT:
– - Includes: /usr/local/nvidia/tensorrt/targets/x86_64-linux-gnu/include
– - Libraries: /usr/local/nvidia/tensorrt/targets/x86_64-linux-gnu/lib/libnvinfer.so;/usr/local/nvidia/tensorrt/targets/x86_64-linux-gnu/lib/libnvcaffe_parser.so
– Found libcudnn:
– - Includes: /usr/local/cuda/targets/x86_64-linux/include
– - Libraries: /usr/local/cuda/targets/x86_64-linux/lib/libcudnn.so
– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
– Looking for gethostbyname
– Looking for gethostbyname - found
– Looking for connect
– Looking for connect - found
– Looking for remove
– Looking for remove - found
– Looking for shmat
– Looking for shmat - found
– Looking for IceConnectionNumber in ICE
– Looking for IceConnectionNumber in ICE - found
– Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
– Driveworks Samples install dir: /usr/local/driveworks-0.6/samples/build/install
– Driveworks found at: /usr/local/driveworks-0.6/targets/x86_64-linux
– Found Driveworks
– Configuring done
– Generating done
– Build files have been written to: /usr/local/driveworks-0.6/samples/build


I looks weird because there is no PDK package information and it didn’t actually execute Toolchain-V4L.cmake. After we type make -j it shows:


[ 45%] Building CXX object src/sensors/camera_pointgrey/CMakeFiles/sample_camera_pointgrey.dir/main.cpp.o
[ 45%] Building CXX object src/sensors/camera_pointgrey/CMakeFiles/sample_camera_pointgrey.dir/ResourceManager.cpp.o
[ 46%] Building CXX object src/laneDetection/laneDetection_common/CMakeFiles/dw_samples_laneDetection_common.dir/LaneDetectionCommon.cpp.o
[ 48%] Building CXX object src/template/CMakeFiles/sample_template.dir/main.cpp.o
[ 47%] Building CXX object src/sensors/lidar/lidar_replay/CMakeFiles/sample_lidar_replay.dir/main.cpp.o
[ 49%] Building CXX object src/rectifier/CMakeFiles/sample_video_rectifier.dir/main.cpp.o
[ 49%] Building CXX object src/sensors/lidar/lidar_replay/CMakeFiles/sample_lidar_replay.dir/userInput.cpp.o
[ 49%] Linking CXX executable sample_rig_configuration
[ 49%] Linking CXX executable sample_hello_world
[ 50%] Linking CXX executable sample_imu_logger
[ 51%] Linking CXX executable sample_renderer
/usr/bin/ld: warning: libcuda.so.1, needed by /usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libnvcuvid.so.1, needed by /usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so, not found (try using -rpath or -rpath-link)
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidParseVideoData’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidCreateDecoder’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidCreateVideoSource’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidCreateVideoParser’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuDeviceGet’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidGetSourceVideoFormat’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidDestroyVideoSource’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidMapVideoFrame64’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidDestroyDecoder’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuInit’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuGetErrorString’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidDecodePicture’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidUnmapVideoFrame64’未定义的引用
/usr/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuCtxGetCurrent’未定义的引用
/usr[ 52%] Linking CXX executable sample_third_party_camera
/local/driveworks-0.6/targets/x86_64-linux/lib/libdriveworks.so:对‘cuvidDestroyVideoParser’未定义的引用
collect2: error: ld returned 1 exit status
src/rigconfiguration/CMakeFiles/sample_rig_configuration.dir/build.make:109: recipe for target ‘src/rigconfiguration/sample_rig_configuration’ failed
make[2]: *** [src/rigconfiguration/sample_rig_configuration] Error 1
CMakeFiles/Makefile2:1263: recipe for target ‘src/rigconfiguration/CMakeFiles/sample_rig_configuration.dir/all’ failed
make[1]: *** [src/rigconfiguration/CMakeFiles/sample_rig_configuration.dir/all] Error 2
make[1]: *** 正在等待未完成的任务…


we found that the environment is still under x86_64 but not under arm64, does anyone can help me with this question? I’ve followed all steps from guide and instructions. Did I miss any important details?

Dear hui_luan,

Could you please refer to below links for your topic? Thanks.

https://devtalk.nvidia.com/default/topic/1014969/-resolved-make-j-fails-on-crosscompilation-drivework-sample/
https://devtalk.nvidia.com/default/topic/1002539/general/drive-px2-cross-compile-failed-using-host-pc/

Thanks Steven!

The problem is solved. We just followed the first link’s “finish CUDA environment set up” and everything works!