Re: Linking C++ extensions

From: Date: Tue, 01 Jan 2008 00:35:44 +0000
Subject: Re: Linking C++ extensions
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-5011@lists.php.net to get a copy of this message
On Mon, Dec 31, 2007 at 03:40:04PM +0300, Antony Dovgal wrote: > > I was working on a C++-based extension and kept running into this > > module load failure: > > > > Undefined symbol "_Znwj" in Unknown on line 0 > > Are you sure you have PHP_REQUIRE_CXX in your config.m4 ? Yes, PHP_REQUIRE_CXX is there. I don't think I would have gotten past the compilation stages without it, actually. > And you're linking against libstdc++, right? I wasn't adding it explicitly, no. I just tried adding libstd++ via PHP_ADD_LIBRARY(...), and that appears to also solve my problem (without having to add the additional parameter to PHP_NEW_EXTENSION). I'm not sure which approach is preferable, however. It looks like the C++ standard library is available under various names: libC, libg++, libstdc++, and libcxx. It seems like it would be best to let the system's C++ tool chain include the appropriate library itself by explicitly linking using $(CXX) instead of $(CC), which is what the sixth parameter to PHP_NEW_EXTENSION controls. -- Jon Parise (jon of php.net) :: The PHP Project (http://www.php.net/)

« previous php.pecl.dev (#5011) next »