ver5.2.3でデバッグ用ビルド

ちょっとだけgdbで調べたいことがあり、環境(CentOS5)と同じオプションに-gを付けてPHPをソースからビルドしようと思ったのだけれども、"php -i"で見たら100個近いconfigureオプションが付いていて腰を抜かした。

CC=gcc CXX=gcc CFLAGS='-g -O0' CXXFLAGS='-g -O0' \
./configure \
--build=i686-redhat-linux-gnu \
--host=i686-redhat-linux-gnu \
--target=i386-redhat-linux-gnu \
--program-prefix= \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/usr/com \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--cache-file=../config.cache \
--with-libdir=lib \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--disable-debug \
--with-pic \
--disable-rpath \
--without-pear \
--with-bz2 \
--with-curl \
--with-exec-dir=/usr/bin \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--without-gdbm \
--with-gettext \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/usr \
--with-openssl \
--with-png \
--with-pspell \
--with-expat-dir=/usr \
--with-pcre-regex=/usr \
--with-zlib \
--with-layout=GNU \
--enable-exif \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-track-vars \
--enable-trans-sid \
--enable-yp \
--enable-wddx \
--with-kerberos \
--enable-ucd-snmp-hack \
--with-unixODBC=shared,/usr \
--enable-memory-limit \
--enable-shmop \
--enable-calendar \
--enable-dbx \
--enable-dio \
--with-mime-magic=/etc/httpd/conf/magic \
--without-sqlite \
--with-libxml-dir=/usr \
--with-xml \
--enable-force-cgi-redirect \
--enable-pcntl \
--with-imap=shared \
--with-imap-ssl \
--enable-mbstring=shared \
--enable-mbstr-enc-trans \
--enable-mbregex \
--with-ncurses=shared \
--with-gd=shared \
--enable-bcmath=shared \
--enable-dba=shared \
--with-db4=/usr \
--with-xmlrpc=shared \
--with-ldap=shared \
--with-mysql=shared,/usr \
--with-mysqli=shared,/usr/bin/mysql_config \
--enable-dom=shared \
--with-dom-xslt=/usr \
--with-dom-exslt=/usr \
--with-pgsql=shared \
--with-snmp=shared,/usr \
--enable-soap=shared \
--with-xsl=shared,/usr \
--enable-xmlreader=shared \
--enable-xmlwriter=shared \
--enable-fastcgi \
--enable-pdo=shared \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-pdo-mysql=shared,/usr \
--with-pdo-pgsql=shared,/usr \
--with-pdo-sqlite=shared,/usr

長いよーながいよー。

configureしてみたら

通らない。ひとつ解決してもまた次のconfigureエラーが。orz

  • yum install pcre-develを実行
  • "--with-imap"を外す
  • "--with-imap-ssl"を外す
  • yum install unixODBCを実行
  • yum install unixODBC-develを実行
  • "--with-pgsql"を外す
  • "--with-pdo-pgsql"を外す
  • "--with-pspell"を外す
  • yum install net-snmpを実行
  • yum install net-snmp-develを実行

とりあえずこれでconfigureは通るように。いくつかオプション指定はずしちゃったけど、とりあえず自分的には影響なさげなので良としました。

よくわからないけどおまけで。

  • "--disable-debug"を"--enable-debug"に変更

makeしてみたら

コンパイル時(リンク時?)にエラーが発生。pcre関連の関数がundefinedだと怒られている。locateで探してみるとlibpcre.soは"/lib"配下にあるのにconfigureでは"/usr/lib"を指定していた。

  • "--with-pcre-regex=/usr"を"--with-pcre-regex"に変更

再configureして、再make。その後は問題なし。

make testだー

1931個中、5個失敗したけどいいのかな?

easter_date() [ext/calendar/tests/easter_date.phpt]
unixtojd() [ext/calendar/tests/unixtojd.phpt]
Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
json_encode() & endless loop - 3 [ext/json/tests/005.phpt]

make installだだだ

これでphpのバージョンもver5.1.6からver5.2.3にあがった。

mir@t43:~/php$ php -v
PHP 5.1.6 (cli) (built: Mar 14 2007 18:56:07) 
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
mir@t43:~/php$ php -v
PHP 5.2.3 (cli) (built: Jul 19 2007 11:31:49) (DEBUG)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

php.iniの場所

なんか、/etc/php.iniを読まなくなってしまった。なぜだー。

mir@t43:~/php$ php --ini
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)