我正在尝试使用Ubuntu 14.04 32位VM交叉编译Apache系统。我能够构建所有必需的库(PCRE,APR,APR-Util,Libtool),配置脚本运行正常。但是,当我运行make命令时,我收到以下错误。在这一点上,我完全迷失了如何解决这个问题。
util.c: In function ‘ap_parse_token_list_strict’:
util.c:1528:14: error: ‘T_HTTP_TOKEN_STOP’ undeclared (first use in this
function)
util.c:1528:14: note: each undeclared identifier is reported only once for
each function it appears in
util.c: In function ‘ap_scan_http_field_content’:
util.c:1602:14: error: ‘T_HTTP_CTRLS’ undeclared (first use in this
function)
util.c: In function ‘ap_scan_http_token’:
util.c:1612:14: error: ‘T_HTTP_TOKEN_STOP’ undeclared (first use in this
function)
util.c: In function ‘ap_scan_vchar_obstext’:
util.c:1622:13: error: ‘T_VCHAR_OBSTEXT’ undeclared (first use in this
function)
util.c: In function ‘ap_find_token’:
util.c:1683:22: error: ‘T_HTTP_TOKEN_STOP’ undeclared (first use in this
function)
util.c: In function ‘ap_escape_logitem’:
util.c:2092:13: error: ‘T_ESCAPE_LOGITEM’ undeclared (first use in this
function)
util.c: In function ‘ap_escape_errorlog_item’:
util.c:2162:13: error: ‘T_ESCAPE_LOGITEM’ undeclared (first use in this
function)
util.c: In function ‘ap_append_pid’:
util.c:2480:25: warning: format ‘%lld’ expects argument of type ‘long long
int’, but argument 5 has type ‘__pid_t’ [-Wformat]
make[2]: *** [util.lo] Error 1
以下是我用来配置
的脚本#!/bin/sh
export PATH=$PATH
export ARCH=armv7l
export CROSS_COMPILE=arm-linux-gnueabi-
export CC=arm-linux-gnueabi-gcc
export LD=arm-linux-gnueabi-ld
export LD_LIBRARY=/home/kyle/httpd/srclib/expat/bin
export CXX=arm-linux-gnueabi-g++
export AR=arm-linux-gnueabi-ar
export CPP=arm-linux-gnueabi-cpp
export STRIP=arm-linux-gnueabi-strip
export CC_FOR_BUILD=i686-linux-gnu-gcc
./configure \
--host=arm-linux-gnueabi \
--target=arm-linux-gnueabi \
--prefix=/home/kyle/httpd \
--build=i686-cross-linux-gnu \
--with-apr=/home/kyle/httpd/srclib/apr \
--with-apr-util=/home/kyle/httpd/srclib/apr-util \
--with-pcre=/home/kyle/httpd/srclib/pcre \
--with-expat=/home/kyle/httpd/srclib/expat \
--disable-libtool-lock \
ac_cv_file__dev_zero=no \
ac_cv_func_setpgrp_void=no \
apr_cv_tcp_nodelay_with_cork=no \
ap_cv_void_ptr_lt_long=4 \
ac_cv_sizeof_struct_iovec=1
****编辑:我相信我找到了解决方案****
问题是我正在从APR复制gen_test_char以解决它的已知错误,但这与httpd / server中的gen_test_char不同。所以一个简单的解决方法是运行make命令等待它失败,因为gen_test_char的格式错误,然后运行
gcc gen_test_char.c -I"(where ever apr is)/apr/include" -o gen_test_char
在此次运行之后再次制作,一切都应该有效。
答案 0 :(得分:0)
导出您的工具链路径
export PATH = $ PATH:/usr/local/linaro-aarch64-2017.08-gcc7.1/bin
---------------------------------------- pcre-的步骤8.43 ----------------------------------------
tar xvjf pcre-8.43.tar.bz2
cd pcre-8.43
./configure --prefix=/mnt/flash2/apache2_server --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-gcc-ar STRIP=aarch64-linux-gnu-strip RANLIB=aarch64-linux-gnu-ranlib
make
make install DESTDIR=/home/ahmcpu2176/Downloads/apache2_server
cd ..
---------------------------------------- libexpat-的步骤R_2_2_9 ----------------------------------------
tar xvzf libexpat-R_2_2_9.tar.gz
cd libexpat-R_2_2_9/expat
./buildconf.sh
./configure --prefix=/mnt/flash2/apache2_server --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-gcc-ar STRIP=aarch64-linux-gnu-strip RANLIB=aarch64-linux-gnu-ranlib
make
make install DESTDIR=/home/ahmcpu2176/Downloads/apache2_server
cd ../..
-------------------------- httpd-2.4.23(带有apr,apr-util,pcre的apache2)的步骤--------------------------
下载apr-1.5.0和apr-util-1.6.1库并将压缩文件提取到
httpd-2.4.23/srclib
tar xvzf httpd-2.4.23.tar.gz
tar xvzf apr-1.5.0.tar.gz
tar xvjf apr-util-1.6.1.tar.bz2
mv apr-1.5.0 httpd-2.4.23/srclib/apr
mv apr-util-1.6.1 httpd-2.4.23/srclib/apr-util
cd httpd-2.4.23
./configure --prefix=/mnt/flash2/apache2_server --target=aarch64-linux-gnu --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc CPP=aarch64-linux-gnu-cpp CXX=aarch64-linux-gnu-c++ AR=aarch64-linux-gnu-gcc-ar STRIP=aarch64-linux-gnu-strip RANLIB=aarch64-linux-gnu-ranlib --with-included-apr --with-pcre=/home/ahmcpu2176/Downloads/pcre-8.43/pcre-config --with-expat=/home/ahmcpu2176/Downloads/apache2_server/mnt/flash2/apache2_server ac_cv_func_setpgrp_void="no" ap_cv_void_ptr_lt_long=4 ac_cv_file__dev_zero="yes" ac_cv_func_setpgrp_void="yes" apr_cv_process_shared_works="yes" apr_cv_mutex_robust_shared="no" apr_cv_tcp_nodelay_with_cork="yes" ac_cv_sizeof_struct_iovec="8" apr_cv_mutex_recursive="yes" --enable-mpms-shared=all --with-mpm=event
make
-------如果出现以下错误-------
/ bin / bash:工具/ gen_test_char:无法执行二进制文件:Exec格式错误
Makefile:137:目标'include / private / apr_escape_test_char.h'的配方失败
make [1]: * [include / private / apr_escape_test_char.h]错误126
make [1]:离开目录'/home/ahmcpu2176/Downloads/apr-1.5.0'
/home/ahmcpu2176/Downloads/apr-1.5.0/build/apr_rules.mk:118:目标“所有递归”的配方失败
make:* [全部递归]错误1
--------解决方案-------
cd srclib/apr/tools
gcc -Wall -O2 -DCROSS_COMPILE gen_test_char.c -s -o gen_test_char
cd ../../..
make
---------如果出现以下错误--------
/home/ahmcpu2176/Downloads/httpd-2.4.23/srclib/apr/libtool --silent --mode = link aarch64-linux-gnu-gcc -g -O2 -L / home / ahmcpu2176 / Downloads / apache2_server / mnt / flash2 / apache2_server / lib -o gen_test_char -L / home / ahmcpu2176 / Downloads / apache2_server / mnt / flash2 / apache2_server / lib gen_test_char.lo
./gen_test_char> test_char.h
/ bin / bash:./gen_test_char:无法执行二进制文件:Exec格式错误
Makefile:36:目标“ test_char.h”的配方失败
make [2]: * [test_char.h]错误126
make [2]:离开目录'/home/ahmcpu2176/Downloads/httpd-2.4.23/server'
/home/ahmcpu2176/Downloads/httpd-2.4.23/build/rules.mk:75:目标“所有递归”的配方失败
make [1]:* [全部递归]错误1
make [1]:离开目录'/home/ahmcpu2176/Downloads/httpd-2.4.23/server'
/home/ahmcpu2176/Downloads/httpd-2.4.23/build/rules.mk:75:目标“所有递归”的配方失败
make:*** [所有递归]错误1
--------解决方案-------
cd server
gcc gen_test_char.c -I./../srclib/apr/include/ -o gen_test_char
cd ..
make
make install DESTDIR=/home/ahmcpu2176/Downloads/apache2_server
cd ..
tar cvzf apache2_server.tar.gz apache2_server