php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61839 [patch] Unable to cross-compile PHP with --enable-fpm
Submitted: 2012-04-24 15:12 UTC Modified: 2012-05-23 09:42 UTC
From: bos at je-eigen-domein dot nl Assigned: fat (profile)
Status: Closed Package: FPM related
PHP Version: 5.4.0 OS: Cross compiled Linux
Private report: No CVE-ID: None
 [2012-04-24 15:12 UTC] bos at je-eigen-domein dot nl
Description:
------------
When cross-compiling PHP for a different architecture, configure fails if you 
specify the --enable-fpm option:

==
checking for ptrace... yes
checking whether ptrace works... configure: error: in 
`/hdd/max/dev/raspberry/buildroot-berryserver/output/build/php-5.4.0':
configure: error: cannot run test program while cross compiling
See `config.log' for more details.
==

Obviously it is impossible to execute a test program when the system you are 
compiling on is not the target system.

Attached a patch that skips running the test programs when cross-compiling.


Patches

php-configure-cross.patch (last revision 2014-06-13 17:07 UTC by sob at evomer-domein dot nl)
tafoda (last revision 2014-06-13 14:28 UTC by fredy at tecsysbrasil dot com dot br)
php-fpm-cross.patch (last revision 2012-04-24 15:13 UTC by bos at je-eigen-domein dot nl)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-25 08:13 UTC] laruence@php.net
-Assigned To: +Assigned To: fat
 [2012-05-23 09:41 UTC] fat@php.net
Automatic comment on behalf of fat
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0b44f16ea2f18a08eb1249db6621840527eab5e0
Log: - Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm)
 [2012-05-23 09:41 UTC] fat@php.net
Automatic comment on behalf of fat
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0b44f16ea2f18a08eb1249db6621840527eab5e0
Log: - Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm)
 [2012-05-23 09:42 UTC] fat@php.net
-Status: Assigned +Status: Closed
 [2012-05-23 09:42 UTC] fat@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

thx for the patch
 [2014-10-07 23:25 UTC] stas@php.net
Automatic comment on behalf of fat
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=0b44f16ea2f18a08eb1249db6621840527eab5e0
Log: - Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm)
 [2014-10-07 23:36 UTC] stas@php.net
Automatic comment on behalf of fat
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=0b44f16ea2f18a08eb1249db6621840527eab5e0
Log: - Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm)
 [2019-08-22 09:24 UTC] Marcedo at HabMalNeFrage dot de
Had to dive a littl deeper because of cross-compileing php5.6.40 resulted, even ,with the patch, in a binary with unsupoorted extensions. Found that acincludes.m4-PHP_CHECK_FUNC_LIB cant compile its test in the cross-compile environment an so opts out with found=no reverting any other choice made before.

Test:
--- acinclude.m4
+++ acinclude.m4
@@ -1904,10 +1904,11 @@
     AC_CHECK_LIB($2, __$1, [found=yes], [found=no])
   ])
 
+  // Add the opportunity to define how PHP_CHECK_FUNC_LIB handles a cross-build in configure.in
   if test "$found" = "yes"; then
     ac_libs=$LIBS
     LIBS="$LIBS -l$2"
-    AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=no])
+    AC_TRY_RUN([main() { return (0); }],[found=yes],[found=no],[found=$with_freetz_fix_cross])
     LIBS=$ac_libs
   fi

--- configure.in
+++ configure.in
@@ -453,10 +453,14 @@
 PHP_CHECK_FUNC(gethostbyaddr, nsl)
 PHP_CHECK_FUNC(yp_get_default_domain, nsl)
 
+# PHP_CHECK_FUNC->_AC_CHECK_FUNC->PHP_CHECK_FUNC_LIB
+# Define how to call AC_TRY_RUN in PHP_CHECK_FUNC_LIB when cross-compiling")
+$with_freetz_fix_cross=yes
 PHP_CHECK_FUNC(dlopen, dl)
 if test "$ac_cv_func_dlopen" = "yes"; then
   AC_DEFINE(HAVE_LIBDL, 1, [ ])
 fi
+$with_freetz_fix_cross=no
 AC_CHECK_LIB(m, sin)
 
 dnl Check for inet_aton

have a nice day,
Marcedo
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC