php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14048 Configure issues
Submitted: 2001-11-13 23:28 UTC Modified: 2002-07-07 20:48 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: msopacua at idg dot nl Assigned:
Status: Closed Package: Compile Failure
PHP Version: 4.3.0-dev OS: BSD/OS 4.x
Private report: No CVE-ID: None
 [2001-11-13 23:28 UTC] msopacua at idg dot nl
Hi,

for a number of releases I've dealt with some known issues, but felt it's time to summarize them here, since I think I've pretty much got them all, including the fixes.

1) Native make + gnu make
For some reason, php is the only package, that manages to override the variable MAKE=/path/to/make as well as the make in the PATH setting. If you keep the native make (which is sensible, for it's best used for creating a new kernel), but you have your own make compiled in your own dirs, then make doesn't work. The reason is, the old include format. I use this perlscript 'makefix.pl' to fix the issues:
#!/perl/bin/perl

use Getopt::Long;

my $dir=$ENV{'HOME'}.'/_src/php-4.0.4pl1';

GetOptions(
        'dir=s'         =>      \$dir);


chdir($dir) || die "Can't change to $dir\n$!\n";

open(FILE, './makefix.lst') || die "Please create the list first, with:\nfind -x . -exec grep -l -E '\\.include \\\"' {} \\; >./makefix.lst";
@files = <FILE>;
close(FILE);

for $i (0..$#files) {
        $fix = $files[$i];
        next if $fix =~ /\.bak$/;
        chomp($fix);
        $bak = $fix . '.bak';
        system("cp $fix $bak");
        print STDOUT "Trying $bak and $fix....";
        open(BAK, $bak) || die "cant open $bak\n$!\n";
        open(FIX, ">$fix") || die "cant open $fix\n$!\n";
        while(<BAK>) {
                chomp;
                s/^\.include \"([^\"]+)\"\s?$/include $1/;
                print FIX $_;
                print FIX "\n";
        }
        close(BAK);
        close(FIX);
        print STDOUT "fixed.\n";
}
exit(0);

It can probably be done more easily, but it works.

2) INET_* functions
Are native for BSDi and don't need a library. Secondly, they complain without the right headers. Here's a snippet from the Bind configure script, on how to _correctly_ test for these functions:
------------------------------------------------------------
echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
echo "configure:3901: checking for inet_aton" >&5
cat > conftest.$ac_ext <<EOF
#line 3903 "configure"
#include "confdefs.h"

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main() {
struct in_addr in; inet_aton(0, &in); return (0);
; return 0; }
EOF
------------------------------------------------------------

The native bind on BSDi does have __inet_aton in libbind, but it's static, so PHP complains and you need to edit config.h and Zend/Makefile to get rid of it.

Secondly - bind 9.x requires not only libbind but libisc as well, so any tests for -lbind will always fail, if you've upgraded your named package.

3) res_search
Is also native on BSDi. I don't have a definite fix, since I'm no C-programmer, but I just add these lines to the end of main/php_config.h.in to work around it:

#ifdef __bsdi__
        #define HAVE_RES_SEARCH 1
#endif

man 3 res_search says:
DEPRECATED
     #include <sys/types.h>
     #include <netinet/in.h>
     #include <arpa/nameser.h>
     #include <resolv.h>
...
     res_search(const char *dname, int class, type, u_char *answer, int anslen);

4) Iconv and XSLT
Below is a typical diff for any section in configure trying to find iconv for the XSLT section:
------------------------------------------------------------
    found_iconv=no
!   echo $ac_n "checking for iconv_open in -lc""... $ac_c" 1>&6
! echo "configure:48789: checking for iconv_open in -lc" >&5
  ac_lib_var=`echo c'_'iconv_open | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    ac_save_LIBS="$LIBS"
! LIBS="-lc  $LIBS"
  cat > conftest.$ac_ext <<EOF
  #line 48797 "configure"
  #include "confdefs.h"
--- 48784,48797 ----


    found_iconv=no
!   echo $ac_n "checking for iconv_open in -liconv""... $ac_c" 1>&6
! echo "configure:48789: checking for iconv_open in -liconv" >&5
  ac_lib_var=`echo c'_'iconv_open | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    ac_save_LIBS="$LIBS"
! LIBS="-liconv  $LIBS"
  cat > conftest.$ac_ext <<EOF
  #line 48797 "configure"
  #include "confdefs.h"
