nginx-1.6.0 移植

来源:互联网 发布:为什么淘宝找不到店铺 编辑:程序博客网 时间:2024/05/16 17:15

HOST: ubuntu 11.04
NGINX VERSION: nginx-1.6.0
ZLIB VERSION: zlib-1.2.8
PCRE VERSION: pcre-8.33
OPENSSL VERSION:openssl-1.0.1e
TARGET:arm-hisiv200-linux

编译参考如下:

http://www.cppblog.com/van201314/articles/165661.html
http://blog.csdn.net/zangcf/article/details/22057661

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  // 在1.6.0里面是 src/os/unix/ngx_shmem.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

记住把openssl一定要放到linux下面,要不有莫名的错误 --prefix这个需要设置在开发板放置的位置,要不会找不到配置文件等可能有其他方式解决这个问题,目前我不清楚。
./configure --add-module=/mnt/nfs/qt-test/Hi3531Enc/rtmp/nginx-rtmp-module-master/  --with-openssl=/nfsroot/rtmp/openssl-1.0.1e/ --prefix=/nand/nginx-1.6/ --with-cc=/opt/hisi-linux/x86-arm/arm-hisiv200-linux/target/bin/arm-hisiv200-linux-gcc --with-cpp=/opt/hisi-linux/x86-arm/arm-hisiv200-linux/target/bin/arm-hisiv200-linux-g++ --with-zlib=/mnt/nfs/arm/zlib-1.2.8/ --with-openssl-opt='AR=arm-hisiv200-linux-ar RANLIB=arm-hisiv200-linux-ranlib CC=arm-hisiv200-linux-gcc /usr/bin/perl no-asm' --with-pcre=/mnt/nfs/qt-test/Hi3531Enc/rtmp/pcre-8.33

make openssl的时候会有linux-elf问题 修改objs/Makefile:
/nfsroot/rtmp/openssl-1.0.1e//.openssl/include/openssl/ssl.h: objs/Makefile
 cd /nfsroot/rtmp/openssl-1.0.1e/ \
 && if [ -f Makefile ]; then $(MAKE) clean; fi \
# && ./config --prefix=/nfsroot/rtmp/openssl-1.0.1e//.openssl AR=arm-#hisiv200-linux-ar RANLIB=arm-hisiv200-linux-ranlib CC=arm-hisiv200-linux-gcc /#usr/bin/perl no-asm no-shared no-threads \
 && AR=arm-hisiv200-linux-ar RANLIB=arm-hisiv200-linux-ranlib CC=arm-hisiv200-linux-gcc /usr/bin/perl ./config --prefix=/nfsroot/rtmp/openssl-1.0.1e//.openssl no-asm no-shared no-threads \
 && $(MAKE) \
 && $(MAKE) install LIBDIR=lib
make
make install

编译好后,在我的板子上发现会报错误,就是 getpwnam 和 getgrnam 的错误, 发现是这个函数在我的板子上是无效的,无论获取什么用户名都是失败的。 于是又去改源代码。src/core/nginx.c:1033 这里就是非win32平台的部分,修改掉两个函数调用过程,然后将用户名用户ID,用户组ID写死。 再次编译,然后就可以运行了。
关于配置文件的详细介绍,可以看以下大神的解释:
http://wenku.baidu.com/view/9356fb2c3169a4517723a314.html
http://blog.csdn.net/defonds/article/details/9274479

0 0
原创粉丝点击