AM335X(ARM CORTEX A8)下交叉编译apache

    工作需要在在TI的am3358(ARM cortex A8)上编译一个web上编译一个web server,需要用到apache,因此将步骤简单总结了下。
交叉编译apache,需要先编译三个库:apr,apr-utils,pcre。
    一、编译apr
   1. 步骤

  ./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux --prefix=/home/am3358x   \

                ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_process_shared_works=yes \

         apr_cv_mutex_robust_shared=yes apr_cv_tcp_nodelay_with_cork=yes ap_void_ptr_lt_long=no 
  make
  make install
   2. 注意事项及错误处理
  1)--prefix=后面是你的安装目录,到时移植到板子上也是这个目录。
  2)遇到错误log:
tools/gen_test_char > include/private/apr_escape_test_char.h
/bin/bash: tools/gen_test_char: cannot execute binary file: Exec format error
以及
./include/apr_want.h:94:8: error: redefinition of 'struct iovec'
解决办法,我参考了http://blog.sina.com.cn/s/blog_981380d00102vspo.html,修改方法如下:
Makefile.in:
137 tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char)
138 #       $(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS)
139 # modify >
140         gcc -Wall -O2  tools/gen_test_char.c -s -o tools/gen_test_char
因为此处需要生成一个可执行程序tools/gen_test_char,但是当修改了交叉编译工具之后,这个文件被使用交叉编译工具编译,而我们需要在x86上运行,所以被报错,这里手动写成gcc
编译。
二、 编译 apr-utils
1.步骤

./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux --prefix/home/am3358x/arm/  \

                --with-apr=/home/pj/kevin/workspace/cross_compile/arm/bin/apr-1-config

make
make install
    三、 编译pcre
      步骤

  ./configure --host=arm-linux --prefix=/home/am3358x/arm/ CC=arm-linux-gnueabihf-gcc \

                CXX=arm-linux-gnueabihf-g++ AR=arm-linux-gnueabihf-ar STRIP=arm-linux-gnueabihf-strip \

RANLIB=arm-linux-gnueabihf-ranlib LD=arm-linux-gnueabihf-ld
make
make install
四、 交叉编译apache
配置的过程有点多:

./configure --prefix=/home/am3358x --host=arm-linux CC=arm-linux-gnueabihf-gcc \

                --with-apr=/home/am3358x/arm/bin/apr-1-config \

--with-apr-util=/home/am3358x/arm/bin/apu-1-config --with-included-apr \

                --with-pcre=/home/am3358x/pcre/bin/pcre-config \

--enable-so --with-mpm=prefork ac_cv_file__dev_zero=yes \

               ac_cv_func_setpgrp_void=yes apr_cv_process_shared_works=yes \

              apr_cv_mutex_robust_shared=yes apr_cv_tcp_nodelay_with_cork=yes \

     ap_void_ptr_lt_long=no ap_cv_void_ptr_lt_long=no --enable-module=so --enable-mods-shared=all \

              --enable-expires=shared --enable-rewrite=shared --enable-headers --enable-cache\

   --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-mime-magic --enable-authn-dbm\

             --enable-vhost-alias ap_cv_apuver12=yes

然后就是make和 make install
五、 运行
编译好的东西都会出现在/home/am3358x目录下,整个复制到板子上的同样位置,然后修改httpd.conf,增加ServerName localhost:80, 修改Listen 80为Listen <网卡ip>:80。运行apache,然后输入ip,就可以看“It works!”的网页。
六、 其他
第一步那个bug,如果修改不成功的话需要重新在本机编译一个apache,把本机的httpd-2.4.33/server/gen_test_char复制到交叉编译的对应目录下,但这样比较麻烦,还需要重新编译那三个库。具体方法可以参考
https://blog.csdn.net/mycwq/article/details/46426261

你可能感兴趣的:(软件安装bug)