交叉编译 nginx
2019-07-13 01:35发布
生成海报
thinks http://www.cppblog.com/van201314/articles/165661.html
HOST: ubuntu 12.04 LTS
NGINX VERSION: nginx-1.5.8
ZLIB VERSION: zlib-1.2.8
PCRE VERSION: pcre-8.20
1.auto/cc/name
if [ "$NGX_PLATFORM" != win32 ]; then
ngx_feature="C compiler"
ngx_feature_name=
#ngx_feature_run=yes
ngx_feature_run=no ==>set to no to skip check
ngx_feature_incs=
ngx_feature_path=
2.auto/types/sizeof
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS
==> ngx_test="gcc $CC_TEST_FLAGS $CC_AUX_FLAGS
3.src/os/unix/ngx_errno.h
at line 15 add #define NGX_SYS_NERR 333
4.src/os/unix/ngx_errno.c
#if (NGX_HAVE_MAP_ANON) ==> #if (!NGX_HAVE_MAP_ANON)
5.prepare zlib and pcre
download zlib-1.2.8 and decompress to /home/mo/zlib-1.2.8
download pcre-8.20 and decompress to /home/mo/pcre-8.20
6.auto/lib/pcre/make
./configure --disable-shared $PCRE_CONF_OPT
==>./configure --disable-shared $PCRE_CONF_OPT --host=arm
7.write a configure script
#!/bin/sh
BUILD_PATH=/home/mo/nginx-1.5.8/arm-build
CC_PATH=/opt/arm-hisiv200-linux/bin/arm-hisiv200-linux-gnueabi-gcc
CPP_PATH=/opt/arm-hisiv200-linux/bin/arm-hisiv200-linux-gnueabi-g++
./configure
--prefix=$BUILD_PATH
--user=root
--group=root
--builddir=$BUILD_PATHuild
--with-zlib=/home/mo/zlib-1.2.8
--with-pcre
--with-pcre=/home/mo/pcre-8.20
--with-pcre-jit
--with-cc=$CC_PATH
--with-cpp=$CPP_PATH
save to my_configure.sh
8.start to compile
./my_configure.sh
make
make install
9.copy the install dir arm_build to the board(like /home/app/nginx),and run link this
/home/app/nginx/sbin/nginx -p /home/app/nginx
下面是修改好的代码的链接:
http://download.csdn.net/detail/crazyman2010/8311117
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