Ask Your Question

Minimizing compiler memory, pcl_ros

asked 2011-02-23 23:23:27 -0500

tom gravatar image

updated 2014-01-28 17:09:13 -0500

ngrennan gravatar image


does anybody know, how to minimize the memory needed for gcc/g++ to compile a particular package? I'm trying to compile the pcl_ros package on a BeagleBoard-xM, but the compiler crashes each time because the cc1plus process is being killed due to low memory (BB-xM has 500MB of RAM). I've read a lot about this already, but found no solution. I've already been able to compile openni and flann (which also caused errors).

The only thing I'd like to try out and wasn't still able to is adding a "-finline-limit 600" (the number here may differ) compiler flag, as I don't know how to use the rosbuild_add_compile_flags(target flag) macro in case of flags with values.

Any help would be appreciated. I think being able to use Kinect on an ARM based board would be great and the effort is well worth it. Among small single board computers, ARM based boards cost 10 times less than, for instance, the AscTec Atom with similar capabilities.

Also, if anyone out there has got a PandaBoard and would like to check whether what I've found out so far works with it, please let know.

Cheers, Tom

edit retag flag offensive close merge delete


Tom, I've got an IGEPv2 board and would be interested in trying out your patches that got OpenNI to compile.
Eric Perko gravatar image Eric Perko  ( 2011-02-24 05:23:28 -0500 )edit
@Eric: I wrote a simple HowTo here: . It's still dirty, but worked all right.
tom gravatar image tom  ( 2011-02-24 21:12:33 -0500 )edit

6 Answers

Sort by ยป oldest newest most voted

answered 2011-02-23 23:41:42 -0500

Coming from an embedded systems background, when working with resource-limited embedded systems the usual solution is to cross-compile. You'd gain compilation speed (assuming your desktop has better specs than a 500MB-RAM Cortex ARM) as well as bypass memory problems like the one you're having.

The eros stack was started a while back to help get ROS onto more embedded systems. I'm not sure how far along it is, but there seems to be some helpful tutorials:

edit flag offensive delete link more

answered 2011-02-24 01:02:59 -0500

Daniel Stonier gravatar image

Jeff's right, if you're investing a serious amount of work in small cpu's (year long project or more), you'll drink far too much coffee waiting for your compiling to complete. Growing a beard and cross compiling can save you a tremendous amount of time.

If you've a toolchain, then eros has cross-compiling tools and support for at least the core ros packages. Getting everything to work all the way out to pcl-land on ros may require some extra work (thats where you can do your bit for eros - patches and information are welcome!). It's definitely a nice target though, specially with the near future looking at running gpu'd pcl on arm+nvidia combination boards.

One area where eros is lacking at the moment is in information on how to roll your own filesystems/toolchains and we'll start looking at remedying that in the near future.

edit flag offensive delete link more


Up until now compiling ROS on the BB directly wasn't too annoying, took not more than 3 hours to build a mobile variant with most of the openNI and its dependencies. But PCL_ROS really causes frustration :(, hope I'll manage to build that after all. I'll read about cross-compilation...
tom gravatar image tom  ( 2011-02-24 01:14:04 -0500 )edit
How important is the beard? Aside: I don't know of any upcoming boards from nvidia that combine ARM and a gpu that can run CUDA code (which gpu'd pcl will require). e.g. the tegras don't run CUDA code.
Straszheim gravatar image Straszheim  ( 2011-02-24 09:18:21 -0500 )edit

answered 2011-02-23 23:35:46 -0500

use a cross compiler on your workstation

edit flag offensive delete link more


That's one of the possibilities I've forgotten to list above, thanks :). The point is, I don't know how to do it (yet), so maybe there is a simpler way via reducing the memory needed by the compiler.
tom gravatar image tom  ( 2011-02-23 23:39:42 -0500 )edit

answered 2011-05-19 06:27:03 -0500

dirtyibt gravatar image

I've dealt with a similar issue through using swap partition. For the instructions to configure swap space on Ubuntu click the following link:

Swap space on angstrom:

edit flag offensive delete link more

answered 2011-02-25 18:38:22 -0500

enddl22 gravatar image

I think using swap partition gonna be solution for your problem. I'm also trying to run openni on the Gumstix (the same core as BB as far as I know) but haven't compiled PCL yet. How could you get dependent libraries which doesn't exist for ARM core like hull hd5(I can't remember correct lib name). Cheers.

edit flag offensive delete link more

answered 2011-02-24 04:42:20 -0500

tom gravatar image

updated 2011-02-24 04:43:49 -0500

Thanks all,

for the time being, I can confirm that it's possible to use Kinect with ROS on a BeagleBoard-xM. As I'm not experienced in the embedded world, I took the easiest way for me and used Nizar's advice to change set (ROS_BUILD_TYPE RelWithDebInfo) to set (ROS_BUILD_TYPE Release) in the CMakefile. It took 3 hours to build this directly on the BB and I also had to turn swap on (which is not healthy for a flash memory), but it worked. I've been able to use dynamic_reconfigure over WiFi and changed to QQVGA@30Hz and then to subscribe to /camera/depth/points2 locally (rostopic hz showed 4,5Hz).

I still wasn't able to use rviz nor even subscribe to a topic on my PC over a WiFi, but this must be an issue with my USB-dongle's drivers.

Do you have any hints on how I can minimize processor's load even more? Basically I'd like my BeagleBoard to work as a Kinect WiFi interface for now. I guess it's possible to switch do UDP, would it be wise in my case?

Naturally I'll work on cross-compiling as soon as I get this one last issue rolling.

Any suggestions welcome, Tom.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-02-23 23:23:27 -0500

Seen: 1,657 times

Last updated: May 19 '11