Closed jnkvca closed 1 year ago
Hey @jnkvca thanks a lot for highlighting this. Indeed we have a number of non-trivially constructable objects declared at file scope and thus suffer from SIOF (i.e. non-deterministic/compiler dependent construction order). I've incorporated your changes in a slightly different way and additionally fixed all remaining occurrences of such behavior (as well as enabling Clang's -Wglobal-constructors
warning):
https://github.com/AcademySoftwareFoundation/openvdb/pull/1620
Let me know if this also looks like it would solve your issue
This should now be fixed as part of https://github.com/AcademySoftwareFoundation/openvdb/pull/1620 - thanks again for highlighting this!
I built OpenVDB for Android as a shared library and it seemed to crash every time when it was loaded. Further investigation showed that it crashes in the static initialization of the
sStreamState
instance. The class has a non-trivial constructor which makes calls toxalloc()
,iword()
andpword()
as can be seen here. These functions crash on Android when called from static initializers when the library is being loaded.The fix is to delay initialization of
sStreamState
object and do it from theopenvdb::initialize()
function.