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

Revision history [back]

click to hide/show revision 1
initial version

I'm not aware of any publicly available static builds of ROS.

tl;dr: abandon hope all ye who enter here

The company I work for uses a heavily modified version of ROS with a different build system, and we have had significant trouble when attempting to build and statically link the various libraries that make up roscpp. I was eventually able to get static builds to work, but it took several months of development effort and a number of changes to the roscpp_common and ros_comm stacks.

The core problem with linking ROS statically is that the initialization and destruction order of globals in a statically linked binary is not defined, and ROS has a lot of global singletons that rely upon each other. Without any kind of enforcement of construction/destruction order, we were seeing a lot of core dumps during node shutdown. (upstream ROS gets around this because the globals are spread across many shared libraries, and the shared library loading order results in correct global construction order)

It is possible to enforce construction and destruction order by using static variables in accessor functions instead of globals, but the sheer number of places where this had to be done made it a substantial task.

This size of the resulting patches and the lack of consistent maintenance on the ros_comm repo means that it is very unlikely that these patches would be accepted if I submitted them.

The general transform that needs to be applied looks like this:

Foo fooSingleton;

becomes

Foo& getFooSingleton() {
    static Foo fooSingleton;
    return fooSingleton;
}