------------------------------------------------------------
It will do this correctly for --with-iconv, but later on when iconv is specified with xslt, it breaks. There are several sections in the configure script and I usually fix them all just to spare me the havoc of find out which is called and why.

I hope you can address these issues before 4.0.7 release.

As a side note:
The latest snapshots work correctly with make as always, but then the release versions don't.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-18 19:58 UTC] sniper@php.net
Please list shortly what does not work in latest snapshot.

--Jani

 [2001-11-18 22:28 UTC] msopacua at idg dot nl
Ok:
BSDi 4.2 i386 with GNUmake 3.79.1, autoconf 2.13, automake 1.5, libtool 1.4, configured as:
#!/bin/sh

./configure \
        --prefix=/php \
        --with-perl=/perl/bin/perl \
        --with-apxs=/apache/bin/apxs \
        --with-config-file-path=/weblib/local/lib \
        --with-openssl=/weblib/local \
        --disable-short-tags \
        --with-zlib \
        --with-zlib-dir=/weblib/local \
        --enable-bcmath \
        --enable-calendar \
        --with-curl=shared,/weblib/local \
        --with-dom=shared,/weblib/local \
        --enable-ftp \
        --with-gd=/weblib/local \
        --with-jpeg-dir=/weblib/local \
        --with-png-dir=/weblib/local \
        --with-freetype-dir=/weblib/local \
        --with-iconv=shared,/weblib/local \
        --enable-mailparse \
        --enable-mbstring \
        --with-mcal=shared,/weblib/local \
        --with-mcrypt=shared,/weblib/local \
        --with-mhash=shared,/weblib/local \
        --with-mysql=/weblib/local \
        --with-pdflib=/weblib/local \
        --with-jpeg-dir=/weblib/local \
        --with-png-dir=/weblib/local \
        --with-tiff-dir=/weblib/local \
        --with-pgsql=shared,/pgsql \
        --enable-sockets \
        --with-expat-dir=/weblib/local \
        --enable-xslt \
        --with-xslt-sablot=shared,/weblib/local \
        --with-expat-dir=/weblib/local \
        --with-iconv-dir=/weblib/local

checking for res_search... no
....
checking for res_search in -lsocket... no
checking for res_search in -lresolv... no

$ grep -i 'res_search' ./main/php_config.h
/* Define if you have the `res_search' function. */
/* #undef HAVE_RES_SEARCH */

This means, that getmxrr() isn't available.

checking whether to enable xslt support... yes
checking whether to enable the XSLT Sablotron backend... yes, shared
checking libexpat dir for Sablotron XSL support... yes
checking for iconv_open in -lc... no
checking for SablotSetEncoding in -lsablot... yes

So - that works now.

make now works (always does in snapshots - not in releases).

