Cross compiling php

I am trying to cross compile php for hand and have good progress, but I am completely stuck where it wants to run php (I don’t know why). since this is a binary key, not intel (my building platform), it will not work:

/bin/sh: /path-to-build/sapi/cli/php: cannot execute binary file 

How can i fix this? The script configuration realized that I was cross-compiling, but did nothing with it (from the configuration log):

 checking whether the C compiler (/path-to-compiler/arm-none-linux-gnueabi-gcc) is a cross-compiler... yes 

I am compiling php-5.3.6 using the configure command line:

 export CC=/path-to-cc/arm-none-linux-gnueabi-gcc ../configure --prefix=/prefix-path/ --host=arm-none-linux-gnueabi --disable-libxml --disable-dom --disable-openssl --without-iconv --without-openssl --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear --without-sqlite --without-sqlite3 --disable-pdo --without-pdo-sqlite 
+6
source share
4 answers

I was able to solve this problem myself by disabling phar . I hope that disabling so many modules will not break something internal.

+5
source

Create without cross-compiling, and then, when cross-compiling, point to the php host version by overriding the variable in the make file on the command line when you run make.

Sort of:

 make PHP_VAR_NAME=path to php built for host 
+2
source

I managed to compile PHP for the hand with the following parameters:

 export PATH="$PATH:/toolchains/gnu_cortex-a9_tools/usr/bin" export ARCH=arm 

configure script:

 ./configure --build=x86_64-unknown-linux-gnu --host=arm-linux-uclibcgnueabi --prefix=/usr/arm CC="arm-linux-uclibcgnueabi-gcc --sysroot=/toolchains/gnu_cortex-a9_tools/" --disable-libxml --disable-dom --without-iconv --without-openssl --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear --without-sqlite3 --disable-pdo --without-pdo-sqlite --disable-phar 

followed by

 make 
+1
source

I managed to solve a similar problem when cross-compiling PHP 5.6.0 by editing the Makefile after running the configure script. Just replace all occurrences

$ (top_builddir) / $ (SAPI_CLI_PATH)

from

/ Usr / bin / php

Where /usr/bin/php is your php cli host. Make sure it is installed, for example, sudo apt-get install php5-cli for Debian / Ubuntu.

After that phar extension builds fine

+1
source

Source: https://habr.com/ru/post/891889/


All Articles