I had the exact same problem using the same set of tools.
As Dietmar Kühl pointed out, libfcgi++ was not compiled with libc++, and it was the problem for me. +1000 to him. Many thanks.
As a quick hacky test, I recompiled the latest stable libfcgi with the flag:
-stdlib=libc++
by running ./configure
as usual, then editing two lines in the Makefile found in fcgi-dev-kit/libfcgi/Makefile
:
CXX = clang++
# ....
CXXFLAGS = -g -O2 -std=c++0x -stdlib=libc++
and then running make
in the top level directory.
Linking with the resulting libraries in fcgi-dev-kit/libfcgi/.libs/libfcgi++.a for example, fixed the segmentation faults.
The dev kit can be found here: http://www.fastcgi.com/drupal/node/5. You'll need to figure out a long term solution for linking with an appropriately compiled libfcgi++ if you need to use libc++, like I do.