Apache2.4.12移植
来源:互联网 发布:空间数据编辑 编辑:程序博客网 时间:2024/06/05 19:19
Apache的移植相对比较复杂,首先得移植其依赖的库。其主要的库有pcre,APR(apache 运行时库),APR-util,和zlib库。
下面我们将分别一一移植:
1. PCRE的移植:
该移植比较简单.
>> ./configure \ --prefix='$INSTALLROOT/pcre' \ --host=arm-linux \ CC=arm-linux-gnueabihf-gcc \ CXX=arm-linux-gnueabihf-g++
这里的CXX一定要配置,因为它需要用到C++编译器。
>> make && make install
2. APR移植
Apache运行时库的移植很重要,它关系着Apache的运行。
./configure --prefix='$INSTALLROOT/apr' \ --host=arm-linux \CC=arm-linux-gnueabihf-gcc \ ac_cv_file__dev_zero=yes \ac_cv_func_setpgrp_void=yes \ apr_cv_tcp_nodelay_with_cork=yes
①如果不添加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
make && make install
编译时,会出现下列错误:
./include/apr_want.h:95: error: redefinition of ‘struct iovec’
make[1]: * [passwd/apr_getpass.lo] 错误 1
修改include/apr_want.h,屏蔽掉下面结构体。
/*struct iovec{ void *iov_base; size_t iov_len;};*/
编译OK
3. APR-util 移植
./configure --prefix='$INSTALLROOT/apr-util' \ --with-apr='$INSTALLROOT/apr' \--host=arm-linux \CC=arm-linux-gnueabihf-gcc
一定要指定APR运行时库的路径。
make && make install
4. Zlib 移植:
不交叉编译zlib,会在Apache configure是出错,错误如apache移植中所述。
./configure --prefix='$INSTALLROOT/zlib'
要想交叉编译zlib,必须修改Makefile,因为其makefile 的编译器为gcc 。故需要将所有的gcc,ld,ar改成交叉编译器(XXX-gcc);
make && make install
编译完成。
5. Apache 移植:
先给出一个样板:
./configure \> --prefix=/usr/local/apache-2.4.12 \> --enable-deflate \ #压缩> --enable-expires \ #缓存> --enable-headers \> --enable-modules=most \> --enable-so \> --with-mpm=worker \ #worker模型> --enable-rewrite \ #rewrite重写规则> --with-apr=/usr/local/apr \> --with-apr-util=/usr/local/apr-util> --enable-ssl #支持ssl
我们开始编译:
./configure --prefix='/usr/local/apache' \--host=arm-linux --enable-deflate \--enable-expires --enable-headers \--enable-modules=most --enable-so \--with-mpm=worker --enable-rewrite \--with-apr='$INSTALLROOT/apr' \--with-apr-util='$INSTALLROOT/apr-util' \ --with-pcre='$INSTALLROOT/pcre' \ --with-z='$INSTALLROOT/zlib' \ ap_cv_void_ptr_lt_long=no \ --enable-ssl \ CC=arm-linux-gnueabihf-gcc \ LIBS=-lpthread
① 必须指定这三个依赖库的路径,否则,就要将这些库放在Apache目录下。
② Apache的模型一般选用worker模型,当然,你也可以根据需要选择prefork模式。
③如果不添加ap_cv_void_ptr_lt_long=no选项,则会出现:
configure: error: Size of “void *” is less than size of “long”
④一定要添加-lpthread的支持,否则会出现下列错误:
…./arm-linux-gnueabihf/libpthread.so.0: could not read symbols:
Invalid operation
⑤缺少zlib库,安装zlib的步骤如4所示。
checking for zlib location… not found checking whether to enable
mod_deflate… configure: error: mod_deflate has been requested but
can not be built due to prerequisite failures
make && make install
① gen_test_char 不能执行。
要在宿主机上重新编译一遍apache。取出其gen_test_char放到server目录,(为什要这么做? Apache的编译的Makefile不是很好,gen_test_char是要在宿主机上运行的,而make却编译成了target上的可执行程序)。并修改名字为gen_test_char1,同时修改makefile。
test_char.h: gen_test_char ./gen_test_char1 > test_char.h
OK,至此没有出错,Apache移植成功!
将其拷贝至相应目录下,并复制相应的动态链接库。
配置httpd.conf文件中的 ServerName如下:
ServerName localhost:80
OK,测试Apache。
apachectl startapachectl stop
均OK,Apache移植完成!虽然简单,但很费时间(因为至少得照着上面的步骤编译2遍)。
- Apache2.4.12移植
- Apache2.4.3编译移植
- 移植apache2 ARM版 - 交叉编译apache2
- apache2.2.22 嵌入式移植步骤,
- 20130704 移植apache2到arm Linux上
- OpenWrt移植Apache2 apr 到MT7620N
- 移植apache2 ARM版 - 交叉编译pcre-8.33
- 移植apache2 ARM版 - 交叉编译apr-1.4.8
- 移植apache2 ARM版 - 交叉编译apr-util
- 编译安装 apache2.4.12
- apache2
- apache2
- Apache2
- Apache2.4.12+php5.4.40安装配置
- apache2.2.22 嵌入式移植403访问权限问题(You don't have permission to access / on this server)
- /etc/apache2/apache2.conf
- apache2.2 apache2.4
- 移植
- COCOS2D 释放资源的最佳时机
- css text-transform
- C++模板函数初次使用
- Java中多态性的实现
- 基于三层网络的音频传输技术
- Apache2.4.12移植
- linux网络编程之udp的connect趣谈
- java中的enum枚举类型的适用范围
- 课程实训——银行系统
- 学习MongoDB 六: MongoDB查询(游标操作、游标信息)(三)
- C语言小例子
- Hudson + Ant + SVN + Tomcat配置详解
- Hibernate中的inverse在表关系映射中经常应用,
- 实习第13天