# Cross Compiling Driveworks on the PX2 with ROS

**URL:** https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375
**Category:** General
**Created:** [May 30, 2017, 9:35pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375 "2017-05-30T21:35:54Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [May 30, 2017, 9:35pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/1 "2017-05-30T21:35:54Z")

</div>

What is the normal setup for cross compiling ros nodes that use the Driveworks platform for the Drive PX2?  
I am currently trying to cross compile ros-kinetic from source using the cmake toolchain file provided in the Driveworks samples and working through boost dependency issues.  
Earlier responses to posts about ros hinted that Nvidia was working on a guide for using ros with the PX2. What is its status? Are you waiting for the cross compiling setup to be migrated to 16.04? If a draft of this was available I would be willing to test it and give feedback.

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [June 7, 2017, 4:42pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/2 "2017-06-07T16:42:17Z")

</div>

I ended up getting all the way past cross compiling python and boost. However once ros started linking against python libraries there is an error “final link failed: Nonrepresentable section on output”

I am hoping there will be a guide for this soon as cross compiling each individual dependency seems to be very error prone and time consuming. There has to be a better way…

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [June 9, 2017, 7:33pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/3 "2017-06-09T19:33:55Z")

</div>

Is there a general strategy for how to compile ros binaries that link in some driveworks binaries? I don’t need a guide just a better strategy for how to do this.

---

<div class="post-metadata">

### Author: ![SteveNV](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/stevenv/32/14043_2.png) [@SteveNV](https://forums.developer.nvidia.com/u/SteveNV)
#### Post date: [June 12, 2017, 1:24am UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/4 "2017-06-12T01:24:58Z")

</div>

Hello llorenzds,

Please refer to below to install ROS-Kinetic on DPX2.

1. Install the PDK and flash the target build onto the board as described in the PDK Developer’s Guide

2. Boot to Ubuntu Unity Desktop  
Note: Do not perform “apt-get upgrade” on the target, at any stage

3. Via Ubuntu GUI, configure Ubuntu to allow package installation from main, restricted, universe and multiverse repositories

4. Setting locale:  
(This is optional. Setting locales explicitly to either of the options mentioned may cause some issues with launching the terminal after a system reboot. So, this step may be skipped in the first try)  
sudo update-locale LANG=C LANGUAGE=C LC\_ALL=C LC\_MESSAGE=POSIX  
(or)  
export LANGUAGE=en\_US.UTF-8  
export LANG=en\_US.UTF-8  
export LC\_ALL=en\_US.UTF-8  
sudo locale-gen en\_US.UTF-8  
sudo dpkg-reconfigure locales

5. Setup the keys to authenticate package downloads  
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

6. Open the ‘Software & Updates’ applet and add  
deb [http://packages.ros.org/ros/ubuntu](http://packages.ros.org/ros/ubuntu) xenial main

7. Update the libssl1.0.0 package to the latest version [1.0.2g-1ubuntu4.6]and install libssl-dev  
sudo apt-get install libssl1.0.0/xenial libssl-doc/xenial libssl-dev/xenial

8. Install the ‘Desktop’ bundle of ROS (contains the ROS Core Framework, plus a set of popular algorithms and sample apps)  
sudo apt-get install ros-kinetic-desktop

9. After successful installation of ROS, set up the environment so that the terminal recognizes ROS.  
echo “source /opt/ros/kinetic/setup.bash” \>\> ~/.bashrc  
source ~/.bashrc

10. Set the library search path for the current shell  
export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/usr/lib:/usr/lib/aarch64-linux-gnu

11. Run some ROS sample apps to verify install success. For example:  
VISUALIZING THE ROS TURTLESIM APP WITH RVIZ

---

<div class="post-metadata">

### Author: ![tinokl](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tinokl](https://forums.developer.nvidia.com/u/tinokl)
#### Post date: [June 12, 2017, 12:04pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/5 "2017-06-12T12:04:12Z")

</div>

hi llorenzds,

i believe its not necessary to cross compile all along ros and driveworks.  
It should be enough to cross compile nvidia libs and later link them accordingly to ROS pkgs.

So in the final process you just run catkin\_make on the target and link the required libs against.

Please correct me if i am wrong here.

FYI, I am also interessted in a proper setup here, especially for getting the gmsl cameras within ROS.

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [June 12, 2017, 12:58pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/6 "2017-06-12T12:58:57Z")

</div>

@SteveNV

Thanks for the info. I have a ros Kinetic setup on the Drive PX2 that works. I am just trying to figure out a good solution for linking in the Driveworks libraries with custom ros code.

@tinokl

I have been thinking along similar lines, especially since the Driveworks cross compiling setup is pretty complex. One test that I am working on today is seeing if I can compile a ros node natively on the Drive PX2 that links in one of the Driveworks libraries. As far as I can tell the Driveworks libraries already exist in the Drive PX2’s file system. I will try to keep this thread up to date with my setup, it would be nice to come up with a good solution to this.

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [June 13, 2017, 6:41pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/7 "2017-06-13T18:41:07Z")

</div>

@tinokl @SteveNV

I have managed to get a working wrapper around the driveworks lane detection binaries by developing on the drive px2. I will try to replicate this tomorrow on the second tegra of the px2, so that I can make a simple guide for this. Thanks for the help!

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [June 21, 2017, 5:48pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/8 "2017-06-21T17:48:20Z")

</div>

I was hoping to document this well but haven’t taken the time. Most of the configuration needed is in the CMakeLists. Here is a link to the changes I made, [CMakeList configuration for compiling ROS and Driveworks on a Tegra (Drive PX2) · GitHub](https://gist.github.com/linknum23/153c508f2610f4b4fd4fae39aa8f862b) I hope this helps.

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [August 4, 2017, 2:36pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/9 "2017-08-04T14:36:20Z")

</div>



---

<div class="post-metadata">

### Author: ![maxlein](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@maxlein](https://forums.developer.nvidia.com/u/maxlein)
#### Post date: [August 28, 2017, 7:11am UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/10 "2017-08-28T07:11:14Z")

</div>

I have a bit of problems using your CMake file…

The folder /usr/share/visionworks/sources/3rdparty/nvmedia/ doesn’t exist on my system!?  
I only found nvmedia headers and libs in VibranteSDK/vibrante-t186ref-linux, but system tells me they are incompatible.

Any suggestions?

My system is Ubuntu 16.04.3 LTS

Update:  
Think I am wrong trying to compile it on my host machine?  
Only possible on PX2 itself?

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [August 28, 2017, 4:05pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/11 "2017-08-28T16:05:00Z")

</div>

That setup is for compiling on the PX2 itself. It would have been much harder for me to get a cross compiling setup working.

---

<div class="post-metadata">

### Author: ![maxlein](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@maxlein](https://forums.developer.nvidia.com/u/maxlein)
#### Post date: [August 29, 2017, 11:18am UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/12 "2017-08-29T11:18:13Z")

</div>

Ok, thats annoying… ;)  
So you write your code on your notebook without compiling?  
Or do you just compile for x64 to see if any errors are present and then push the source to the PX2?

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [August 29, 2017, 12:11pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/13 "2017-08-29T12:11:31Z")

</div>

I just ssh into the px2 and compile. I use x forwarding to use my favorite ide after installing it on the px2.

---

<div class="post-metadata">

### Author: ![katharina.bachmann](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@katharina.bachmann](https://forums.developer.nvidia.com/u/katharina.bachmann)
#### Post date: [September 28, 2017, 8:08am UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/14 "2017-09-28T08:08:27Z")

</div>

I am trying to get the wrapper working to compile ROS with the Driveworks libraries included on the PX2 and changed the cmakelist according to [CMakeList configuration for compiling ROS and Driveworks on a Tegra (Drive PX2) · GitHub](https://gist.github.com/linknum23/153c508f2610f4b4fd4fae39aa8f862b)  
But I can not figure out this error message. Has anyone encountered a similar problem or has any suggestions?

/usr/bin/ld: /home/nvidia/catkin\_ws/src/pkg\_test/3rdparty/linux-aarch64/glfw-3.1.1/lib/libglfw3.a(x11\_window.c.o): undefined reference to symbol ‘XConvertSelection’  
/usr/lib/gcc/aarch64-linux-gnu/5/…/…/…/aarch64-linux-gnu/libX11.so: error adding symbols: DSO missing from command line  
collect2: error: ld returned 1 exit status  
pkg\_test/CMakeFiles/pkg\_test.dir/build.make:146: recipe for target ‘/home/nvidia/catkin\_ws/devel/lib/pkg\_test/pkg\_test’ failed  
make[2]: \*\*\* [/home/nvidia/catkin\_ws/devel/lib/pkg\_test/pkg\_test] Error 1  
CMakeFiles/Makefile2:825: recipe for target ‘pkg\_test/CMakeFiles/pkg\_test.dir/all’ failed  
make[1]: \*\*\* [pkg\_test/CMakeFiles/pkg\_test.dir/all] Error 2  
Makefile:138: recipe for target ‘all’ failed  
make: \*\*\* [all] Error 2  
Invoking “make -j6 -l6” failed

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [September 28, 2017, 2:57pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/15 "2017-09-28T14:57:35Z")

</div>

Have you tried building a simple project? This was used to create a wrapper around the lane detector that piped the lane detection results into ros. I didn’t ever use this to create anything that required a gui.

---

<div class="post-metadata">

### Author: ![katharina.bachmann](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@katharina.bachmann](https://forums.developer.nvidia.com/u/katharina.bachmann)
#### Post date: [October 3, 2017, 8:29am UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/16 "2017-10-03T08:29:25Z")

</div>

yes building simple projects is working but I can not figure out how to build one that includes a gui. Currently I am trying to get the cross compilation to work but I have not gotten too far with it yet. Has anyone a suggestion how it could work?

---

<div class="post-metadata">

### Author: ![mlandry](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mlandry](https://forums.developer.nvidia.com/u/mlandry)
#### Post date: [October 4, 2017, 3:53pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/17 "2017-10-04T15:53:24Z")

</div>

@SteveNV

I tried your procedure to install ROS Kinectic on my freshly flashed Drive PX2 and I get the following message at step 8 (sudo apt-get install ros-kinetic-desktop).

Reading package lists… Done  
Building dependency tree  
Reading state information… Done  
Some packages could not be installed. This may mean that you have  
requested an impossible situation or if you are using the unstable  
distribution that some required packages have not yet been created  
or been moved out of Incoming.  
The following information may help to resolve the situation:

The following packages have unmet dependencies:  
ros-kinetic-desktop : Depends: ros-kinetic-common-tutorials but it is not going to be installed  
Depends: ros-kinetic-geometry-tutorials but it is not going to be installed  
Depends: ros-kinetic-robot but it is not going to be installed  
Depends: ros-kinetic-ros-tutorials but it is not going to be installed  
Depends: ros-kinetic-visualization-tutorials but it is not going to be installed  
Depends: ros-kinetic-viz but it is not going to be installed  
E: Unable to correct problems, you have held broken packages.

Do you have any idea? I swear I did not perform “apt-get upgrade” on the target, at any stage… But I did perform a “apt-get update”.

---

<div class="post-metadata">

### Author: ![llorenzds](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@llorenzds](https://forums.developer.nvidia.com/u/llorenzds)
#### Post date: [October 4, 2017, 5:49pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/18 "2017-10-04T17:49:52Z")

</div>

@mlandry  
I would recommend removing ros-kinetic-desktop-full and installing ros-kinetic-base, along with the packages you actually need to run on the PX2. This will avoid your problems with the missing packages. Remember you want to use the PX2 as a compute platform not a normal laptop/desktop computer…  
Visualization tools like rviz can be run on a second computer on the same network as the PX2 with the roscore running on the PX2.

---

<div class="post-metadata">

### Author: ![mlandry](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mlandry](https://forums.developer.nvidia.com/u/mlandry)
#### Post date: [October 4, 2017, 6:16pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/19 "2017-10-04T18:16:35Z")

</div>

@llorenzds

Yeah I know I was just following the posted official procedure… I also tried ROS bare bone which gives me these dependencies problems instead… I have a Drive PX2 Autochauffeur with the Beta 1.0 PDK installed. I will try my luck by downloading and flashing the Alpha 2.0 PDK instead…

nvidia@tegra-ubuntu:~$ sudo apt-get install ros-kinetic-ros-base  
Reading package lists… Done  
Building dependency tree  
Reading state information… Done  
Some packages could not be installed. This may mean that you have  
requested an impossible situation or if you are using the unstable  
distribution that some required packages have not yet been created  
or been moved out of Incoming.  
The following information may help to resolve the situation:

The following packages have unmet dependencies:  
ros-kinetic-ros-base : Depends: ros-kinetic-actionlib but it is not going to be installed  
Depends: ros-kinetic-bond-core but it is not going to be installed  
Depends: ros-kinetic-class-loader but it is not going to be installed  
Depends: ros-kinetic-dynamic-reconfigure but it is not going to be installed  
Depends: ros-kinetic-nodelet-core but it is not going to be installed  
Depends: ros-kinetic-pluginlib but it is not going to be installed  
Depends: ros-kinetic-ros-core but it is not going to be installed  
E: Unable to correct problems, you have held broken packages.

---

<div class="post-metadata">

### Author: ![luis\_g\_riera](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@luis\_g\_riera](https://forums.developer.nvidia.com/u/luis_g_riera)
#### Post date: [October 8, 2017, 10:39pm UTC](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375/20 "2017-10-08T22:39:06Z")

</div>

Hi,

I was following SteveNV instruction on how to install ROS on the Drive PX2, and I get error message below after step 8.

```auto
sudo apt-get install ros-kinetic-desktop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ros-kinetic-desktop : Depends: ros-kinetic-viz but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

```

By the way, I added the deb repo using the command line:

```auto
sudo add-apt-repository 'deb http://packages.ros.org/ros/ubuntu xenial main'

```

as the ‘Software & Update’ GUI is giving me an error as well.

Any help.

[Next page](https://forums.developer.nvidia.com/t/cross-compiling-driveworks-on-the-px2-with-ros/50375.md?page=2)
