第一步,安装pcre:

tar -xvzf pcre-8.31.tar.gz

cd pcre-8.31

./configure --prefix=$ARMROOTFS/usr/pcre --host=arm-linux CC=$TOOLCHAIN/arm-linux-gcc CXX=$TOOLCHAIN/arm-linux-g++ LD=$TOOLCHAIN/arm-linux-ld

make

make install

第二步,安装apr

这里特别提醒,先看一下后面的几点一些要注意的地方,特别是第⑤点

tar -xvzf apr-1.4.6.tar.gz

cd apr-1.4.6

./configure --prefix=$ARMROOTFS/usr/apr --host=arm-linux CC=$TOOLCHAIN/arm-linux-gcc CXX=$TOOLCHAIN/arm-linux-g++ LD=$TOOLCHAIN/arm-linux-ld ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes --cache=arm-linux.cache

这里简要说明一下如果不添加某些选项会出现的错误提示及一些需要特别注意的地方(这里按照我所记录的错误出现的顺序说明,而不是按上面选项的顺序):

①如果不添加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 "$as_me:${as_lineno-$LINENO}: checking which format to use for apr_ssize_t" >&5

$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

as_fn_error $? "could not determine the proper format for apr_ssize_t" "$LINENO" 5

fi

将中间添加一段代码(红色标注),修改为

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which format to use for apr_ssize_t" >&5

$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

as_fn_error $? "could not determine the proper format for apr_ssize_t" "$LINENO" 5

fi

搜索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

as_fn_error $? "could not determine the proper format for apr_size_t" "$LINENO" 5

fi

将中间添加一段代码(红色标注),修改为:

