用于ARM的PHP交叉编译失败

时间:2018-08-23 17:46:18

标签: php c++ cross-compiling

当我尝试为ARM交叉编译PHP 7.1.9(我测试其他分支,相同的错误)时,出现以下错误:

korm@Notebook-1 ~/php-src $ make
/bin/bash /home/korm/php-src/libtool --silent --preserve-dup-deps --mode=compile arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/home/korm/php-src/ext/date/ -DPHP_ATOM_INC -I/home/korm/php-src/include -I/home/korm/php-src/main -I/home/korm/php-src -I/home/korm/php-src/ext/date/lib -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/libxml2 -I/home/korm/php-src/ext/mbstring/oniguruma -I/home/korm/php-src/ext/mbstring/libmbfl -I/home/korm/php-src/ext/mbstring/libmbfl/mbfl -I/home/korm/php-src/ext/sqlite3/libsqlite -I/home/korm/php-src/TSRM -I/home/korm/php-src/Zend    -I/usr/include -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include -pipe -g -feliminate-unused-debug-types -D_GNU_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -fvisibility=hidden -DZEND_SIGNALS   -c /home/korm/php-src/ext/date/php_date.c -o ext/date/php_date.lo 
cc1: warning: include location "/usr/include" is unsafe for cross-compilation [-Wpoison-system-directories]
In file included from /home/korm/php-src/Zend/zend_config.h:1:0,
             from /home/korm/php-src/Zend/zend_portability.h:48,
             from /home/korm/php-src/Zend/zend_types.h:27,
             from /home/korm/php-src/Zend/zend.h:31,
             from /home/korm/php-src/main/php.h:35,
             from /home/korm/php-src/ext/date/php_date.c:21:
/home/korm/php-src/include/../main/php_config.h:2585:15: error: duplicate ‘unsigned’
#define ulong unsigned long
           ^
/home/korm/php-src/include/../main/php_config.h:2582:14: error: duplicate ‘unsigned’
 #define uint unsigned int
          ^
/home/korm/php-src/include/../main/php_config.h:2582:23: error: two or more data types in declaration specifiers
 #define uint unsigned int
                   ^
In file included from /home/korm/php-src/Zend/zend_portability.h:54:0,
             from /home/korm/php-src/Zend/zend_types.h:27,
             from /home/korm/php-src/Zend/zend.h:31,
             from /home/korm/php-src/main/php.h:35,
             from /home/korm/php-src/ext/date/php_date.c:21:
/usr/include/stdio.h:41:10: fatal error: bits/libio.h: No such file or directory
 #include <bits/libio.h>
      ^~~~~~~~~~~~~~
compilation terminated.
Makefile:700: recipe for target 'ext/date/php_date.lo' failed
make: *** [ext/date/php_date.lo] Error 1

当我在php.config.h中删除以下行时,问题1已解决:

#define uint unsigned int
#define ulong unsigned long

这些行在php_config.h中是两次,为了解决该问题,我不得不将它们都删除。

问题2是Makefile中的这一行:

CFLAGS_CLEAN = -I/usr/include -I/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include -pipe -g -feliminate-unused-debug-types -D_GNU_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -fvisibility=hidden -DZEND_SIGNALS $(PROF_FLAGS)

如果我删除-I / usr / include,则一切正常。 同样的情况在这里发生: ext / iconv / iconv.lo:/home/korm/php-src/ext/iconv/iconv.c     $(LIBTOOL)--mode =编译$(CC)-I“ / usr / include” 如果我将/ usr / include更改为oecore-include,则一切正常。

给任何人一个提示,当我打电话./configure时如何避免这些错误?

我的工具链是从这里设置的: https://developer.toradex.com/getting-started/module-2-my-first-hello-world-in-c/configure-toolchain-colibri-imx7?som=colibri-imx7&board=colibri-evaluation-board

谢谢。

0 个答案:

没有答案