Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 14397 - PHP Ebuild incorrectly detects GCC 2 as cross-compiler
Summary: PHP Ebuild incorrectly detects GCC 2 as cross-compiler
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High critical (vote)
Assignee: PHP Bugs
: 16426 16954 27461 34937 (view as bug list)
Depends on:
Reported: 2003-01-22 17:40 UTC by Matthew Walker
Modified: 2003-12-02 16:44 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Walker 2003-01-22 17:40:58 UTC
When installing PHP 4.3 on my system running GCC 2.95.3, I get the following
output. This is obviously incorrect.

If you need any further info, please ask. 

I have tested the PHP configure script outside the ebuild system, and it worked 
just fine, properly detecting that GCC was not a cross compiler.

I also tried removing the -pipe and -O3 flags from the build options, and it 
still had the same problem.

arsenic root # emerge php
Calculating dependencies ...done!
>>> emerge (1 of 1) dev-php/php-4.3.0-r2 to /
>>> md5 ;-) php-4.3.0.tar.bz2
>>> Unpacking source...
>>> Unpacking php-4.3.0.tar.bz2
>>> Source unpacked.
Compiling imap with SSL support
creating cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for working sed... sed
checking host system type... i686-pc-linux-gnu
Updated php_version.h
checking for gcc... gcc
checking whether the C compiler (gcc -march=i686 -O3 -pipe ) works... yes
checking whether the C compiler (gcc -march=i686 -O3 -pipe ) is a
cross-compiler... yes
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for AIX... no
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for ranlib... ranlib
checking whether ln -s works... yes
checking for gawk... gawk
checking for bison... bison -y
checking bison version... 1.35 (ok)
checking for flex... flex
checking for yywrap in -lfl... yes
checking lex output file root... lex.yy
checking whether yytext is a pointer... yes
checking for working const... yes
checking flex version... 2.5.4 (ok)
checking for pthreads_cflags...
checking for pthreads_lib...

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
checking for mod_charset compatibility option... no
checking for Apache 2.0 module support via DSO through APXS... no
checking for Caudium support... no
checking for CLI build... yes
checking for embedded SAPI library support... no
checking for Zeus ISAPI support... no
checking for NSAPI support... no
checking for PHTTPD support... no
checking for Pi3Web support... no
checking for Roxen/Pike support... no
checking for Servlet support... no
checking for thttpd... no
checking for TUX... no
checking for webjames... no
checking for CGI build... no
checking for chosen SAPI module... cli

Running system checks
checking for missing declarations of reentrant functions... done
checking for sendmail... /usr/sbin/sendmail
checking whether system uses EBCDIC... no
checking for socket... yes
checking for htonl... yes
checking for gethostname... yes
checking for gethostbyaddr... yes
checking for yp_get_default_domain... no
checking for __yp_get_default_domain... no
checking for yp_get_default_domain in -lnsl... yes
checking for dlopen... yes
checking for sin in -lm... yes
checking for res_search... no
checking for __res_search... no
checking for res_search in -lresolv... yes
checking for res_search in -lbind... no
checking for __res_search in -lbind... no
checking for res_search in -lsocket... no
checking for __res_search in -lsocket... no
checking for inet_aton... yes
checking for dn_skipname... no
checking for __dn_skipname... no
checking for dn_skipname in -lresolv... no
checking for __dn_skipname in -lresolv... yes
checking for dn_skipname in -lbind... no
checking for __dn_skipname in -lbind... no
checking for ANSI C header files... yes
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for fclose declaration... ok
checking for ApplicationServices/ApplicationServices.h... no
checking for sys/types.h... yes
checking for sys/time.h... yes
checking for netinet/in.h... yes
checking for alloca.h... yes
checking for arpa/inet.h... yes
checking for arpa/nameser.h... yes
checking for assert.h... yes
checking for crypt.h... yes
checking for fcntl.h... yes
checking for grp.h... yes
checking for ieeefp.h... no
checking for langinfo.h... yes
checking for limits.h... yes
checking for locale.h... yes
checking for monetary.h... yes
checking for mach-o/dyld.h... no
checking for netdb.h... yes
checking for pwd.h... yes
checking for resolv.h... yes
checking for signal.h... yes
checking for stdarg.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for syslog.h... yes
checking for sysexits.h... yes
checking for sys/file.h... yes
checking for sys/mman.h... yes
checking for sys/mount.h... yes
checking for sys/poll.h... yes
checking for sys/resource.h... yes
checking for sys/select.h... yes
checking for sys/socket.h... yes
checking for sys/statfs.h... yes
checking for sys/statvfs.h... yes
checking for sys/vfs.h... yes
checking for sys/sysexits.h... no
checking for sys/varargs.h... no
checking for sys/wait.h... yes
checking for unistd.h... yes
checking for unix.h... no
checking for utime.h... yes
checking for sys/utsname.h... yes
checking for sys/ipc.h... yes
checking for fopencookie... yes
configure: error: can not run test program while cross compiling

