Problem present in openscenegraph 1.9.x and 2.x series: Debian bug #425837.

Looking at the build logs of unstable or experimental for the hppa architecture, there's a linking problem around.

Shorten error message:

/usr/bin/g++ -fPIC -shared -Wl,-soname, 
    -o ../../lib/ "many *.o"
    -L/build/buildd/openscenegraph-2.2/build/osg/lib  -losg
    -lOpenThreads -lGLU -lGL -lSM -lICE -lX11 -lXext -lm -lpthread

/usr/bin/ld: CMakeFiles/osgUtil.dir/Optimizer.o(.text._ZNSt8_Rb_tree…
    …_RKSA_("unmangled name"): cannot reach 0000393f__ZNSt10_Select1…
    recompile with -ffunction-sections

/usr/bin/ld: final link failed: Bad value

First, just in case demangling is needed (that's not the case, but imagine), there's a nice tool to get the signature back (output skipped, it is very huge, that C++!). That's c++filt from the binutils package:

c++filt _ZNSt8_Rb_treeIjSt4pairIKjSt3setIPN3osg9Texture2DESt4lessIS\

Then, one tends to trust the compiler. Added the following to the cmake command in debian/rules:

-D CMAKE_CXX_CFLAGS='-ffunction-sections'

But not much better. Oh wait, there's a quite interesting string in the build log now: cannot handle R_PARISC_PCREL17F, which looks like quite arch-dependant and perfect to be searched through the internets.

Some old bugreports came out: Debian bug #334959 and Debian bug #416496 and the solution: use -mlong-calls.

From, the relevant parts:

Generate code that uses long call sequences. This ensures that a call is always able to reach linker generated stubs. […] It is normally not desirable to use this option as it will degrade performance. However, it may be useful in large applications, particularly when partial linking is used to build the application.

It looks like it might do the job. And indeed it does. Conditionally added for the hppa architecture. And -ffunction-sections isn't even needed.

Thanks to the folks for the access to their cluster, which really helped finding out a fix very quickly!

And it looks like the number of blockers for the transition to testing has been reduced. \o/