But then, apache won't start:
$ gdb -core ./httpd.core -exec apache/bin/httpd
GNU gdb
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-bsdi4.2".
Core was generated by `httpd'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /shlib/libdl.so...done.
Reading symbols from /shlib/libgcc.so.1...done.
Reading symbols from /shlib/libc.so.2...done.
Reading symbols from /shlib/ld-bsdi.so...done.
Reading symbols from /apache/libexec/libphp4.so...done.
Reading symbols from /weblib/local/lib/libz.so...done.
Reading symbols from /weblib/local/lib/libsablot.so.0...done.
Reading symbols from /weblib/local/lib/libiconv.so.2...done.
Reading symbols from /weblib/local/lib/libexpat.so.0...done.
Reading symbols from /weblib/local/lib/libpdf.so.1...done.
Reading symbols from /weblib/local/lib/mysql/libmysqlclient.so.10...done.
Reading symbols from /weblib/local/lib/libgd.so...done.
Reading symbols from /weblib/local/lib/libfreetype.so.6...done.
Reading symbols from /weblib/local/lib/libpng.so.2...done.
Reading symbols from /weblib/local/lib/libjpeg.so.62...done.
Reading symbols from /weblib/local/lib/libssl.so.0.9.6...done.
Reading symbols from /weblib/local/lib/libcrypto.so.0.9.6...done.
Reading symbols from /shlib/libm.so.0.0...done.
Reading symbols from /apache/libexec/mod_gzip.so...done.
#0  0x481f2a67 in zend_register_functions (functions=0x48301e20, function_table=0x0, type=1) at zend_API.c:1046
1046                    if (zend_hash_add(target_function_table, ptr->fname, strlen(ptr->fname)+1, &function, sizeof(zend_function), NULL)
 == FAILURE) {
(gdb) bt
#0  0x481f2a67 in zend_register_functions (functions=0x48301e20, function_table=0x0, type=1) at zend_API.c:1046
#1  0x481f2bd7 in zend_register_module (module=0x48301ea4) at zend_API.c:1099
#2  0x481f29c2 in zend_startup_module (module=0x48301ea4) at zend_API.c:1010
#3  0x481fcf14 in php_startup_extensions (ptr=0x482f8230, count=17) at main.c:780
#4  0x481fe333 in php_startup_internal_extensions () at internal_functions.c:78
#5  0x481fd3a5 in php_module_startup (sf=0x482f709c) at main.c:935
#6  0x481fa4b6 in php_apache_startup (sapi_module=0x482f709c) at mod_php4.c:279
#7  0x481fadb1 in php_apache_value_handler_ex (cmd=0x8047b0c, conf=0x812a2c0, arg1=0x8149284 "include_path",
    arg2=0x8149294 ".:/webdocs/www.infoworld.nl/_inc:/webdocs/_global_inc", mode=2) at mod_php4.c:698
#8  0x481faead in php_apache_value_handler (cmd=0x8047b0c, conf=0x812a2c0, arg1=0x8149284 "include_path",
    arg2=0x8149294 ".:/webdocs/www.infoworld.nl/_inc:/webdocs/_global_inc") at mod_php4.c:726
#9  0x807bb6e in ?? ()
#10 0x807c4c8 in ?? ()
#11 0x807c567 in ?? ()
#12 0x80806ff in ?? ()
#13 0x807b9cc in ?? ()
#14 0x807c4c8 in ?? ()
#15 0x807c567 in ?? ()
#16 0x807cc28 in ?? ()
#17 0x807d58c in ?? ()
#18 0x8087e6c in ?? ()
#19 0x804ebae in ?? ()



 [2001-11-19 17:58 UTC] sniper@php.net
You might be having an issue with old shared extension
being loaded. Check it first. ie. try disabling the loading
of such extensions in php.ini

 [2001-12-12 17:47 UTC] msopacua at idg dot nl
And it's there again, version 4.1.0:

mdev@server6 ~/_src/php-4.1.0
$ type make
make is hashed (/home/mdev/local/bin/make)

mdev@server6 ~/_src/php-4.1.0
$ echo $MAKE
/home/mdev/local/bin/make

mdev@server6 ~/_src/php-4.1.0
$ make
Makefile:34: *** missing separator.  Stop.

mdev@server6 ~/_src/php-4.1.0
$ grep 'HAVE_RES_SEARCH' ./main/php_config.h
/* #undef HAVE_RES_SEARCH */


By the way - the issue with shared libs didn't apply. I did rm -rf /php/lib before I did anything else and php.ini didn't load anything it shouldn't be able to find, judging from ls and ldd.

But can you ellaborate on the issues above?
 [2001-12-12 18:23 UTC] sniper@php.net
You said before that snapshots have always worked just fine.
Is this still the case? Does the latest CVS snapshot work for you?
(there might be some problems in creating the releases..)

--Jani

 [2001-12-13 00:20 UTC] msopacua at idg dot nl
And it's there again, version 4.1.0:

mdev@server6 ~/_src/php-4.1.0
$ type make
make is hashed (/home/mdev/local/bin/make)

mdev@server6 ~/_src/php-4.1.0
$ echo $MAKE
/home/mdev/local/bin/make

mdev@server6 ~/_src/php-4.1.0
$ make
Makefile:34: *** missing separator.  Stop.

mdev@server6 ~/_src/php-4.1.0
$ grep 'HAVE_RES_SEARCH' ./main/php_config.h
/* #undef HAVE_RES_SEARCH */


By the way - the issue with shared libs didn't apply. I did rm -rf /php/lib before I did anything else and php.ini didn't load anything it shouldn't be able to find, judging from ls and ldd.

But can you ellaborate on the issues above?
 [2001-12-13 00:26 UTC] msopacua at idg dot nl
<needcoffee>oops - sorry about the double posts - I'm not quite awake yet - can you delete that?</needcoffee>

Indeed I compiled the snapshot from 11120600 and that compiled outof the box - same problem though - core dumps and httpd won't start up.

Independant of that - HAVE_RES_SEARCH is still not recognized correctly in both buildtypes.
 [2001-12-13 21:41 UTC] sniper@php.net
Please try the latest CVS snapshot with this configure line:

--with-apxs=/apache/bin/apxs  --without-mysql --disable-pear --disable-xml --disable-session --enable-debug

As I first want to rule out any extension being the reason for the
segfault.

--Jani

 [2001-12-14 15:40 UTC] msopacua at idg dot nl
Ok,

you can rule that out.
Compiles outof the box.
Build php4-200112140600.
 [2001-12-14 21:23 UTC] sniper@php.net
So with the minimum options everything works just fine?
If so, then please try adding some more options and see
when it starts to fail.

--Jani

 [2001-12-15 05:37 UTC] msopacua at idg dot nl
Ok, working on it.
2 notes on this build:
I get a lot of yacc warnings like these:
/usr/src/web/php/php4/ext/standard/var_unserializer.re:273: warning: label `yy1' defined but not used