!!! ERROR: dev-php/php-4.3.0-r2 failed.
!!! Function src_compile, Line 137, Exitcode 1
!!! bad ./configure
Comment 1 Martin Holzer (RETIRED) gentoo-dev 2003-01-22 17:44:43 UTC
please paste
#emerge info
Comment 2 Matthew Walker 2003-01-22 17:50:07 UTC
arsenic php-4.3.0 # emerge info
Portage 2.0.46-r9 (default-1.0, gcc-2.95.3, glibc-2.2.5-r2,2.2.5-r7)
System uname: 2.4.19-gentoo-r10 i686 Intel(R) Pentium(R) 4 CPU 1.60GHz
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/confi
g /usr/kde/3/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
USE="x86 mysql ssl crypt imap tcpd pam perl python gif jpeg png flash truetype 
xml xml2 libwww gd gdbm"
FEATURES="sandbox ccache"
Comment 3 Matthew Walker 2003-01-24 10:15:28 UTC
Any progress yet?
Comment 4 Ryan Phillips (RETIRED) gentoo-dev 2003-01-24 16:47:40 UTC
Matthew are you running the newest gcc-config?
Comment 5 Matthew Walker 2003-01-24 17:03:06 UTC
arsenic root # emerge -s gcc-config
[ Results for search key : gcc-config ]
[ Applications found : 1 ]

*  sys-devel/gcc-config
      Latest version available: 1.2.7
      Latest version installed: 1.2.7
      Size of downloaded files: 0 kB
      Description: Utility to change the gcc compiler being used.

arsenic root #
Comment 6 Matthew Walker 2003-01-24 17:16:48 UTC
Just in case you ask:

arsenic root # gcc-config --get-current-profile
Comment 7 Ryan Phillips (RETIRED) gentoo-dev 2003-01-27 12:48:34 UTC
Matthew: Try the latest masked gcc config.  ACCEPT_KEYWORDS="~x86" emerge
gcc-config.  I cannot recreate the error.
Comment 8 Ryan Phillips (RETIRED) gentoo-dev 2003-01-27 12:49:13 UTC
I'm using gcc-config 1.3.1
Comment 9 Matthew Walker 2003-01-27 13:08:05 UTC
Okay, just installed gcc-config 1.3.1, and I'm getting exactly the same 
Comment 10 Matthew Walker 2003-01-27 18:18:19 UTC
Just a note:

I just had to restart my Apache server, which forced me to figure out a way to 
get PHP to rebuild. (My old PHP was linked against a library that no longer 
exists on my system...)

I managed to get it to work by executing the ebuild one step at a time except 
for the configure step. I forced the ebuild to just output the configure line 
it would have run, and ran it myself on the portage working directory. It 
worked properly, and I was able to continue with the step-by-step ebuild.

Just in case, I'm going to re-emerge Python and Portage and see if that fixes 
the problem, since it's apparently some kind of issue with the Portage build 
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-30 16:05:47 UTC
Works fine here with gcc-2.95.3

nosferatu php-4.3.0 # epm -q gcc gcc-config
nosferatu php-4.3.0 # 
Comment 12 Matthew Walker 2003-01-30 16:35:49 UTC
I'm willing to let Ryan in to take a look at my box firsthand, if you want. As I said, I've found a workaround, but it's a pain in the butt to do, so I'd like to get this solved.
Comment 13 Ryan Phillips (RETIRED) gentoo-dev 2003-01-30 17:08:54 UTC
Matthew: email me at
Comment 14 Martin Schlemmer (RETIRED) gentoo-dev 2003-02-01 00:39:53 UTC
Include output of 'gcc -v' please.
Comment 15 Matthew Walker 2003-02-03 10:48:49 UTC
arsenic root # gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 20010315 (release)

