php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38997 Cannot configure PHP for cross-compilation with Apache 2.2.3
Submitted: 2006-09-29 19:18 UTC Modified: 2006-10-13 15:04 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: lstefani at fortresstech dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.1.6 OS: Linux 2.6.12
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lstefani at fortresstech dot com
New email:
PHP Version: OS:

 

 [2006-09-29 19:18 UTC] lstefani at fortresstech dot com
Description:
------------
After successfully cross-compiling Apache 2.2.3 on Linux x86 machine for MIPS target, PHP fails to configure properly with --with-apxs2= flag.  The reason for the failure is that PHP configure executes apxs utility, which executes httpd, but that binary was cross-compiled, so it fails to execute.

Reproduce code:
---------------
env ac_cv_func_fopencookie=no ac_cv_func_getaddrinfo=yes ac_cv_func_utime_null=yes ac_cv_func_waitpid=yes ac_cv_pread=yes ac_cv_pwrite=yes ac_cv_sizeof_long=4 ac_cv_php_xml2_config_path=/usr/apache/bin/xml2-config PKG_CONFIG_PATH=/usr/apache/lib/pkgconfig ac_cv_prog_CC=/buildtools/gcc-3.3.2-glibc-2.3.2/mips-linux/bin/mips-linux-gcc ./configure --host=mips-linux --target=mips-linux --without-iconv --without-mysql --without-pear --enable-sigchild --enable-bcmath --with-apxs2=/usr/apache/bin/apxs --with-libxml-dir=/usr/apache --prefix=/usr/apache


Expected result:
----------------
Successful configuration of PHP for subsequent make operation.  When configuring for cross-compilation, PHP configure should not be dependent on natively executing binaries that were built for other targets.  What information does PHP configure require of apxs and httpd?  Is there an alternative way to retrieve it?

Actual result:
--------------
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 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS...

Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /usr/apache/bin/apxs follows:
sh: /usr/apache/bin/httpd: cannot execute binary file
apxs:Error: Sorry, no shared object support for Apache.
apxs:Error: available under your platform. Make sure.
apxs:Error: the Apache module mod_so is compiled into.
apxs:Error: your server binary `/usr/apache/bin/httpd'..
configure: error: Aborting


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-29 20:29 UTC] tony2001@php.net
PHP _does_ need to execute apxs to get correct compilation flags, paths etc. required to compile Apache module. There is nothing we can do about it.
 [2006-09-29 21:24 UTC] lstefani at fortresstech dot com
Hi Tony,

Thanks for the quick response.  OK, so apxs and (indirectly) httpd must be executable.  Am I correct in assuming that if I were to temporarily install a native (X86) httpd to make PHP configure happy, I'd be in trouble because the native compilation flags are (obviously) different for the cross-compiled build?

Do you recommend that I attack this problem by removing the apxs dependency and pass in all of the compilation flags, paths, etc. that PHP needs to build the Apache module?

I'm highly motivated to make cross-compilation work because the alternative is to install all of the source trees, toolchains, etc. on the target platform and build natively.  That's just not practical for my development environment.

Thanks,
Larry Stefani
 [2006-10-02 14:29 UTC] lstefani at fortresstech dot com
Hi Tony,

I noticed that you marked the Status as Bogus.  If PHP isn't meant to be cross-compiled, I have not found any online documentation supporting that.  In fact, the --host= and --target= options within PHP 5.1.6's configure script suggest that cross-compilation *is* supported.

Assuming I'm correct that cross-compilation is a feature of PHP, I believe this bug should remain open.  Perhaps the Apache folks can address this by making apxs truly platform independent, instead of relying on binaries that may not necessarily be executable on the build system (I've logged a bug against Apache 2.2.3 on same).

Alternatively, perhaps the PHP configure script can be enhanced to support manual overrides of whatever is needed through the apxs -q command to support cross-compilation?

Thanks,
Larry
 [2006-10-02 15:19 UTC] tony2001@php.net
If you want apxs utility to be enhanced - please report it as a feature request to Apache developers.
There is nothing PHP can do about it.
 [2006-10-13 15:04 UTC] lstefani at fortresstech dot com
Just to close out this bug report...I implemented a workaround by manually running "apxs -q" on the target hardware (where apxs can execute httpd properly), taking the result, editing the PHP configure script, and replacing all $APXS -q references in the --with-apxs2= section with the results.  PHP configure then ran properly, and so did make, and I was able to successfully cross-compile libphp5.so.

Understanding from Tony that PHP needs the build information from Apache, what I'd like to see as enhancements are either

Apache dynamically create an apxs script that does *not* require executing httpd for simple queries (such as the ones PHP configure requires).  [I've logged this request on Apache Bugzilla database.]

or

PHP configure adds environment variable overrides for $APXS -q calls (as it does for other settings) so that configure doesn't have to be manually edited to avoid calling apxs during cross-compilation.

At the very least, I recommend adding a warning (failure) check to PHP configure when --with-apxs2= is set at the same time that cross-compilation is set (i.e. build != host).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 20:01:32 2024 UTC