php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77471 configure: error: cannot run test program while cross compiling
Submitted: 2019-01-16 15:44 UTC Modified: 2024-07-24 00:43 UTC
Votes:3
Avg. Score:3.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: stephane at qnap dot com Assigned: petk (profile)
Status: Closed Package: *Compile Issues
PHP Version: 7.2.14 OS: ubuntu 1404
Private report: No CVE-ID: None
 [2019-01-16 15:44 UTC] stephane at qnap dot com
Description:
------------
trying to cross compile PHP 7.2.14

autoconf is stuck on 

checking for FlatFile support... builtin
checking whether to enable DBA interface... yes, shared
checking whether to enable DOM support... yes
checking for xml2-config path... (cached) /opt/PHPFPM/bin/xml2-config
checking whether libxml build works...
checking for ENCHANT support... no
checking whether to enable EXIF (metadata from images) support... yes
checking for fileinfo support... yes
checking for strcasestr... configure: error: in `/SRC/.MYSCRIPT/tmp/php-7.2.14':
configure: error: cannot run test program while cross compiling
See `config.log' for more details

this error should passed and be inactiv when cross compiling

tried with PHP 7.3.1 .. it runs without issue with same config

config.log stuck at :

configure:28473: result: no
configure:28862: checking for CDB support
configure:28870: result: builtin
configure:28894: checking for INI File support
configure:28902: result: builtin
configure:28926: checking for FlatFile support
configure:28934: result: builtin
configure:28943: checking whether to enable DBA interface
configure:28947: result: yes, shared
configure:29235: checking whether to enable DOM support
configure:29270: result: yes
configure:29311: checking for xml2-config path
configure:29325: result: /opt/PHPFPM/bin/xml2-config
configure:29532: checking whether libxml build works
configure:29583: result: 
configure:29934: checking for ENCHANT support
configure:29970: result: no
configure:30544: checking whether to enable EXIF (metadata from images) support
configure:30579: result: yes
configure:30847: checking for fileinfo support
configure:30882: result: yes
configure:30897: checking for strcasestr
configure:30900: error: in `/SRC/.MYSCRIPT/tmp/php-7.2.14':
configure:30902: error: cannot run test program while cross compiling
See `config.log' for more details


Expected result:
----------------




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-16 15:55 UTC] nikic@php.net
Looks like this was fixed on 7.3 with https://github.com/php/php-src/commit/f2e4de8b567a632f132fe0fdc34bbb75fcf01518. We can backport this change, or at least the part pertaining to strcasestr.
 [2019-01-16 16:32 UTC] stephane at qnap dot com
I will try modify it..

but i wonder if it can be backported to 7.2.x branch

thanks a lot
 [2019-01-16 16:45 UTC] stephane at qnap dot com
seems solved by patching

lines moved from 7.3 to 7.2 a bit harder to modify manually

seems other codes need also backported...

i modify until opcache.. and opcache fail also if do not modify it with

checking for mmap() using shm_open() shared memory support... no
checking for mmap() using regular file shared memory support... no
checking "whether flock struct is linux ordered"... configure: error: in `/SRC/.MYSCRIPT/tmp/php-src-php-7.2.14':
configure: error: cannot run test program while cross compiling
See `config.log' for more details
 [2019-01-16 19:09 UTC] petk@php.net
Patching 7.2 with these issues might be simplest done to only fill the sensible defaults for the last argument of the AC_TRY_RUN macro [1]. Now there are some blank last arguments used in some places. The AC_TRY_RUN macro is an obsolete macro of the same functionality as its new version AC_RUN_IFELSE (which is used in 7.3). So basically even the migration to newer macro can be done for PHP 7.2 but simplest is probably to go manually through the AC_TRY_RUN occurrences and fill in the sensible defaults for the last argument. Last argument means what happens when cross compiling. End system can't be just run at this case because we are using one system to compile for another system where program can run differently...

I'll check if I can come up with some patch in some decent time here, otherwise send the pull request to go from there if possible, please.

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html
 [2021-03-27 11:05 UTC] petk@php.net
-Assigned To: +Assigned To: petk
 [2023-03-03 23:52 UTC] petk@php.net
-Status: Assigned +Status: Open -Assigned To: petk +Assigned To:
 [2024-07-24 00:43 UTC] petk@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: petk
 [2024-07-24 00:43 UTC] petk@php.net
Cross-compiling is improved in the upcoming PHP-8.4 with using cache variables (php_cv_*)

    ./configure --build=<build-triplet> --host=<target-triplet> \ 
        php_cv_<some_variable>=yes \
        php_cv_<another_variable>=yes

Not ideal yet, but it's getting there. The specific mentioned check for strcasestr has been also simplified to AC_CHECK_FUNCS only so it works also when cross-compiling.

In case of more issues please report back at https://github.com/php/php-src/issues

Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC