交叉编译nginx

1 在安装nginx之前,首先先装pcre
 # CC=arm-hisiv200-linux-gcc  CXX=arm-hisiv200-linux-g++  ./configure --prefix=/usr/local/pcre  --host=arm-linux 
 # make
 # make install
2 安装nginx
2.1  先到nginx官网下载对应版本的软件包
  我下载的是nginx-1.8.1.tar.gz
2.2  将压缩包解压到任意目录(我的是/user/)得到文件夹nginx-1.8.1
2.3  打开控制台,cd进入nginx-1.8.1目录
2.4  打补丁
 2.4.1  补丁a:nginx-1.0.15\auto\cc\conf
           case $NGX_CC_NAME in
        arm-linux-gcc)
            # Modify By XinTinG
            # gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
 2.4.2  补丁b-1:nginx-1.0.15\auto\types\sizeof
           ----------------------------------------
          checking for $ngx_type size
          END
         ## Modify By XinTinG
         ngx_size=4
  2.4.3 补丁b-2:nginx-1.0.15\auto\types\sizeof
         ## Modify By XinTinG
        ##ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
        ngx_test="gcc $CC_TEST_FLAGS $CC_AUX_FLAGS \
                           -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
        ##eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
        ##if [ -x $NGX_AUTOTEST ]; then
        ##   ngx_size= `$NGX_AUTOTEST`
        ##    echo " $ngx_size bytes"
        ##fi
   2.4.4 补丁c:nginx-1.0.15\auto\feature
      yes)
            # /bin/sh is used to intercept "Killed" or "Abort trap" messages
            ##if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
                echo " found"
                ngx_found=yes
                if test -n "$ngx_feature_name"; then
                    have=$ngx_have_feature . auto/have
                fi
            ## Modify By XinTinG
            ##else
            ##    echo " found but is not working"
            ##fi
        ;;
  2.4.5  补丁d:nginx-1.0.15\configure
        if test -z "$NGX_PLATFORM"; then
            echo "checking for OS"
           ##NGX_SYSTEM=`uname -s 2>/dev/null`    ## Modify By XinTinG
           ##NGX_RELEASE=`uname -r 2>/dev/null`
           ##NGX_MACHINE= "arm" ##`uname -m 2>/dev/null`
  2.4.6  补丁e:nginx-1.0.15\src\os\unix\ngx_time.h
        #include <time.h>         // Modify By XinTinG
        #include <ngx_config.h>
        #include <ngx_core.h>
  2.4.7 补丁f:nginx-1.0.15\src\os\unix\ngx_errno.h
        #define NGX_ECANCELED     ECANCELED
        #define NGX_EILSEQ        EILSEQ
        #define NGX_ENOMOREFILES  0
        #define NGX_SYS_NERR      1     
2.5   配置nginx-1.8.1。执行命令:
   #CC=arm-hisiv200-linux-gcc  ./configure  --prefix=/user/nginx  --with-pcre=/usr/local/pcre  -- host=arm-linux  --without-zlib  --without-bzip2
2.6  编译nginx,执行命令:
   # make
2.7  安装nginx,执行命令:
   #make  install
  就可以在/user/nginx查看到四个文件
如果你做到这里只能说明你才成功一半!
3.问题集:
 1)问题:
        当你移植nginx到开发板之后,执行 ./sbin/nginx -c  conf/nginx.conf 以后会出现如下错误:
     getpwnam("**") failed(2:Unknown error)
     原因:
        在执行getpwnam的时候,系统找不到对应的库文件libness_file.so,然后我根据网上说的去查看了下nginx的动态库,果然如此,确实这个库文件,然后把这个动态库文件拷贝到开发板的/lib下在测试
     关于这个动态库请参考:  http://www.jollen.org/blog/2006/10/library_dependency_1.html
     参考文档: http://blog.chinaunix.net/uid-20543672-id-94317.html

         http://www.cokco.cn/thread-15158-1-1.html

转载于:https://www.cnblogs.com/suidan1314/p/5365503.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值