Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3637 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1844 invoked from network); 29 Jul 2003 16:59:21 -0000 Received: from unknown (HELO hotmail.com) (207.68.165.6) by pb1.pair.com with SMTP; 29 Jul 2003 16:59:21 -0000 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 29 Jul 2003 09:59:21 -0700 Received: from 208.252.96.195 by sea2fd.sea2.hotmail.msn.com with HTTP; Tue, 29 Jul 2003 16:59:21 GMT X-Originating-IP: [208.252.96.195] X-Originating-Email: [bruce1828@hotmail.com] To: internals@lists.php.net Bcc: Date: Tue, 29 Jul 2003 09:59:21 -0700 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 29 Jul 2003 16:59:21.0404 (UTC) FILETIME=[C18A9FC0:01C355F2] Subject: RE: PHP dumps core loading extension - problem solved. From: bruce1828@hotmail.com ("Bruce Bailey") Well I believe that I have the solution to the core dumping during the C library wrap-up. If I link the top-level executable, in this case either /usr/bin/php or httpd with the C++ compiler as the front end to the linker, the segfault problem goes away. I guess this should have been obvious . . . Bruce >-----Original Message----- >From: Bruce Bailey [mailto:bruce1828@hotmail.com] >Sent: Tuesday, July 29, 2003 9:52 AM >To: Bruce Bailey >Subject: PHP dumps core loading extension - more information > > >A new discovery . . . > >I created a new extension with only one function and it calls a dso library >that also has only one function. So the libraries are: > >php --> my new extension --> my new utility library. > >the new utility library has only this function: > >int function1(void){return 456;} > >When I compile and link the library with C, I can run 'phpinfo();' with no >problems. When I use C++ to compile and link, running 'phpinfo();' core >dumps. Gdb reports the same backtrace as listed below. This can't be >right. Outside of the php context, C and C++ co-exist perfectly. > >Are there some php-related configuration options that might have bearing on >this? What am I missing? > >This doesn't make any sense. > >Bruce > > > > >I should have thought of including a backtrace before: > > > >(gdb) bt > >#0 0x0000030002891c30 in ?? () > >#1 0x000003ff800dd7d0 in exit () from /usr/shlib/libc.so > >#2 0x000003ff800dd7d0 in exit () from /usr/shlib/libc.so > >Cannot access memory at address 0x20 > >(gdb) > > > > > > > > >From: "Bruce Bailey" > > >To: internals@lists.php.net > > >Subject: [PHP-DEV] PHP dumps core loading extension > > >Date: Fri, 25 Jul 2003 10:55:50 -0700 > > > > > >I hope this is the right place for this type of question. If not, >please > > >let me know a more appropriate forum. > > > > > >I have a PHP extension (written in C) that calls a utility library that >I > > >wrote in C++. For my testing and debugging, I have been trying to > >exercise > > >my code using PHP from the command line ('/usr/bin/php'). For some > >reason, > > >PHP dumps core (segmentation fault) when I try to use any of my > >functions. > > > > > >Even if my php script is simply . At this point, >I'm > > >not even calling any of my C++ utility functions, > >PHP_MINIT_FUNCTION(myext) > > >and PHP_RINIT_FUNCTION(myext) are essentially no-ops, and > > >PHP_MINFO_FUNCTION(myext) has only constant asciiz strings. My >phpinfo() > > >still dumps core. > > > > > >To load my utility library, I have a config.m4 line: > > > > > >PHP_EVAL_LIBLINE("-L/bjb/lib -lbjbutility") > > > > > >When I comment out the 'PHP_EVAL_LIBLINE', the phpinfo() functions >works > > >OK. > > > > > >I have used the C++ utility library for several years, outside of the > > >context of PHP with no problems, even when calling from a C mainline. > > > > > >Has anyone seen this before? > > >Any suggestions as to what might be strategy for debugging this? > > >Where else can I look for information that might be useful? > > > > > >Thanks in advance, > > > > > >Bruce > > > > > >Environment information: > > > > > >Php 4.3.1 > > >Configure Command => './configure' '--target=' '--prefix=/bjb' > > >'--with-apxs=/bjb/home/www_serv/bin/apxs' '--with-gd' '--with-zlib' > > >'--with-zlib-dir=/home/jeb/target/bjb' '--with-jpeg' > > >'--with-jpeg-dir=/home/jeb/target/bjb' '--with-png' > > >'--with-png-dir=/home/jeb/target/bjb' '--with-freetype' > > >'--with-freetype-dir=/home/jeb/target/bjb' > > >'--with-pdflib=/home/jeb/target/bjb' '--with-enable-dba' '--with-cdb' > > >'--with-dbm' > > > > > >DEC Tru64 > > >cxx -V > > >DIGITAL C++ V6.1-027 on DIGITAL UNIX V4.0 (Rev. 1229) _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963