How to build sample code on Drive PX2 target?


In SDK provide sample code, can we directly build this code in PX2 target?


Hello vincenttang,
Unfortunately it’s not possible to build directly in DPX2. Please use cross-compile on Host machine. Thanks.

Are there examples provided that help you set up your development environment in order to build your first “hello world” program that can run on the DPX2?

Hello, why it can’t build directly on PX2?

It seems there are toolchains in the PX2, like gcc-linaro and so on, if I install other components needed, then can I compile the samples on the PX2?



I think that is because a few developer packages are not available on DPX2. For example, there are no NvMedia headers. Since I need a lot of third party packages and I am tired of cross-building them, I use docker based on targetfs snapshot with all missing components installed + QEMU.

Hi nevermoreao4sv,

your solution sounds very interesting for me.
Could you please describe this in more details, as we have a lot off troubles with the cross compiler as well and wand to try out a different version.
Does your docker solution have access to the gmsl camera and can bus sensors?

Hi johann.haselberger,

AFAIK, nvidia-docker is not available for DPX2 so sensors are not available inside the docker (tested). Sad. That is why I use docker for building only (docker is much convenient than chroot). Then I scp binaries to the DPX2 and run. To avoid dependency problems I build .deb package and install it on DPX2.

Note, when I were discovering docker for DPX2 I found that there are some tricks and hacks which makes sensor bus to be available inside the docker but I didn’t test them. You may google it if necessary.


Is still impossible to build sample from DPX2?

If yes i have difficulties to setup the host machine: CUDA Toolkit 9.2 doesn’t want to install the drivers: “It appears that an x server is running. Please exit x before installation. If you’re sure that an x is not running, but are getting this error, please delete any x lock file in /tmp”


Unfortunately it is not possible to build Driveworks samples on PX2 directly. BTW, Drive 5.0.5 has CUDA 9.0. Did you check the cross compilation steps/requirements given at file:///usr/local/driveworks-0.6/doc/nvdwx_html/dwx_samples_building.html. To run the samples on Host machine, you need to set up CUDA correctly. You can check disabling x server(sudo service lightdm stop) before installing CUDA drivers.