And the XtOffsetOf is redefined:
In file included from /apbeta/include/httpd.h:72,
                 from sapi_apache.c:32:
/apbeta/include/ap_config.h:1367: warning: `XtOffsetOf' redefined


 [2001-12-15 06:43 UTC] derick@php.net
Those yacc warnings are harmless.
 [2001-12-15 12:31 UTC] msopacua at idg dot nl
Of course it was the last extension - in this case GD.

BSDi 4.2 now comes with both a shared zlib as a shared Jpeg. The zlib is ok, but I've made a jpeg 6.2 of my own.

There are a number of issues now surfacing, so should I open a new report on GD/BSDi 4.2 for these (HUP signal doesn't work anymore, linking with 2 libraries installed, makes it core dump)?

Remaining for this report:
1) incorrect detection of HAVE_RES_SEARCH braking getmxrr and other DNS related functions, work-around:
$ diff -c php_config.h.in php_config.h.in.dist
*** php_config.h.in     Fri Dec 14 21:13:55 2001
--- php_config.h.in.dist        Fri Dec 14 15:06:29 2001
***************
*** 1894,1903 ****
  #define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
  #endif

- #ifdef __bsdi__
-       #define HAVE_RES_SEARCH 1
- #endif
-
  /*
   * Local variables:
   * tab-width: 4
--- 1894,1899 ----

I have provided an example of how bind-9.x detects this function.

2) Release versions need a fix of the include statements in various files, since the old make syntax is used, for BSDi's system provided make, instead of the make preferred in the PATH and/or specified by $MAKE. This does not apply to snapshots.
 [2002-02-09 21:49 UTC] msopacua at idg dot nl
Ok, found 1 thing.
Could someone apply this or the equivalent?

$ diff -u configure.in.dist configure.in
--- configure.in.dist   Thu Dec 20 22:18:34 2001
+++ configure.in        Sun Feb 10 03:24:51 2002
@@ -105,7 +105,10 @@
 *darwin*|*rhapsody*)
     CPPFLAGS="$CPPFLAGS -traditional-cpp";;
 *bsdi*)
-    BSD_MAKEFILE=yes;;
+    if [ xGNU ! x`${MAKE} --version | sed -n -e "s|^GNU.*|GNU|p"` ]; then
+        BSD_MAKEFILE=yes
+    fi
+    ;;
 *beos*)
        beos_threads=1
        LIBS="$LIBS -lbe -lroot";;
 [2002-04-13 01:12 UTC] adam at trachtenberg dot com
I also got nailed by 4). When I try to build XSLT, -liconv isn't passed, so it can't find the iconv*() functions.

This is with RH 7.2 and the latest CVS.

I manually edited the Makefile to add -liconv to EXTRA_LIBS and everything compiled fine and works.
 [2002-06-06 20:51 UTC] sniper@php.net
I guess this one problem (make) is still true for CVS HEAD?

 [2002-06-07 15:15 UTC] msopacua at idg dot nl
Yep. Still applies.

The make thing, is not a big issue - just annoying.

The res_search problem is quite an issue, as it makes functions become unavailable.

I've submitted a patch for that, but it gave problems on other (which?) platforms.

Basically - res_search/inet_aton should be looked for, (with the right headers of course):
1) Without a lib (will work for any *BSD* and reduce php size)
2) With the current libs as in configure.in (socket/bind)
3) With -lbind and -lisc, as recent versions of Bind 9, don't link without -lisc.

I hope the build expert can take a look at this.

(I also wouldn't be surprised if option 1) would apply to Mac OS X as it has a BSDi-derived kernel)
 [2002-07-07 20:48 UTC] sniper@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

This was fixed by Sascha..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 15:01:28 2024 UTC