ImageMagick's "modules" and __cxa_finalize

Alexander Kabaev kabaev at gmail.com
Tue Jul 31 12:33:20 UTC 2007


On Sun, 29 Jul 2007 23:31:10 -0400
Mikhail Teterin <mi+kde at aldan.algebra.com> wrote:

> Has anyone had any luck using ImageMagick built with modules support?
> 
> If I try that, and follow-up with `gmake check' (in the ${WRKSRC}),
> about a fifth of ImageMagick's own self-tests seg-fault -- all of
> them inside __cxa_finalize (after main() has already returned):
> 
> 	mi at aldan:ImageMagick/work/ImageMagick-6.3.5 (1023) gdb
> tests/.libs/rwblob tests/rwblob.core [...]
> 	(gdb) where 5
> 	#0  0x0000000804008cc0 in ?? ()
> 	#1  0x00000008020079e2 in __cxa_finalize ()
> from /lib/libc.so.6 #2  0x0000000802007637 in exit ()
> from /lib/libc.so.6 #3  0x0000000000401135 in _start ()
> 	#4  0x000000080052a000 in ?? ()
> 	(More stack frames follow...)
> 	(gdb)
> 	mi at aldan:ImageMagick/work/ImageMagick-6.3.5 (1024) gdb
> tests/.libs/rwfile  tests/rwfile.core [...]
> 	(gdb) where 5
> 	#0  0x0000000803f04cc0 in ?? ()
> 	#1  0x00000008020079e2 in __cxa_finalize ()
> from /lib/libc.so.6 #2  0x0000000802007637 in exit ()
> from /lib/libc.so.6 #3  0x0000000000401085 in _start ()
> 	#4  0x000000080052a000 in ?? ()
> 	(More stack frames follow...)
> 	(gdb) 
> 
> Full build/test log can be seen here:
> 
> 	http://aldan.algebra.com/~mi/IM-6.3.5-3.failure.log
> 
> Building without modules (as is the port's default) allows all
> self-tests to pass smoothly.
> 
> According to ImageMagick and GraphicsMagick developers, these crashes
> are due to some "reckless" calls to atexit() from inside the modules
> (or inside the modules-loaded graphics librarires). By the time the
> program is exiting, the libraries with the atexit-loaded functions
> may already be unloaded.
> 
> But I thought, FreeBSD had that case covered since 2003:
> 
> 	http://www.freebsd.org/cgi/query-pr.cgi?pr=59552
> 
> Can someone, please, comment?
> 
> 	-mi

You thought wrong.

Please read the PR again and try to understand what part it really does
cover and what doesn't. The comment was given to you before and it is
the right one:

<COMMENT>
atexit() cannot be used safely from the shared library.
</COMMENT>


That is the reason why __cxa_atexit was invented in the first place.

--
Alexander Kabaev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20070731/5625e0d0/signature.pgp


More information about the freebsd-ports mailing list