{ $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

as_fn_error $? "could not determine the proper format for apr_size_t" "$LINENO" 5

fi

如果什么修改也不做,则会出现:

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,因此应该是没有问题的。

第三步,安装apr-util:

tar -xvzf apr-util-1.4.1.tar.gz

cd apr-util-1.4.1

./configure

./configure --prefix=$ARMROOTFS/usr/local/apr-util --with-apr=$ARMROOTFS/usr/local/apr --host=arm-linux CC=$TOOLCHAIN/arm-linux-gcc CXX=$TOOLCHAIN/arm-linux-g++ LD=$TOOLCHAIN/arm-linux-ld

make

make install

第四步,安装httpd:

这里提醒一下先看一下后面的几点要注意的地方,特别是第②点

tar -xvzf httpd-2.4.3.tar.gz

cd httpd-2.4.3

./configure --prefix=$ARMROOTFS/etc/apache --with-pcre=$ARMROOTFS/usr/local/pcre --with-apr=$ARMROOTFS/usr/local/apr --with-apr-util=$ARMROOTFS/usr/local/apr-util --host=arm-linux CC=$TOOLCHAIN/arm-linux-gcc CXX=$TOOLCHAIN/arm-linux-g++ LD=$TOOLCHAIN/arm-linux-ld ap_cv_void_ptr_lt_long=no --enable-so --enable-cgi LDFLAGS=-lpthread

make DESTDIR=$ARMROOTFS

make install

在编译过程中要注意以下几点:

①如果不添加ap_cv_void_ptr_lt_long=no选项,则会出现:

configure: error: Size of "void *" is less than size of "long"

的错误,如下图:

②在执行过./configure指令后,在为开发板编译httpd执行make命令前,需要先对宿主机上编译过一次httpd(即至少执行到make,make install可不执行,宿主机上不最终安装apache2也是可以的),然后到为开发板编译httpd的httpd-2.4.3目录下的server目录中,修改一下其中的Makefile文件,找到如下行:

test_char.h: gen_test_char

./gen_test_char > test_char.h

修改为

test_char.h: gen_test_char

#./gen_test_char > test_char.h

$httpd_for_pc/server/gen_test_char > test_char.h

其中这里的变量httpd_for_pc只是指代为宿主机编译的httpd软件包加压后的文件夹路径。

如果不做上面任何修改,则会出现以下错误:

./gen_test_char > test_char.h

/bin/bash: ./gen_test_char: 无法执行二进制文件

原因也是因为宿主机上无法运行使用交叉编译链编译的程序的缘故。

如果只修改为:

test_char.h: gen_test_char

#./gen_test_char > test_char.h

而在宿主机上不编译一次httpd,则会出现以下错误:

util.c: In function 'ap_find_token':

util.c:1434: error: 'test_char_table' undeclared (first use in this function)

util.c:1434: error: (Each undeclared identifier is reported only once

util.c:1434: error: for each function it appears in.)

util.c:1434: error: 'T_HTTP_TOKEN_STOP' undeclared (first use in this function)

util.c: In function 'ap_escape_shell_cmd':

util.c:1498: error: 'test_char_table' undeclared (first use in this function)

util.c:1498: error: 'T_ESCAPE_SHELL_CMD' undeclared (first use in this function)

util.c: In function 'ap_escape_path_segment_buffer':

util.c:1706: error: 'test_char_table' undeclared (first use in this function)

util.c:1706: error: 'T_ESCAPE_PATH_SEGMENT' undeclared (first use in this function)

util.c: In function 'ap_os_escape_path':

util.c:1740: error: 'test_char_table' undeclared (first use in this function)

util.c:1740: error: 'T_OS_ESCAPE_PATH' undeclared (first use in this function)

util.c: In function 'ap_escape_urlencoded_buffer':

util.c:1759: error: 'test_char_table' undeclared (first use in this function)

util.c:1759: error: 'T_ESCAPE_URLENCODED' undeclared (first use in this function)

util.c: In function 'ap_escape_logitem':

util.c:1844: error: 'test_char_table' undeclared (first use in this function)

util.c:1844: error: 'T_ESCAPE_LOGITEM' undeclared (first use in this function)

util.c: In function 'ap_escape_errorlog_item':

util.c:1896: error: 'test_char_table' undeclared (first use in this function)

util.c:1896: error: 'T_ESCAPE_LOGITEM' undeclared (first use in this function)

util.c: In function 'ap_append_pid':

这里就不截图了。可见./gen_test_char > test_char.h这条语句是为了生成一些宏定义或者全局变量到test_char.h这个头文件中去,而里面这些宏定义和全局变量又在httpd源程序的中使用到。因此宿主机系统也必须编译一次httpd才可以完成开发板安装apache2服务器软件。

如果在执行上面的修改前执行过一次make,那么需要执行make clean命令后,再执行make才能编译通过。

经过以上步骤后,进入开发板文件系统目录,修改etc/apache/bin目录下的apachectl文件,搜索HTTPD,可以找到该变量,将该变量的值修改为:HTTPD='/etc/apache/bin/httpd'。

为了方便以后在开发板上输入打开和关闭apache2服务器的指令,可以执行以下命令:

sudo cp $ARMROOTFS/etc/httpd/bin/apachectl $ARMROOTFS/usr/sbin/

sudo cp $ARMROOTFS/etc/httpd/bin/apachectl $ARMROOTFS/etc/init.d/

第五步:复制共享库(为宿主机系统编译安装apache2不需要进行这一步)

之后还需要复制一些共享库到开发板文件系统的/usr/lib目录下,否则会启动不了apache2服务器,像以下错误:

①error while loading shared libraries: libpcre.so.1:cannot open shared object file:No such file for directory

解决方法:cp $ARMROOTFS/usr/local/pcre/lib/libpcre.so* $ARMROOTFS/usr/lib

②error while loading shared libraries: libaprutil-1.so.0:cannot open shared object file:No such file for directory

解决方法:cp $ARMROOTFS/usr/local/apr-util/lib/libaprutil-1.so* $ARMROOTFS/usr/lib

③error while loading shared libraries: libexpat.so.0:cannot open shared object file:No such file for directory

解决方法:cp $ARMROOTFS/usr/local/apr-util/lib/libexpat.so* $ARMROOTFS/usr/lib

④error while loading shared libraries: libapr-1.so.0:cannot open shared object file:No such file for directory

解决方法:cp $ARMROOTFS/usr/local/apr/lib/libapr-1.so* $ARMROOTFS/usr/lib

⑤error while loading shared libraries: libuuid.so.1:cannot open shared object file:No such file for directory

解决方法:需要编译一次e2fsprogs这个软件包,使它生成这个共享库。

tar -xvzf e2fsprogs-1.42.8.tar.gz

cd e2fsprogs-1.42.8

./configure --prefix=$ARMROOTFS/usr/local/e2fsprogs --host=arm-linux CC=$TOOLCHAIN/arm-linux-gcc LD=$TOOLCHAIN/arm-linux-ld --enable-elf-shlibs

make

make install(可以不执行这一步)

之后在软件包加压后的e2fsprogs-1.42.8目录下执行:

cp lib/libuuid.so* $ARMROOTFS/usr/lib/

第六步及之后:还没有解决的问题

本人经过上面的编译安装后,在开发板进入系统后,执行apachectl指令,仍然未能成功启动apache服务器,系统提示错误为:

AH00141:Could not initialize random number generator

转载于:https://www.cnblogs.com/zhangsf/p/3272960.html

Apache 2 移植到Arm开发板相关推荐

  1. apache arm 交叉编译_Apache 2移植到Arm开发板的过程整理——如何交叉编译Apache 2

    话说要在arm开发板的linux系统中运行apache服务器,需要在pc linux系统中交叉编译Apache源码,在网上参考了很多资料都是1.3版本的,最后终于找到apache 2移植到arm开发板 ...

  2. Openssl移植到ARM开发板

    Openssl移植到ARM开发板 openssl源码下载 源码编译配置 使用生成的库文件 openssl源码下载 openssl源码可以在官网下载:https://www.openssl.org/so ...

  3. RV1109开发板ssh服务器移植到arm开发板

    RV1109开发板ssh服务器移植到arm开发板 ssh功能移植到RV1109开发板的,由于RV1109的SDK中,没有telnet功能,有时候adb功能在量产中需要关闭,避免造成设备留有漏洞,造成安 ...

  4. I.MX6ULL开发板基于阿里云项目实战 3 :阿里云iot-SDK 移植到arm开发板

    上一篇博客讲的是创建产品和设备,本讲,我们将阿里云iot-SDK 移植到arm开发板. 参考资料: https://code.aliyun.com/edward.yangx/public-docs/w ...

  5. MPlayer移植到arm开发板

    今天用了一天的时间将mplayer移植到arm开发板上,移植过程中遇到各种问题,在此做以记录. mplayer版本:1.0rc2 Ubuntu版本:12.04 64位 移植过程: 1.su获取root ...

  6. python交叉编译_交叉编译Python3.6.2,使用海思arm-hisiv200-linux-gcc,移植到arm开发板上...

    最近在学习Python,感觉使用Python可以快速的写出程序,比之前使用的C语言快多了,能省出很多时间.多学一点知识有更多的选择.本职工作是嵌入式开发,学习了Python后想移植到开发板上,尝试嵌入 ...

  7. ekho 6.3 文字转换语言移植到arm开发板

    ekho 文字转语言库交叉编译 1.下载 ekho 源码 ,libsndfile库源码 http://www.eguidedog.net/cn/ekho_cn.php #ekho-6.3.tar.xz ...

  8. appweb移植到arm开发板

    在官方上下载Appweb源 https://embedthis.com/appweb/download.html我选择的是4.3.5 下载完成后执行tar -zxvf appweb-4.3.5解压 解 ...

  9. busybox移植到ARM开发板

    0. 概述 这里是简单介绍什么是busybox,busybox的移植步骤,以及其中遇到的一些问题,然后介绍了其中一些文件夹的作用.移植完成后再将交叉编译工具链中的动态链接库拷贝到构建好的根文件系统当中 ...

最新文章

  1. centos6.8 安装mysql_Centos6.8通过yum安装mysql5.7
  2. R语言:ggplot2
  3. 关于runjs的一些想法
  4. sklearn自学指南(part26)--最近邻算法
  5. TCP/IP网络断和127.0.0.1回网IP概念
  6. autotools入门笔记(二)——创建和使用静态库、动态库
  7. 通用运输APP/小型物流托运APP/客运班车APP/PHP+MYSQL管理后端
  8. 基于深度学习的数字识别GUI的设计
  9. 【转】Data truncation: Truncated incorrect DOUBLE value:Mysql Update时
  10. Oracle数据库-建库、建表空间,建用户
  11. 6.Linux 高性能服务器编程 --- 高级 I/O 函数
  12. 工业基础类IFC—概述
  13. ARM架构及ARM指令集、Thumb指令集你了解多少?
  14. 如何通过芯片手册寻找操作GPIO
  15. 谷歌插件安装(不翻墙方式)
  16. 「写论文」“常用关联词”汇总
  17. [ARM 的高级命名术 A32 T32 A64 Thumb Thumb2 AArch32 AArch64]
  18. 这个卷走175个国家和地区45亿英镑的“加密女王”忽然失踪,骗局崩盘
  19. CDUTCM OJ 2017第一次月赛
  20. 纯文本、富文本、超文本

热门文章

  1. 标签用什么数据结构存比较好_结婚喝什么白酒比较好,婚宴白酒用什么价位的比较好...
  2. 油漆面积 java_第八屆藍橋杯省賽 JavaA組 第十題 標題:油漆面積
  3. 安装一直初始化_win10开机一直卡在正在准备自动修复怎么办
  4. aso优化师是什么_出海产品如何优化ASO?Google Play ASO优化入门指南
  5. torch.index_select与torch.gather
  6. 修辞结构理论论文集合
  7. activemq后台管理 看topic消息_「Java」 - SpringBoot amp; ActiveMQ
  8. vs2002 vs2003 可能存在的问题以及解决办法!
  9. Python 3 进阶 —— print 打印和输出
  10. 长假终结踏上归途 网络电话延续团圆亲情