• 为powerpc交叉编译nginx


    HOST: MINT
    NGINX VERSION: nginx-1.8.0(nginx-1.8.0.tar.gz)
    ZLIB VERSION: zlib-1.2.8
    PCRE VERSION: pcre-8.33

    nginx 竟然不太支持交叉编译,configure里面没有现成參数能够设置。

    只是幸好提供了--with-cc --with-cpp。

    网上最新的PCRE版本号是10.0,nginx使用这个版本号会有问题(pcre2),建议使用pcre-8.33.


    1. 编辑auto/cc/name文件第十行

    ngx_feature_run=yes =》

    ngx_feature_run=no

    否则./configure ... 会出现“checking for C compiler ... not found”之类的提示


    2. 编辑auto/types/sizeof,36行

    ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS =》

    ngx_test="gcc $CC_TEST_FLAGS $CC_AUX_FLAGS

    否则./configure ... 会出现“objs/autotest: Syntax error: "(" unexpected”之类的提示


    3. ./configure --prefix=/disk2/nginx/install --with-zlib=/disk2/zlib/zlib-1.2.8 --with-pcre --with-pcre=/disk2/pcre/pcre-8.33 --with-pcre-jit --with-cc=powerpc-linux-gcc  --with-cpp=powerpc-linux-g++

    --with-zlib 后面是你zlib 解压以后的source文件夹

    --with-pcre 后面是你pcre 解压以后的source文件夹

    --with-cc 后面请直接写powerpc 的 c compiler名称,能够加上路径(最好c compiler在PATH路径中)

    --with-cpp 后面请直接写powerpc 的 c++ compiler名称,能够加上路径(最好c++ compiler在PATH路径中)


    4. 如今make的话会出现“cc1: warnings being treated as errors”

    编辑 objs/Makefile,取消CFLAGS中的-Werror标志(第三行)

    CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g =》

    CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g


    5. 还是要编辑objs/Makefile,大约是1100行

    ./configure --disable-shared  --enable-jit =》

    ./configure --disable-shared  --enable-jit --host=powerpc-e300c3-linux-gnu

    明白host,否则编译pcre过程中有提示:“If you meant to cross compile, use `--host'.”

    --host=powerpc-e300c3-linux-gnu =》改动一下


    6. 编辑src/os/unix/ngx_errno.h。

    #include <ngx_core.h>后面加上

    #ifndef NGX_SYS_NERR
    #define NGX_SYS_NERR 666
    #endif


    7. 编辑src/os/unix/ngx_shmem.c,第12行

    #if (NGX_HAVE_MAP_ANON) =》

    #if (!NGX_HAVE_MAP_ANON)

    不改动这个,会出现“undefined reference to `ngx_shm_free'“错误


    8. 对于ppc32或者其它32位cpu,编辑objs/ngx_auto_config.h,第77行

    #define NGX_PTR_SIZE  8 =》

    #define NGX_PTR_SIZE  4

    否则编译后程序在目标机执行会出现“Illegal instruction”,或者

    nginx: [emerg] invalid number "1024" in /home/nginx/conf/nginx.conf:13,等等不能正常识别数字问题


    9. make


    10. make install

    
    
  • 相关阅读:
    逻辑回归---sklearn
    逻辑回归---梯度下降法
    线回与非线回---线性回归标准方程法
    线回与非线回---sklearn--多项式回归
    线回与非线回---sklearn--多元线性回归
    web前端2020/1/20学习笔记
    web前端2020/1/18-2020/1/19学习笔记
    web前端2020/1/17学习笔记
    java2020/1/16学习笔记
    web前端2020/1/16学习笔记
  • 原文地址:https://www.cnblogs.com/slgkaifa/p/7063662.html
Copyright © 2020-2023  润新知