Hi3520DV400 编译 openssl、pcre、zlib、nginx

目录

注意

1.openssl编译

2.pcre编译

3.zlib编译

4. nginx编译

5.nginx 操作


注意

1.Hi3521D_V100&Hi3520D_V400共用SDK;

2.海思SDK版本中代号C01是uclibc库,C02是glibc库;

3.一般情况下无需编译busybox,直接使用SDK目录下制作好的文件系统Hi3521DV100_SDK_V1.0.4.0/package/rootfs_uclibc.tgz,加入自己的文件,修改启动脚本,再使用mkyaffs2image100制作文件系统即可。

1.openssl编译

./Configure linux-generic32 no-async no-asm shared --prefix=/home/ubuntu/web/nginx/install/openssl --cross-compile-prefix=arm-hisiv500-linux-
make depend
make && make install

2.pcre编译

./configure --prefix=/home/ubuntu/web/nginx/install/pcre --host=arm-hisiv500-linux CC=arm-hisiv500-linux-gcc --build=arm
make && make install

3.zlib编译

export CHOST=arm-hisiv500-linux
./configure --prefix=/home/ubuntu/web/nginx/install/zlib
make && make install

4. nginx编译

4.1使用自定义 OpenSSL 库编译nginx:
    打开nginx源文件下的,修改 auto/lib/openssl/conf 大约第 39行至 42 行,把: 

CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a

    修改为:

CORE_INCS="$CORE_INCS $OPENSSL/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"

4.2使用自定义 pcre 库编译 nginx:
    打开nginx源文件下的,修改 auto/lib/pcre/conf 大约第 80行至 83 行,把:

CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a"

  修改为:

CORE_INCS="$CORE_INCS $PCRE/include"
CORE_DEPS="$CORE_DEPS $PCRE/include/pcre.h"
LINK_DEPS="$LINK_DEPS $PCRE/lib/libpcre.a"
CORE_LIBS="$CORE_LIBS $PCRE/lib/libpcre.a"

4.3设置nginx编译的环境变量,配置编译环境,生成编译脚本

export INSTALL_PATH=/home/ubuntu/web/nginx/install      #指定编译后的安装目录
export CONFIG_DIR=/app/nginx/conf                       #指定编译后安装的配置文件目录
export LOG_DIR=/app/nginx/log                           #指定编译后安装的日志文件目录
export TEMP_DIR=/app/nginx/tmp                          #指定编译后安装的临时文件目录
export CC_PATH=arm-hisiv500-linux-gcc                   #指定交叉编译工具目录
export CPP_PATH=arm-hisiv500-linux-g++                  #指定交叉编译工具目录
./configure \
--prefix=$INSTALL_PATH/nginx \
--conf-path=$CONFIG_DIR/nginx.conf \
--error-log-path=$LOG_DIR/error.log \
--pid-path=$CONFIG_DIR/nginx.pid \
--lock-path=$CONFIG_DIR/nginx.lock \
--http-log-path=$LOG_DIR/access.log \
--http-client-body-temp-path=$TEMP_DIR/body \
--http-proxy-temp-path=$TEMP_DIR/proxy \
--http-fastcgi-temp-path=$TEMP_DIR/fastcgi \
--with-pcre=$INSTALL_PATH/pcre \
--with-openssl=$INSTALL_PATH/openssl \
--with-zlib=$INSTALL_PATH/zlib \
--with-cc=$CC_PATH \
--with-cpp=$CPP_PATH \
--with-cc-opt="-I /opt/hisi-linux/x86-arm/arm-hisiv500-linux/include" \
--with-ld-opt="-L /opt/hisi-linux/x86-arm/arm-hisiv500-linux/lib" \
--with-http_ssl_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--without-http_gzip_module \
--without-http_upstream_zone_module 

    问题1:./configure: error: C compiler arm-hisiv500-linux-gcc is not found
        解决:auto\cc\name  ngx_feature_run=no
    问题2:./configure: error: can not detect int size
        解决:auto\types\sizeof ngx_size=`$NGX_AUTOTEST` -> ngx_size=4

4.5编译安装

make -j4
make install
arm-hisiv500-linux-strip $INSTALL_PATH/nginx/sbin/nginx
mkdir $INSTALL_PATH/nginx/tmp

    问题1:错误: ‘NGX_SYS_NERR’未声明(在此函数内第一次使用)
    问题2:对‘ngx_shm_alloc’未定义的引用

    解决:
        进入objs目录找到 ngx_auto_config.h 文件,增加宏定义

       

#ifndef NGX_SYS_NERR
#define NGX_SYS_NERR 132
#endif

#ifndef NGX_HAVE_SYSVSHM
#define NGX_HAVE_SYSVSHM 1
#endif

5.nginx 操作
 

启动 nginx
停止/重启 nginx -s reload(quit、stop)
命令帮助 nginx -h
验证配置文件 nginx -t
配置文件 nginx.conf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值