ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

rosmake - how is link.txt generated for packages?

asked 2012-06-07 04:40:06 -0500

Bertrix gravatar image

updated 2012-07-02 13:39:52 -0500

mjcarroll gravatar image

I've come across a bit of a linking problem when trying to get Arduino projects compiled for my ROS electric installation under Ubuntu.

When compiling for ROS, rosmake / CMake somehow sneaks the "-rdynamic" flag into the linking arguments for the object files regardless of target. This normally isn't a problem but since I've updated gcc-avr to 4.7.0 its behaviour is now set to error out when it finds an unsupported option, previous versions simply gave a warning and continued on. Manually removing -rdynamic from link.txt inside the relevant CMakeFiles folder then making fixes the problem and the linking is successful, but that defeats the purpose of CMake if I have to do that every time.

The easy solution would be to downgrade gcc-avr to the previous version (it's not like I need the new version) but I'm interested where in the CMake process is this flag getting set and how the link.txt script is actually generated for individual packages, I can't seem to find any documents regarding this. I've done a plaintext search on the stack source files and "rdynamic" doesn't show up, it has to appear somewhere higher up the chain.

-- UPDATE --

Thought I'd add that I'm compiling my Arduino projects via the Poark port of the parsec.rosserial stack as I found the official rosserial_arduino version under Electric to be utterly broken when I checked it out a few months ago, things may have changed since then but I've been working around this stack and it hasn't faulted me yet.

I ended up reverting gcc-avr to version 4.5.3 along with a compatible avr-libc. "-rdynamic" no longer crashes the build script and everything works mostly as it should with Poark. Rosmake is only for initially setting up rosserial, after that you call cmake directly.

The process involves calling cmake with a bunch of Arduino specific flags (mcu type, speed, upload port etc), this is easily done with a bash script. Poark's cmake script then does its thing and generates Makefiles for your Arduino project leaving you to invoke 'make upload' to generate binaries and upload them to the board.

I did however find a curious issue when I invoked 'make'; it executes a cmake_check_build_system function inside the Makefile which regenerates the Makefile without the Arduino specific options, making the script fall over as no 3rd party Arduino libraries are in the compiler scope. This was resolved by altering the bash script to remove the offending function from the Makefile after generation using sed and before the user has a chance to invoke 'make upload'

Anyhow, I think I'd consider this question closed. It seems that the original problem stems from CMake throwing flags in at a fundamental level and gcc-avr 4.7.0 just being pedantic. To fix this bug would probably mean breaking a lot of 'normal' cases, so reverting and staying would be the best option.

It ... (more)

edit retag flag offensive close merge delete

Comments

So... you are trying to compile Arduino code using rosmake?

Eric Perko gravatar image Eric Perko  ( 2012-06-07 16:49:46 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2012-06-07 16:55:42 -0500

Eric Perko gravatar image

-rdynamic appears to be added by CMake automatically on Linux. For example, http://www.cmake.org/pipermail/cmake/2009-October/032948.html .

I don't think rosmake has very good support for cross-compiling right now (I've never actually tried it though), so it doesn't surprise me if it's picking up flags that are inappropriate for Arduino (by assuming that the target is a Linux system).

You may want to look at http://www.ros.org/wiki/eros . There are resources there for how to cross-compile ROS packages (but I believe they are still targeting embedded Linux systems, not Arduinos).

rosserial, specifically rosserial_arduino, may have some resources for compiling ROS packages for Arduino that you could build on/reference.

The new catkin build system should also have better support for cross-compiling, however catkin isn't scheduled for full release until at least ROS Groovy.

edit flag offensive delete link more
0

answered 2012-06-09 20:56:39 -0500

Bertrix gravatar image

See update in the question

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-06-07 04:40:06 -0500

Seen: 3,164 times

Last updated: Jun 09 '12