I'm doing a PHP compile for New York PHP's AMD64 Project. The goal is
to enable all the hottest and modern extensions, and then let people
hack with their favorite extensions to find problems and bugs under a
64bit architecture. We're running SuSE Enterprise 9.1 on a dual AMD64
Opteron box, with 4GB of RAM.
I notice a number of strange issues while running ./configure. Most of
which I've been able to work through, and which I've documented to be
revisited later (the complete process of setting the box up is
documented and will be on nyphp.org when completed).
However, there is one issue I'm pretty unclear on - and, unfortunately
it might relate to some of the other issues, which makes matters more
confusion.
I can post the entire ./configure if requested, but this is pertinent at
this point:
....<snip>
--with-dom=/usr/lib64 --with-zlib-dir=/usr/lib64
--with-dom-xslt=/usr/lib64 --with-dom-exslt=/usr/lib64
--enable-exif --enable-ftp
--with-gd=/usr/lib64 --with-jpeg-dir=/usr/lib64
--with-png-dir=/usr/lib64 --with-zlib-dir=/usr/lib64
--with-freetype-dir=/usr/lib64
....</snip>
The ./configure stops with this error message:
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for jpeg_read_header in -ljpeg... no
configure: error: Problem with libjpeg.(a|so). Please check config.log
for more information.
And config.log contains this relevant snippet at the end:
configure:29794: checking whether to enable truetype string function in
GD
configure:29819: checking whether to enable JIS-mapped Japanese font
support in GD
configure:31813: checking for jpeg_read_header in -ljpeg
configure:31832: gcc -o conftest -g -O2 -Wl,-rpath,/usr/lib64
-L/usr/lib64 -Wl,-rpath,/usr/ssl/lib -L/usr/ssl/lib conftest.c -ljpeg
-lexslt -lxml -lxslt -lz -lcurl -lbz2 -lz -lresolv -lm -ldl -lnsl -lssl
-lcrypto -ldl -lcurl -lz -lssl -lcrypto -ldl -lxml2 -lz -lm 1>&5
usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/../../../../x86_64-suse-linux
/bin/ld: cannot find -lxml
collect2: ld returned 1 exit status
configure: failed program was:
#line 31821 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. /
/ We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char jpeg_read_header();
int main() {
jpeg_read_header();
return 0;
}
At first glance, it appears the problem is in libjpeg - but it's not.
Notice "cannot find -lxml"
I have only libxml2 installed:
amd:~/INSTALLED/php-4.3.8 # ldconfig -p | grep -i libxml
libxml2.so.2 (libc6,x86-64) => /usr/lib64/libxml2.so.2
libxml2.so.2 (libc6) => /usr/lib/libxml2.so.2
libxml2.so (libc6,x86-64) => /usr/lib64/libxml2.so
amd:~/INSTALLED/php-4.3.8 #
So why is it looking for -lxml? I haven't been able to spot a --without
flag that does the trick, either. There is also the link flag of
-lxml2, which is correct. Am I missing something here, or do I really
need to install libxml in addition to libxml2 (which totally doesn't
seem right)?
So that's the main question right now.
There are some other issues that I've mostly worked around, but figure
I'll drop by this list for additional comments and thoughts. And, they
might add some complications to the issue above.
-- In general, I've found that PHP's ./configure tends to assume things
are in /usr/lib. However, on this and other 64bit x86 platforms, what
we want is typically in /usr/lib64. A prime example of this is libjpeg.
After the RPM's install, ./configure couldn't find libjpeg, even though
ldconfig knew where it was - it is in /usr/lib64. The error:
configure: error: libjpeg.(a|so) not found.
The solution: symlink libjpeg.so from /usr/lib64 into /usr/lib - but is
this right? I've tried numerous flags to configure, but nothing worked.
When examining config.log in this case, I see "gcc -o conftest
-L/usr/lib64...." which looks to be on the right track, yet ./configure
is still breaking.
-- On a similar note is the specifying of specific directories. In the
./configure snippet above, you'll notice I typically use /usr/lib64 with
any --with directive. I know this might be wrong, but using /usr
doesn't help either (for instance, --with-jpeg-dir=/usr doesn't work).
In fact, there appear to be some inconstancies, and certainly some
questions:
--with-openssl (must not have any directory after it, which isn't
inline with what ./configure --help says).
--with-zlib=/usr (this works - but what if I want to force the 64bit
library version, in /usr/lib64?)
--with-bz2=/usr/lib64 (and this also works - which you would think it
shouldn't, compared to the zlib above?)
And lastly, take these:
--with-curl=/usr/lib64
--with-zlib-dir=/usr/lib64
Both seem to work (so far). So what is the difference between a
directive having the -dir suffix and not?
For most compiles, I just set everything to /usr/local and /usr and it
works. Occasionally, there are problems, but they are usually easily
resolved with ldconfig runs, etc. However, in this case, having lib64
seems to have added another level of complexities and possible
permutations of what doing The Right Thing really is. Are these
potentially bugs and mis-documentations, or simply me missing the
obvious?
Any thoughts appreciated, thanks all,
Hans Zaunere
President
New York PHP
http://nyphp.org
In message 41EE526EC2D3C74286415780D3BA9F87046F7AFC@ehost011-1.exch011.intermedia.net
on Fri, Sep 24, 2004 at 07:21:45PM -0700, Hans Zaunere wrote:
However, there is one issue I'm pretty unclear on - and, unfortunately
it might relate to some of the other issues, which makes matters more
confusion.
[...]
-- In general, I've found that PHP's ./configure tends to assume things
are in /usr/lib. However, on this and other 64bit x86 platforms, what
we want is typically in /usr/lib64. A prime example of this is libjpeg.
[...]
configure: error: libjpeg.(a|so) not found.
[...]
The solution: symlink libjpeg.so from /usr/lib64 into /usr/lib - but is
this right? I've tried numerous flags to configure, but nothing worked.
When examining config.log in this case, I see "gcc -o conftest
-L/usr/lib64...." which looks to be on the right track, yet ./configure
is still breaking.
Yes, the PHP4 ./configure internals have been broken in this way for a
number of years and bug reports have been filed accordingly. As you have
noted, the compiler has no difficulty finding the libs but the configure
script itself fails while performing its own (spurious) path search.
This is an artificial failure and cannot be corrected with command-line
options in the version you are using (4.3.8, by the looks of it). If
this is the problem you are experiencing, then all you need to do is
hack ./configure so that it ignores these "errors". For example, if
./configure fails on this:
{ echo "configure: error: libjpeg.(a|so) not found." 1>&2; exit 1; }
then you can make PHP4 compile fully and correctly by changing it to
this:
{ echo "configure: error: libjpeg.(a|so) not found." 1>&2; }
In message 41EE526EC2D3C74286415780D3BA9F87046F7AFC@ehost011-1.exch011.intermedia.net
on Fri, Sep 24, 2004 at 07:21:45PM -0700, Hans Zaunere wrote:However, there is one issue I'm pretty unclear on - and, unfortunately
it might relate to some of the other issues, which makes matters more
confusion.
[...]
-- In general, I've found that PHP's ./configure tends to assume things
are in /usr/lib. However, on this and other 64bit x86 platforms, what
we want is typically in /usr/lib64. A prime example of this is libjpeg.
[...]
configure: error: libjpeg.(a|so) not found.
[...]
The solution: symlink libjpeg.so from /usr/lib64 into /usr/lib - but is
this right? I've tried numerous flags to configure, but nothing worked.
When examining config.log in this case, I see "gcc -o conftest
-L/usr/lib64...." which looks to be on the right track, yet ./configure
is still breaking.Yes, the PHP4 ./configure internals have been broken in this way for a
number of years and bug reports have been filed accordingly. As you have
noted, the compiler has no difficulty finding the libs but the configure
script itself fails while performing its own (spurious) path search.
This is an artificial failure and cannot be corrected with command-line
options in the version you are using (4.3.8, by the looks of it).
Can't you just do:
LDFLAGS=-L/usr/lib64 ./configure ...
CPPFLAGS for compile-time stuff
-Rasmus
In message Pine.LNX.4.58.0409251306510.13895@t42p.lerdorf.com
on Sat, Sep 25, 2004 at 01:12:15PM -0700, Rasmus Lerdorf wrote:
Can't you just do:
LDFLAGS=-L/usr/lib64 ./configure ...
CPPFLAGS for compile-time stuff
The compiler and linker have no problem. The problem is that the
./configure script does its own library path search, independently
of the compiler and linker (why?) and it uses its own hard-coded paths.
The compiler and linker have no problem finding the libraries, yet the
./configure attempts to pre-empt them and fails. Failure of ./configure
does not indicate any compilation or linking problem in these cases.
The failed tests have no bearing on the success or failure of PHP --
./configure doesn't even set any flags as a consequence of these tests.
The practice has been on the increase in the ./configure system and
appears to be used in both PHP 4.3.9 and 5.0.1. For example:
% cd php-4.3.9; grep 'test -f./lib/lib' ./configure | wc -l
42
% cd ../php-5.0.1; grep 'test -f./lib/lib' ./configure | wc -l
36
Hans Zaunere wrote:
I notice a number of strange issues while running ./configure.
For what it's worth: I never experienced any of the problems you
describe with PHP (PHP_4_3, PHP_5_0, HEAD) on my AMD64 box which runs on
Gentoo Linux (~amd64).
--
Sebastian Bergmann http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69