logo资料库

Arm板Apache+PHP环境搭建.docx

第1页 / 共12页
第2页 / 共12页
第3页 / 共12页
第4页 / 共12页
第5页 / 共12页
第6页 / 共12页
第7页 / 共12页
第8页 / 共12页
资料共12页,剩余部分请下载后查看
Apache 编译 需要的源码:pcre-8.31.tar.gz apr-1.4.6.tar.gz apr-util-1.4.1.tar.gz httpd-2.4.3.tar.gz 说明:1,编译 httpd 之前需要先编译好 pcre、apr 和 apr-util,因为在编译 httpd 时需要用 到这三个编译好的文件。 2, 这四个源码分别需要编译两次,以生成 x86 和 arm 两个不同的平台文件。最终目的是 为了移植到 arm 开发板上,所以先编译好 httpd_pc,然后再编译 httpd_arm,在编译 httpd_arm 时需要用到 httpd_pc/server/gen_test_char 这个可执行文件(文件类型属于 x86 平台)。 1.1.1 安装 pcre tar –zxvf pcre-8.31.tar.gz cd pcre-8.31 ./configure -–prefix=/usr/local/usr/pcre make make install 1.1.2 安装 apr tar –zxvf apr-1.4.6.tar.gz cd apr-1.4.6 ./configure –-prefix=/usr/local/usr/apr make make install 1.1.3 安装 apr-util tar –zxvf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1 ./configure -–prefix=/usr/local/usr/apr-util –-with-apr=/usr/local/usr/apr make make install 1.1.4 安装 httpd_pc tar –zxvf httpd-2.4.3.tar.gz 解压后的文件夹名更改为 httpd_pc cdhttpd_pc ./configure –-with-apr=/usr/local/usr/apr –-with-apr-util=/usr/local/usr/apr-util -–prefix=/usr/local/usr/apache–-with-pcre=/usr/local/usr/pcre make *可以不 make install ,因为 httpd_arm 在./configure 时只需要用到 httpd_pc/server 文件夹下 的 gen_test_char,而此文件是在 make 时产生。 注:以上编译的文件类型为 x86 平台的,下面是 arm 平台。 1.2.1 安装 pcre cd pcre-8.31 ./configure -–prefix=/usr/local/pcre –-host=arm-none-linux-gnueabi make make install 1.2.2 安装 apr cd apr-1.4.6 ./configure –-prefix=/usr/local/apr–-host=arm-none-linux-gnueabi ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8 --cache=arm-linux.cache
make make install 这里简要说明一下如果不添加某些选项会出现的错误提示及一些需要特别注意的地 方(这里按照我所记录的错误出现的顺序说明,而不是按上面选项的顺序): ①如果不添加 ac_cv_file__dev_zero=yes(注意 file 和 dev 之间是两个下划线),则会出现: check for /dev/zero... configure:error:cannot check for file existence when cross compile 的错误,如下图: ②如果不添加 ac_cv_func_setpgrp_void=yes,则会出现: checking whether setpgrp takes no argument... configure: error: cannot check setpgrp when cross compiling 的错误,如下图: ③选项--cache=arm-linux.cache 中,arm-linux.cache 为自己建立编写的文件(在编译过程 中内容会被修改),在建立时需要自己写入如下内容: apr_cv_process_shared_works=yes apr_cv_mutex_robust_shared=yes 如果不写入第一项,则会出现: checking for working PROCESS_SHARED locks... configure:error: in `.../apr-1.4.6': configure:error: cannot run test program while cross compiling See `config.log' for more details 的错误,如下图: 如果不写入第二项,则会出现: checking for robust cross-process mutex support... configure: error: in `.../apr-1.4.6':
configure: error: cannot run test program while cross compiling See `config.log' for more details 的错误,如下图: 这些错误产生的原因在于这里在 configure 运行配置的过程中要运行几个测试程序来检验一 些配置(个人理解),但在此处指定了编译时采用的编译器是交叉编译链,这几个测试程序 都是经过交叉编译链编译产生的,而在宿主机系统上无法运行这些程序,因此只好自己手动 指定这些检测程序最后运行的结果。 在以后为开发板配置软件包时遇到这种错误:configure:error:cannot run test program while cross compiling,应该都可以通过这种方法解决。 那么如果查找出这些表示结果的变量呢?只要在 configure 文件中搜寻这些错误的关键字即 可,如这里的第一个项,我们可以搜寻:working PROCESS_SHARED locks,然后在 configure 文件中可以锁定到如下代码段: ... { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working PROCESS_SHARED locks" >&5 $as_echo_n "checking for working PROCESS_SHARED locks... " >&6; } if ${apr_cv_process_shared_works+:} false; then : $as_echo_n "(cached) " >&6 else ... 这里可以看出变量 apr_cv_process_shared_works 便是与这个程序运行结果关联的变量。 ④如果不添加 ac_cv_sizeof_struct_iovec=8 选项,则会在使用 make 指令时出现: ./include/apr_want.h:95: error: redefinition of 'struct iovec' make[1]: *** [passwd/apr_getpass.lo] 错误 1
的错误,如下图: ⑤在添加了 ac_cv_sizeof_struct_iovec=8 选项后,还需要对 configure 文件进行一下修改,搜 索 apr_ssize_t 可以定位到下面一段代码: $as_echo { apr_ssize_t" >&5 "$as_me:${as_lineno-$LINENO}: checking which format to use for $as_echo_n "checking which format to use for apr_ssize_t... " >&6; } if test -n "$ssize_t_fmt"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: %$ssize_t_fmt" >&5 $as_echo "%$ssize_t_fmt" >&6; } elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then ssize_t_fmt="d" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %d" >&5 $as_echo "%d" >&6; } elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then ssize_t_fmt="ld" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %ld" >&5 $as_echo "%ld" >&6; } else fi as_fn_error $? "could not determine the proper format for apr_ssize_t" "$LINENO" 5 将中间添加一段代码(红色标注),修改为: $as_echo { apr_ssize_t" >&5 "$as_me:${as_lineno-$LINENO}: checking which format to use for
$as_echo_n "checking which format to use for apr_ssize_t... " >&6; } if test -n "$ssize_t_fmt"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: %$ssize_t_fmt" >&5 $as_echo "%$ssize_t_fmt" >&6; } elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then ssize_t_fmt="d" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %d" >&5 $as_echo "%d" >&6; } elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then ssize_t_fmt="ld" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %ld" >&5 $as_echo "%ld" >&6; } elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long_long";then ssize_t_fmt="lld" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %lld" >&5 $as_echo "%lld" >&6; } else fi as_fn_error $? "could not determine the proper format for apr_ssize_t" "$LINENO" 5 搜索 apr_size_t 可以定位到下面一段代码: { $as_echo "$as_me:${as_lineno-$LINENO}: checking which format to use for apr_size_t" >&5 $as_echo_n "checking which format to use for apr_size_t... " >&6; }
if test -n "$size_t_fmt"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: %$size_t_fmt" >&5 $as_echo "%$size_t_fmt" >&6; } elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then size_t_fmt="d" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %d" >&5 $as_echo "%d" >&6; } elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then size_t_fmt="ld" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %ld" >&5 $as_echo "%ld" >&6; } else fi as_fn_error $? "could not determine the proper format for apr_size_t" "$LINENO" 5 将中间添加一段代码(红色标注),修改为: { $as_echo "$as_me:${as_lineno-$LINENO}: checking which format to use for apr_size_t" >&5 $as_echo_n "checking which format to use for apr_size_t... " >&6; } if test -n "$size_t_fmt"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: %$size_t_fmt" >&5 $as_echo "%$size_t_fmt" >&6; } elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then size_t_fmt="d"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: %d" >&5 $as_echo "%d" >&6; } elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then size_t_fmt="ld" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %ld" >&5 $as_echo "%ld" >&6; } elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long_long"; then size_t_fmt="lld" { $as_echo "$as_me:${as_lineno-$LINENO}: result: %lld" >&5 $as_echo "%lld" >&6; } else fi as_fn_error $? "could not determine the proper format for apr_size_t" "$LINENO" 5 如果什么修改也不做,则会出现: checking which format to use for apr_ssize_t... configure:error:could not determine the proper format for apr_ssize_t 的错误,如下图: 如果只做了第一个修改,则会出现: checking which format to use for apr_size_t... configure:error:could not determine the proper format for apr_size_t 的错误,如下图: 这是 apr 源代码包本身有的 bug,这样修改后,在最后编译 httpd 时,会出现一些 warning, 大概意思是说参数类型为 pid_t 的地方,出现的参数类型为 long long,但 pid_t 的类型本身 就是 unsigned int,因此应该是没有问题的。 另外还可能出现一些其他的错误例如:
分享到:
收藏