2011-07-02 225 views
6

我想交叉编译php的手臂,并有很好的进展,但我完全卡住它想要运行PHP本身(不知道为什么)。因为它是一个二进制的手臂,而不是英特尔(我的建筑平台),它不会运行:交叉编译php

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

我怎样才能解决这个问题?配置脚本明白我是交叉编译,但没有做任何事情(从配置日志):

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

我编译php-5.3.6与configure命令行:

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 
+0

我把工具链的路径,只是没有设置'CC'然后指定'--host =手臂-NONE-Linux的gnueabi'应该让'configure'找到一切都需要:编译器,链接器,条等 –

+0

它没关系......它在php上失败,不在工具 – Dani

+0

你确定它链接正确吗?我的意思是这不是因为CC是arm-none-linux-gnueabi-gcc,'configure'正确地解析了其他工具链的工具......“无法执行二进制文件”可以表示链接问题,因为'configure'没有使用正确的链接器(因为你没有设置'LD') –

回答

5

我能通过禁用phar来解决这个问题。我希望禁用这么多模块不会破坏内部的某些东西。

+1

有没有地方可以解释你是如何完成这个过程的?我现在想做同样的事情,并且很困难。 – meanbunny

2

构建时无需交叉编译,然后在交叉编译时,通过在运行make时在命令行上重写makefile中的变量来指向主机版本的php。

喜欢的东西:

make PHP_VAR_NAME=path to php built for host 
1

我设法编译PHP的手臂以下参数:

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

配置脚本:

./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 

其次

make 
1

我在运行configure脚本后通过编辑Makefile来设法解决类似问题,同时交叉编译PHP 5.6.0。只需更换的

$所有出现(top_builddir)/ $(SAPI_CLI_PATH)

在/ usr/bin中/ PHP

哪里/usr/bin/php为您的主机php cli。确保已安装它,例如,用于Debian/Ubuntu的sudo apt-get install php5-cli

这样Phar扩展后建立精细