Hi all,
Solaris8, PHP5.0.1, LIBXML2

Quite frustrated with my attempt to upgrade to PHP5. My problem seems to revolve around the libxml library. First off, I have no idea what is meant by statically and dynamically linking and
setting compiler flags, so please be verbose if you have a solution to my problem.

I compiled and installed the latest libxml2 into the default location. I also installed it into my home directory for
giggles, and to see if it would make any difference. Anyway, when I run the configure command below:

My configure command:
./configure --prefix=/opt/php --with-config-file-path=/opt/php
--with-libxml-dir=/home/schmijl/opt/lib --disable-cgi --without-sq
lite --with-mysql=/home/schmijl/src/mysql-standard-4.0.20-sun-solaris2.8-sparc
--with-zlib-dir=/home/schmijl/opt --enable-ftp --w
ith-gd --with-apxs=/opt/apache/bin/apxs --with-sybase-ct=/opt/sybase/current

It stops with this error:

<snip>
Configuring extensions
checking whether to enable LIBXML support... yes
checking libxml2 install dir... /home/schmijl/opt/lib
checking whether libxml build works... no
configure: error: build test failed. Please check the config.log for details.
[schmijl@marge]/home/schmijl/src/php-5.0.1:

You can interchange --with-libxml-dir=/home/schmijl/opt/lib
with
--with-libxml-dir=/usr/local
--with-libxml-dir=/usr/local/lib
and no specification at all, it always comes back with the same error.

From the tail of the config.log:

configure:17846: checking whether to enable LIBXML support
configure:17893: checking libxml2 install dir
configure:18053: checking whether libxml build works
configure:18080: gcc -o conftest -g -O2 -D_POSIX_PTHREAD_SEMANTICS -R/opt/tools/lib=

-R/usr/ucblib -L/usr/ucblib -R/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2

-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2 -R/usr/local/lib -L/usr/local/lib conftest.c

     -lresolv -lm -ldl -lnsl -lsocket  -lgcc -lxml2 -lz -lm -lsocket -lnsl 1>&5

configure: failed program was:
#line 18069 "configure"
#include "confdefs.h"

char xmlInitParser();
int main() {
  xmlInitParser();
  return 0;
}

The information in the config.log makes no sense to me. Can anyone explain what's going on here?
Many thanks!!
-j

    How did you compile libxml2 ?

    Thomas

      18 days later

      I've having the same exact problem, with almost the same exact messages. I used the RPM's to install libxml2, libxml2-python, and libxml2-devel.

      Can anyone help? Or, did you ever resolve the issue? I'm kinda stuck, like you were.

      Thanks.

      EDIT: Sorry, forgot to mention. I'm running Red Hat 9, on the server install (command line only)

        After getting that error message, try to execute the gcc command that doesn't work manually without the redirection (1>&5).

        Which error do you get ?

        Thomas

          Sorry, real linux noob :queasy:

          What do you mean? How do I do that?

            You should have a config.log file in the source directory. It should contain the gcc command that failed like the one in hackrzme's post.

            Please post the part of the config.log file that contains the error message and gcc command including the code snipplet that failed.

            Thomas

              Ah, gotcha. Here's the end of my config.log file:

              configure:17846: checking whether to enable LIBXML
              configure:17893: checking libxml2 install dir
              configure:18053: checking whether libxml build works
              configure:18080: gcc -o conftest -g -O2 conftest.c

              -lresolv -lm -ldl -lnsl -lxml2 -lz -lm 1>&5

              /usr/bin/ld: cannot find -lz
              collect2: ld returned 1 exit status
              configure: failed program was:
              #line 18069 "configure"
              #include "confdefs.h"

              char xmlInitParser();
              int main() {
                xmlInitParser();
                return 0;
              }

              So I ran the command: gcc -o conftest -g -O2 conftest.c -lresolv -lm -ldl -lnsl -lxml2 -lz -lm

              Here's what I got back: gcc: conftest.c: No such file or directory

              I also tried "locate conftest". Nothing.

              I guess that means I need to get that file. Where can I get it? I tried to Google it, but I couldn't find a place to get it.

                The lines after configure: failed program was: show you the code.
                Create a file named conftest.c which contains:

                #include "confdefs.h" 
                
                
                char xmlInitParser(); 
                int main() { 
                xmlInitParser(); 
                return 0; 
                } 
                

                Then execute that gcc command.

                Thomas

                  I got...

                  /usr/bin/ld: cannot find -lz
                  collect2: ld returned 1 exit status

                  I Googled that and someone said that you should install zlib, so I'll try that and see how it goes.

                    Write a Reply...