Page 1 of 1

Compiling PHP from source with xslt

Posted: Thu Jun 26, 2003 11:19 pm
by jonah
Been reading about compling php from source to enable xslt
functionality with sablotron and was proceeding nicely until I
got to adding MySQL support and creating a DSO for Apache.

I had compiled and installed libiconv and sablot as follows:

tar -xvzf libiconv-1.9.1.tar.gz
mv libiconv-1.9.1/ /usr/local/iconv
cd /usr/local/iconv
./configure
--prefix=/usr/local/iconv
--libdir=/usr/lib
--includedir=/usr/include
make makeinstall

tar -xvzf Sablot-0.98.tar.gz
mv Sablot-0.98/ /usr/local/sablot/
cd /usr/local/sablot
./configure
--prefix=/usr/local/sablot
gmake gmake install

However, when I got to PHP, in the instructions for configuring and
installing PHP:

tar -xvzf php-4.3.2.tar.gz
mv php-4.3.2/ /usr/local/php
cd /usr/local/php
./configure
--prefix=/usr/local/php
--with-xml
--enable-xslt
--with-xslt-sablot=/usr/local/sablot
--with-iconv
make
make install

I wanted to add:

--with-mysql=/[path to mysql] --with-apxs=/[path to apxs]

and realized that I was not sure what the path to mysql and apxs
should be since my Slackware distribution installed binary setups
for MySQL and Apache.

I'm no expert in installing software with this kind of integration and
need substantial help in this matter. Could someone point out how
to reference the appropriate files to include mysql and to create a
PHP module to include in httpd.conf?

Or do I have to have source files to do this?

Please don't hesitate to elaborate on any points you feel pertinent.

TIA

Posted: Fri Jun 27, 2003 2:07 am
by volka
it might be you don't need to type anything there ;)
the php sources come with bundled mysqlclient sources (maybe not the most recent but anyway) that are used if you ommit =/[path to mysql]
anyway the script looks for libmysqlclient.* and mysql.h
you might search for them and use this path, e.g. having /usr/include/mysql.h and /usr/lib/libmysqlclient.a the path to use would be /usr.
But first simply try configure without =/[path to mysql]


The configure script tests wether apxs can be found via PATH-settings.
Therefor try apxs -q from a commandline. If this starts the extension tool you're ready to go (since configure will try the same).
If not you might search for apxs: find / -name apxs -print (this may take a while, maybe "locate" is installed and locate apxs works)
If you can't find this file try to find the httpd executable instead and start it with the option -l : /path/to/httpd -l.
If this doesn't tell you anything about dynamic shared object (DSO) support you're busted (for now)

Posted: Fri Jun 27, 2003 10:05 am
by jonah
Apparently I'm going to need a little more help. I was able to get
output from apxs -q so I configured PHP as follows:

./configure
--prefix=/usr/local/php
--with-xml
--enable-xslt
--with-xslt-sablot=/usr/local/sablot
--with-iconv
--with-mysql
--with-apxs

Configure seemed to run OK so I went ahead with make and wound
up with these error messages:

ext/iconv/iconv.lo(.text+0x1a0): In function `php_iconv_string':
/usr/local/php/ext/iconv/iconv.c:217: undefined reference to `libiconv_open'
ext/iconv/iconv.lo(.text+0x1e2):/usr/local/php/ext/iconv/iconv.c:226: undefined reference to `libiconv'
ext/iconv/iconv.lo(.text+0x203):/usr/local/php/ext/iconv/iconv.c:239: undefined reference to `libiconv'
ext/iconv/iconv.lo(.text+0x228):/usr/local/php/ext/iconv/iconv.c:250: undefined reference to `libiconv_close'
/usr/local/sablot/lib/libsablot.so: undefined reference to `operator new[](unsigned)'
/usr/local/sablot/lib/libsablot.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/local/sablot/lib/libsablot.so: undefined reference to `operator delete(void*)'
/usr/local/sablot/lib/libsablot.so: undefined reference to `__gxx_personality_v0'
/usr/local/sablot/lib/libsablot.so: undefined reference to `__cxa_pure_virtual'
/usr/local/sablot/lib/libsablot.so: undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/local/sablot/lib/libsablot.so: undefined reference to `operator delete[](void*)'
/usr/local/sablot/lib/libsablot.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/usr/local/sablot/lib/libsablot.so: undefined reference to `operator new(unsigned)'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

It looks like I've got some sort of problem with libiconv and sablot
itself but I'm really not sure what to do next. What should I look for
in /usr/local/iconv and /usr/local/sablot to find out what is wrong?

TIA

Posted: Sat Jun 28, 2003 1:59 pm
by jonah
After hunting around a little bit I finally found:

http://www.protonicdesign.com/tutorial/faq.php

which indicates that for the symptoms above, I have to link
against libstc++ with 'export LDFLAGS=-lstdc++'

Once I did that and ran 'make' I still get:

ext/mysql/libmysql/my_tempnam.lo(.text+0x4c): In function `my_tempnam':
/usr/local/php/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam' is dangerous, better use `mkstemp'
ext/iconv/iconv.lo(.text+0x1a0): In function `php_iconv_string':
/usr/local/php/ext/iconv/iconv.c:217: undefined reference to `libiconv_open'
ext/iconv/iconv.lo(.text+0x1e2):/usr/local/php/ext/iconv/iconv.c:226: undefined reference to `libiconv'
ext/iconv/iconv.lo(.text+0x203):/usr/local/php/ext/iconv/iconv.c:239: undefined reference to `libiconv'
ext/iconv/iconv.lo(.text+0x228):/usr/local/php/ext/iconv/iconv.c:250: undefined reference to `libiconv_close'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

The sablot references are gone but I still have the 'mysql tempname'
which looks more like a warning and could probably be ignored and
the 'iconv' indefined references.

Any thoughts?

Posted: Sat Jun 28, 2003 3:44 pm
by volka
did you run a make clean before re-compiling php with LDFLAGS=-lstdc++?

Posted: Sat Jun 28, 2003 4:11 pm
by jonah
Tried a 'make clean' and re-ran make with LDFLAGS=-lstdc++
env variable.

Took a bit longer this time, but the same error messages
appeared.

Posted: Sun Jun 29, 2003 6:12 am
by volka
hm, sorry, only wild guessing
you might try to find the library (libiconv.so or libiconv.a) and use this path for --with-iconv=[path]
Where is the library located on your system?

Posted: Sun Jun 29, 2003 10:10 am
by jonah
Thanks for all your help!

I reconfigured PHP --with-iconv=/usr/lib

and the make and make install worked perfectly
even appending a message that the tempnam warning
in mysql could be safely ignored.

Restarted Apache and found that XSLT was working.

Obviously the configure references to mysql and apxs
worked without the path names.

Until next tme.