Also, Ryan logged in and did a lot of poking around. The problem is somehow related to the 'xml' use flag, and the portage environment. I'm not sure what all he discovered, so you'll have to get the details from him. But, for the time being, I've got a working system.
Comment 16 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-02-25 00:02:47 UTC
I unmasked mysql-4.0.10 to install it on my box, and trying to rebuild PHP (4.3.1) afterwards, I get the same error about cross-compiling. I also tried the latest PHP-4.3.1-r1, with the same result. Removing -O3/-pipe from the CFLAGS has no effect.

I'm busy rebuilding glibc on a hunch at the moment.

emerge info:
Portage 2.0.46-r12 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r3)
System uname: 2.4.20-gentoo-r1 i686 Pentium III (Katmai)
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/afs/C /etc/afs/afsws /etc/env.d"
USE="x86 libg++ -3dfx -3dnow aalib acl acpi afs alsa apache2 apm arts avi berkdb bonobo canna cdr cjk crypt cups dga directfb doc dvd encode esd ethereal evo fbcon flash freewnn gb gd ggi gif -gnome gphoto2 gps gtk gtk2 gtkhtml guile imap imlib innodb ipv6 java jikes jpeg junit kde -kerberos lcms ldap leim libgda libwww maildir -matrox mbox mikmod motif mozilla mpeg -mule mysql nas nls oav -oci8 oggvorbis opengl oss -pcmcia -pda pdflib plotutils png pnp -postgres qt -qtmt quicktime ruby samba sasl scanner sdl slp snmp socks5 spell sse svga tcltk tcpd tetex tiff truetype trusted usb -voodoo3 wavelan wmf X xface xml xml2 xmms xv gdbm gpm mmx ncurses pam perl pic python readline slang ssl zlib mozsvg mozcalender mozaccess mozinterfaceinfo mozp3p mozxmlterm"
CFLAGS="-march=pentium3 -O3 -pipe"
CXXFLAGS="-march=pentium3 -O3 -pipe"
FEATURES="sandbox ccache buildpkg distcc"

gcc-config --get-current-profile:

gcc-config --list-profiles:

server1 emerge # epm -q gcc gcc-config binutils

gcc -v:
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/specs
Configured with: /var/tmp/portage/gcc-3.2.2-r1/work/gcc-3.2.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.2 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,ada,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext
Thread model: posix
gcc version 3.2.2

Comment 17 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-02-25 08:55:45 UTC
solution found!

it's because of net-libs/libwww and >=mysql-4

net-libs/libwww contains:
which both link against ...

I had mysql-3 installed, but upgraded to mysql-4 because i needed some advanced features only in the 4 line.

then, going to build my php, it was failing with that error.

when the PHP configure tries to build it's conftest for cross complining
it links against xmltok and xmlparse. since then link to and that file no longer exists (it became with mysql-4) the conftest wouldn't run, and the way the script was set up, it detected this as a cross-compiler.

the ebuilds for net-libs/libwww all contain: 

the change to exclude mysql-4 was made because of bug 15099 

I'm going to write up some fixes to libwww and submit them to w3c for this.

I've temporarily done:
USE="-mysql" emerge net-libs/libwww
so that I can get to rebuilding my PHP
Comment 18 Matthew Walker 2003-02-25 14:22:42 UTC
Great! Thanks for all the info. I'll keep this in mind in the future.
Comment 19 SpanKY gentoo-dev 2003-03-03 04:34:16 UTC
*** Bug 16426 has been marked as a duplicate of this bug. ***
Comment 20 SpanKY gentoo-dev 2003-03-03 04:36:09 UTC
glad you guys found the answer :)
Comment 21 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-03-03 06:24:24 UTC
I haven't got to writing any patches for libwww yet so it can compile, but can something more sensible be done with the libwww ebuild so that it only compiles in support for MySQL if the version is less than 4 ? and DOESN'T give a warning otherwise.
Comment 22 SpanKY gentoo-dev 2003-03-06 06:47:03 UTC
*** Bug 16954 has been marked as a duplicate of this bug. ***
Comment 23 Sébastien Champigny 2003-03-06 18:31:56 UTC
I didn't found anything about php cross compiling error during my search and didn't notice this bug report before posting the bug 16954.

Sorry and thank you to you all.
Comment 24 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2003-08-12 01:21:30 UTC
Closing bug properly.
Comment 25 Stuart Herbert (RETIRED) gentoo-dev 2003-08-28 04:47:21 UTC
*** Bug 27461 has been marked as a duplicate of this bug. ***
Comment 26 SpanKY gentoo-dev 2003-12-02 16:44:51 UTC
*** Bug 34937 has been marked as a duplicate of this bug. ***