海思3559A编译nginx和nginx-rtmp-module过程

1 篇文章 0 订阅
1 篇文章 0 订阅

相关参考文献如下:
https://zhuanlan.zhihu.com/p/28009037
https://blog.csdn.net/shan614667793/article/details/78424267
https://blog.csdn.net/noe_dwp/article/details/106547857

编译环境:Ubuntu 4.8.4-2ubuntu1~14.04.4,已经安装好海思3559A的编译环境
完整过程:
一、准备阶段
mkdir nginx-1.8.1-hisi
拷贝zlib和openssl压缩包到该新建目录下
tar zxvf zlib-1.2.8.tar.gz
unzip -o openssl-OpenSSL_1_0_1-stable.zip

拷贝nginx和nginx-rtmp-module到该新建目录下
tar zxvf nginx-1.8.1.tar.gz -C ./nginx-1.8.1-hisi

cd nginx-1.8.1-hisi/nginx-1.8.1

二、configure阶段
参考https://blog.csdn.net/shan614667793/article/details/78424267 ,需要修改如下几个文件才能避免configure报错:
1、编辑目录下的auto/cc/name文件,将21行的“exit 1”注释掉,否则下面的./configure会报错:checking for C compiler … found but is not working
2、编辑auto/types/sizeof文件,大概36行的位置( $CC 改为 gcc );找到 ngx_size= 这一行,改为 ngx_size=4

./configure --prefix=…/nginxout
–with-cc=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-gcc
–with-cpp=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-g++
–with-zlib=…/zlib-1.2.8
–with-openssl=…/openssl-OpenSSL_1_0_1-stable
–add-module=…/nginx-rtmp-module
–without-http_rewrite_module
–without-http_fastcgi_module
–conf-path=nginx.conf
–without-http_charset_module
–without-http_ssi_module
–without-http_userid_module
–without-http_auth_basic_module
–without-http_geo_module
–without-http_map_module
–without-http_split_clients_module
–without-http_referer_module
–without-http_uwsgi_module
–without-http_scgi_module
–without-http_memcached_module
–without-http_memcached_module
–without-http_limit_conn_module
–without-http_limit_req_module
–without-http_empty_gif_module
–without-http_browser_module
–without-mail_pop3_module
–without-mail_imap_module
–without-mail_smtp_module

三、make阶段
make
1、 报错error: ‘NGX_SYS_NERR’ undeclared,需要:找到objs/ngx_auto_config.h文件,增加3行
#ifndef NGX_SYS_NERR
#define NGX_SYS_NERR 132
#endif
2、报错:libssl.a ELF重定位错误,修改objs/Makefile,查找到如下位置(1248行附近),在config行增加–cross-compile-prefix=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux- 且增加no-asm no-async,如下:
…/openssl-OpenSSL_1_0_1-stable/.openssl/include/openssl/ssl.h: objs/Makefile
cd …/openssl-OpenSSL_1_0_1-stable
&& if [ -f Makefile ]; then $(MAKE) clean; fi
&& ./config --prefix=…/openssl-OpenSSL_1_0_1-stable/.openssl no-shared no-asm no-async --cross-compile-prefix=aarch64-himix100-linux-
&& $(MAKE)
&& $(MAKE) install LIBDIR=lib
3、报错:openssl存在m64错误,继续修改上面的makefile文件,删除这两行避免每次make都冲掉ssl的makefile,然后修改openssl已经生成的makefile,删除有m64的地方(两处),至此openssl编译可正常通过
4、报错:/ngx_cycle.c:457:对‘ngx_shm_free’未定义的引用,ngx_shm_free函数需要设置宏才可访问到,修改ngx_auto_config.h ,加入这几行:
#ifndef NGX_HAVE_SYSVSHM
#define NGX_HAVE_SYSVSHM 1
#endif
至此编译通过

四、安装阶段
make install

五、部署运行阶段
1、将nginxout目录整体拷贝到3559A单板的某个目录下,nginxout名字不修改避免运行nginx会报目录错误。
2、cd nginxout
chmod 777 sbin/nginx
2、修改nginxout/nginx.conf文件,修改user字段为 user root;,这样避免读取用户出错
3、增加rtmp服务信息:
rtmp { #RTMP服务
server {
listen 1935; #//服务端口
chunk_size 4096; #//数据传输块的大小

              application vod {
                     play .; #//视频文件存放位置。
                    }
  
            application live{ #第一处添加的直播字段
                  live on;
                  }
           }
   }

4、运行: ./sbin/nginx

六、播放RTMP视频流:
publish RTMP流到该部署好的nginx rtmp server,以支持前端通过video.js可播放rtmp视频。video.js兼容性没有vlc好,需要与nginx rtmp server配套才可播放

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值