How to build cross-compilation of sample code including ROS?


For cross-compilation, can we build sample code with ROS include need?



Let me more precisely description, for example,

We want to modify DriveNet sample code in
–> samples\src\drivenet\main.cpp
and include ROS functionality in order to publish ROS topic

But because in PX2 target can’t build this sample code, it must be cross-compilation in PC side,
So our question is

  1. How to use cross-compilation in PC side to build this modified DriveNet sample code with ROS including?
  2. (or) Whether any method can achieve building this modified DriveNet sample code with ROS including?

Any suggestion we will appreciate very much!

Many Thanks


Have you found ways to cross-compile ros? We actually installed opencv and ros on PX2, and compile the sample camera code directly on PX2. This is definitely not the best solution because I have to copy required dw libraries to PX2, but it works at the moment.

Dear vincenttang, WZhouuuu

Could you please let me now the core ROS framework is indeed what you’re looking to cross-compile? Thanks.


Hope it will help.

I tried to use cross-compiler for Drive PX2 development and, of course, were faced with needs to cross-compile large amount of third party code. That is annoying.

To avoid compilation on Drive PX2 device I built a docker image from vibrante-t186ref-linux/targetfs (you may use chroot instead but I think it is not so convenient), installed qemu-user-static into image from host (also install binfmt_misc for host system) and other missing headers and libraries (look at vibrante-t186ref-linux/lib-target, vibrante-t186ref-linux/include and /etc/init.d in the image), and use it as image for building a code. You may install any build dependencies which are available in arm64 ubuntu distro using apt-get. Also look at CMake toolchain file from samples, you will need a couple of macros defined like VIBRANTE and VIBRANTE_V4L.

@nevermoreao4sv are you able to provide some more information on how you built the container? I’m creating a .tar of the image and trying to run that but docker is complaining since some docker-specific information does not exist in the image. I need a way to ‘initialize’ the targetfs so that docker can use it.

The specific error I’m getting on running the image I created:

standard_init_linux.go:190: exec user process caused “no such file or directory”