Dec
3
2009
Segfaults on FreeBSD 7 and PHP5 – Solved
Looks like compiling libxml2 without pthread support causes severe issues in PHP, E.G:
(gdb) bt #0 0x28959cd0 in ?? () #1 0x285b13d4 in pthread_mutex_destroy () from /lib/libc.so.7 #2 0x28346668 in xmlFreeRMutex () from /usr/local/lib/libxml2.so.5 #3 0x28398faa in xmlDictCreateSub () from /usr/local/lib/libxml2.so.5 #4 0x282d88fb in xmlCtxtResetPush () from /usr/local/lib/libxml2.so.5 #5 0x080844eb in php_libxml_shutdown () #6 0x0808451b in zm_shutdown_libxml () #7 0x0814b4ae in module_destructor () #8 0x08151804 in zend_hash_apply_deleter () #9 0x08151a48 in zend_hash_graceful_reverse_destroy () #10 0x08147d2e in zend_shutdown () #11 0x0810615f in php_module_shutdown () #12 0x081c4100 in main ()
The (relatively simple) fix is to remove the last hunk in /usr/ports/textproc/libxml2/files/patch-configure — after doing so, run:
The contents of /usr/ports/textproc/libxml2/files/patch-configure after patching should look like this:
--- configure.orig 2009-10-06 18:31:12.000000000 +0200 +++ configure 2009-11-30 12:54:21.000000000 +0100 @@ -12149,7 +12149,7 @@ VERSION_SCRIPT_FLAGS= $(/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null) && \ VERSION_SCRIPT_FLAGS=-Wl,--version-script= -test "`uname`" == "SunOS" && \ +test "`uname`" = "SunOS" && \ VERSION_SCRIPT_FLAGS="-Wl,-M -Wl," if test -n "$VERSION_SCRIPT_FLAGS"; then @@ -19856,11 +19856,12 @@ fi if test "$PYTHON_VERSION" != "" then + with_python=`$PYTHON -c "import sys; print sys.exec_prefix"` if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \ -d $with_python/lib/python$PYTHON_VERSION/site-packages then PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages + PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages else if test -r $prefix/include/python$PYTHON_VERSION/Python.h then
Obviously, you should back up the original file. After patching, run:
/usr/ports/textproc/libxml2/# make clean && make patch && make all /usr/ports/textproc/libxml2/# make deinstall && make reinstall
The issue should then be resolved.