设为首页 收藏本站
查看: 537|回复: 0

[经验分享] How to compile Apache-2.2.11 to ARM

[复制链接]

尚未签到

发表于 2017-1-9 09:26:53 | 显示全部楼层 |阅读模式
How to compile Apache-2.2.11 to ARM
By following these steps you have great chances to compile a recent Apache to your ARM system. This is how I made it.
Toolchain
My big-endian ARM toolchain was made with Buildroot. uClibc-0.9.30, binutils-2.18, gcc-4.2.1.
Determine the so called "triplet" of your toolchain. The easiest way is to locate the cross compiler (gcc) in your toolchain directory and see prefix of gcc. In my case this is armeb-linux-uclibc. Some packages refuse this long triplet, they prefer something more traditional, or no one knows what, but armeb-linux is usually adequate to them too. In my case armeb-linux-gcc is just a symlink to armeb-linux-uclibc-gcc, but for the choosy configure scripts this also suits. Triplet is referenced as TRIPLET (armeb-linux-uclibc) in this document.
Dependencies
Apache depends on pcre, Perl Compatible Regular Expressions. In the httpd package you can find a package of pcre amongst others (Apache Portable Runtime), in case of a default compile (e.g. on x86) this package is perfect for compiling Apache. In this case of ARM we neglect this builtin package, rather use an external package.
Apache relies on APR libraries and utils. APR is the abbreviation of Apache Portable Runtime. These packages must be compiled before the final webserver can be built. In a default case they would be built automatically during the build process of Apache, but this is not the default case, so we'll handle this also manually.
Other relevant dependencies are not known by me.
Compile target directories
The target directory you intend to put the compiled libraries and binaries is depending on you highly. In this article two important directories will be used.
The first one is a development directory for development packages. Into this directory those packages (dynamic and static libraries, headers and so on) will be put that are needed to compile an other package. Typically this target directory is the usr/ subpath of your toolchain's directory, since the toolchain is capable of finding headers and libraries located under its directory structure without any additional compile flag. And in most cases the toolchain is the best place to collect all the files that are essential in compiling other packages. Toolchain directory will be referred as TOOLCHAIN_DIR.
The second directory is the location where you want to put the compiled package. This will typically consist of executables, configuration files, man pages and libraries. This is usually a path in your root filesystem. Under a regular x86 system when you compile native programs, this can be for example either /usr or /usr/local. In case of cross-compiling, something like this is possible: /home/user/arm-project/rootfs. This directory will be referred as ROOTFS_DIR.
pcre-7.9
Download package.
Nothing special, this can be cross-compiled to ARM easily.
cd pcre-7.9; /

./configure /

--host=$TRIPLET /

--prefix=$TOOLCHAIN_DIR/usr; /

make; /

make install

httpd-2.2.18 (Apache)
Download e.g. from here (Hungarian server, locate an other mirror if slow).
APR

Autoconf variables may have other values depending on your toolchain/machine.
cd httpd-2.2.18/srclib/apr; /

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" /

./configure /

--host=$TRIPLET /

--prefix=$ROOTFS_DIR/usr/apache; /

make; /

make install


APR util

Autoconf variable may have other value depending on your toolchain/machine.
cd httpd-2.2.18/srclib/apr-util; /

./configure /

--host=$TRIPLET /

--prefix=ROOTFS_DIR/usr/apache /

--with-apr=$ROOTFS_DIR/usr/apache; /

make; /

make install


httpd

Autoconf variables may have other values depending on your toolchain/machine. They have to be set manually, because configure script is unable to guess their values.
cd httpd-2.2.18; /

ap_cv_void_ptr_lt_long=no /

LDFLAGS="-lpthread" /

./configure /

--host=$TRIPLET /

--prefix=/usr/apache /

--with-apr=$ROOTFS_DIR/usr/apache /

--with-apr-util=$ROOTFS_DIR/usr/apache /

--with-pcre=$TOOLCHAIN_DIR/usr /

--enable-so /

--enable-cgi; /

make; /

DESTDIR=$ROOTFS_DIR make install

Last steps
To check the runtime library dependencies of httpd, use the $TRIPLET-ldd program. libpcre is obviously needed:
cp $TOOLCHAIN_DIR/usr/lib/libpcre.so* $ROOTFS_DIR/usr/lib

Don't forget to configure your new httpd (httpd.conf).
Have fun!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-325811-1-1.html 上篇帖子: xampp(apache+mod_jk)整合现有的tomcat 下篇帖子: 用Apache POI来实现对Excel的读写
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表