artemp/mapnik — Issue #851: clang LTO (with -O4) triggers boost lock::error
Author: artemp
Created: 2011-10-11 16:38:58+00:00
State: open
Labels: Core_Library

If current HEAD (r3207) is built with link time optimization using clang:

{{{
$ clang --version
clang version 3.0 (trunk 138729)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
}}}

Then immediately upon import of the python bindings boost throws with a lock error during image reader registration:

{{{
d:clang-lto dane$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapnik2
terminate called after throwing an instance of 'boost::exception_detail::clone_impl >'
what(): boost::lock_error
Abort trap
}}}

The backtrace looks like:

{{{

0 libSystem.B.dylib	0x00007fff8303c0b6 __kill + 10
1 libSystem.B.dylib	0x00007fff830dc9f6 abort + 83
2 libstdc++.6.dylib	0x00007fff890ed5d2 __tcf_0 + 0
3 libobjc.A.dylib	0x00007fff85a02b4d _objc_terminate + 120
4 libstdc++.6.dylib	0x00007fff890ebae1 __cxxabiv1::__terminate(void (*)()) + 11
5 libstdc++.6.dylib	0x00007fff890ebb16 __cxxabiv1::__unexpected(void (*)()) + 0
6 libstdc++.6.dylib	0x00007fff890ebbfc __gxx_exception_cleanup(_Unwind_Reason_Code, _Unwind_Exception*) + 0
7 _mapnik2.so	0x0000000101037fe3 void boost::throw_exception(boost::lock_error const&) + 131
8 _mapnik2.so	0x0000000101037f4c boost::unique_lock::lock() + 108
9 libmapnik2.dylib	0x0000000101824aff mapnik::singleton, mapnik::CreateStatic>::instance() + 47
10 libmapnik2.dylib	0x000000010194d9af _GLOBAL__I_a2859 + 31
11 dyld	0x00007fff5fc0d500 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 228
12 dyld	0x00007fff5fc0bcec ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 236
13 dyld	0x00007fff5fc0bc9d ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 157
14 dyld	0x00007fff5fc0bda6 ImageLoader::runInitializers(ImageLoader::LinkContext const&) + 58
15 dyld	0x00007fff5fc08fbb dlopen + 573
16 libSystem.B.dylib	0x00007fff82ff3e40 dlopen + 61
17 org.python.python	0x00000001000abbe5 _PyImport_GetDynLoadFunc + 327
18 org.python.python	0x000000010009bcee _PyImport_LoadDynamicModule + 112
19 org.python.python	0x000000010009aaf8 PyImport_ReloadModule + 1347
20 org.python.python	0x000000010009af78 PyImport_ReloadModule + 2499
21 org.python.python	0x000000010009b56a PyImport_ImportModuleLevel + 1217
22 org.python.python	0x00000001000839cb _PyBuiltin_Init + 14264
23 org.python.python	0x000000010000aff3 PyObject_Call + 112
}}}