<div dir="ltr"><div><div><br></div><div>I believe I found a bug in getLibraryHandle.<br><br></div><div>This was encountered when writing an osgEarth application, using the osgEarthQt widgets (Qt 4.8.6).<br></div><div><br></div><div>A segfault was encountered shortly after starting the application, when pressing 's' (To bring up the standard set of rendering stats).<br></div><div><br>I traced this to the dlopen( localLibraryName.c_str(), RTLD_LAZY | RTLD_GLOBAL) call in osg/src/osgDB/DynamicLibrary.cpp<br></div><div><br></div><div>According to the dlopen manpage:<br><pre>As at glibc 2.21, specifying the <b>RTLD_GLOBAL </b>flag when calling
<b>dlmopen</b>() generates an error. Furthermore, specifying <b>RTLD_GLOBAL</b>
when calling <b>dlopen</b>() results in a program crash (<b>SIGSEGV</b>) if the
call is made from any object loaded in a namespace other than the
initial namespace.</pre></div><div><br></div><div>Changing osg to use RTLD_LOCAL avoids the crash, and doesn't seem to break anything else as far as I can tell.<br><br></div><div>Is there a specific reason why RTLD_GLOBAL is used? This doesn't make much sense given the plugin architecture..<br><br><br></div><div>I've attached a minimal patch including the fix.<br></div><div><br><br></div>Thanks<br></div>Gareth Francis<br></div>