Nginx rtmp module compilation arm version problem

Nginx rtmp module compilation arm version problem

I worked on it for a whole day today and finally compiled nginx to add support for rtmp module. I encountered many problems in the process. I recorded this article and hope it can help students who encounter such problems.

1. Preparation:

1. Download the nginx source code: wget http://xiazai.jb51.net/202112/yuanma/nginx_jb51.rar

2. Download the source code of the dependent library libpcre.a: wget http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.39.tar.gz

3. Download the dependent library libz.a source code: wget http://xiazai.jb51.net/202112/yuanma/pcre_jb51.rar

4. Download the rtmp module source code: GitHub - arut/nginx-rtmp-module: NGINX-based Media Streaming Server

After the source code of the first three libraries is downloaded, they are all decompressed.

2. Source code compilation

The pcre library and libz library do not need to be compiled separately. They are compiled together when adding modules when compiling nginx.

1. configure

cd nginx-1.20.2 //Switch to the nginx source directory./configure --prefix=/usr/sbin --add-module=/home/tianyexing/Documents/tools/nginx_rtmp/nginx-rtmp-module-master --with-http_ssl_module --with-debug --with-pcre=/home/tianyexing/Documents/tools/pcre/pcre-8.39 --with-zlib=/home/tianyexing/Documents/tools/zlib/zlib-1.2.11
 
// --prefix=/usr/sbin specifies the installation directory. The program generated during the final install is placed in this directory. // --add-module=/home/tianyexing/Documents/tools/nginx_rtmp/nginx-rtmp-module-master compiles the rtmp module. This directory is the directory where the source code is unzipped after downloading it above. // --with-pcre=/home/tianyexing/Documents/tools/pcre/pcre-8.39 compiles the pcre module. This directory is the directory where the source code is unzipped after downloading it above. // --with-zlib=/home/tianyexing/Documents/tools/zlib/zlib-1.2.11 compiles the zlib module. This directory is the directory where the source code is unzipped after downloading it above.

Because I want to compile the arm-himix200-linux version, but the configure in the nginx source directory does not support --host, so I use

--with-cc=arm-himix200-linux-gcc will also fail, so you can only choose to modify it manually (the modification points will be discussed below). After execution, objs and Makefile will be generated in the current directory.

1) Modify objs/Makefile

2) Modify the nginx-1.20.2/auto/cc/conf file, such as:

3) Modify nginx-1.20.2/auto/types/sizeof, such as:

You can search for other changes, as I can’t remember several of them.

2. Compilation error

Just make it in the nginx source directory, because it executes objs/Makefile

1) The openssl/ssl.h header file cannot be found, such as:

The system already has openssl/ssl.h file, which is in the system directory /usr/include

But when compiling, it prompts that it cannot be found. I don't know if it is related to compiling the arm version. Because I happen to have the openssl header file of this arm version, I didn't bother here and copied the openssl directory from somewhere else and used it directly. However, after adding the header file directory, you need to modify objs/Makefile. My newly added header file directory is in the nginx source code directory src, and the modification is as follows:

This CORE_INCS is the header file used to compile nginx.

This is the header file directory that may be used by other modules, nginx-rtmp, pcre, and zlib.

2) IPv6 issues

It prompts that this definition cannot be found, but this definition exists in the system. There is no need to worry about it here. Since ipv6 is not used, the relevant code is commented out.

3) Archive has no index; run ranlib to add one ---- Library platform mismatch problem

Because it has been compiled many times, both the x86 version and the arm version have been compiled, and then there is no make clean. The previous x86 version of the library is used here, so an error is prompted here, because I want to compile the arm-himix200-linux version, check the library information such as:

So you need to make clean, and then execute the above configure to regenerate the Makefile.

4) Unable to find ssl library and crypto library

There are the following links in objs/Makefile

Error in last link

I compiled this arm version of the library before, and then directly modified it to an absolute path. If you don't have these two libraries, google them.

Finally compiled my arm version and x86 version.

3. Execution on the target board

When copied to the arm version for execution, it failed, but there was no prompt message. As a result, nginx -s reload gave an error message, such as:

Because during configure, the installation directory --prefix=/usr/sbin is specified. After the compilation is completed, three new directories sbin, conf, and logs will be created under /usr/sbin. The directories are as follows:

So I created the corresponding sbin, conf, and logs directories on the arm board and copied all the files in those directories to them. The result was successful:

It has been seen that it is listening on port 1935.

The arm version has been compiled before, but it also failed to run successfully because the installation path specified by prefix during configure is a directory on the PC, and the result is the open() error as above. If the directory specified by --prefix does not exist on the target board during configure, the operation will fail. How can this be modified? I haven't found it yet, if anyone knows please let me know.

This is the end of this article about compiling the arm version of the nginx rtmp module. For more relevant nginx rtmp module content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Nginx uses nginx-rtmp-module module to realize the live broadcast room function

<<:  A brief analysis of the use of the HTML webpack plugin

>>:  A commonplace technique for implementing triangles using CSS (multiple methods)

Recommend

12 Javascript table controls (DataGrid) are sorted out

When the DataSource property of a DataGrid control...

Idea configures tomcat to start a web project graphic tutorial

Configure tomcat 1. Click run configuration 2. Se...

mysql5.7.21 utf8 encoding problem and solution in Mac environment

1. Goal: Change the value of character_set_server...

Detailed explanation of Linux rpm and yum commands and usage

RPM package management A packaging and installati...

Zen Coding Easy and fast HTML writing

Zen Coding It is a text editor plugin. In a text ...

Summary of several error logs about MySQL MHA setup and switching

1: masterha_check_repl replica set error replicat...

MySQL replication mechanism principle explanation

Background Replication is a complete copy of data...

Linux uses shell scripts to regularly delete historical log files

1. Tools directory file structure [root@www tools...

How to prevent website content from being included in search engines

Usually the goal of building a website is to have...

Analysis of the method of setting up scheduled tasks in mysql

This article uses an example to describe how to s...

How to optimize logic judgment code in JavaScript

Preface The logical judgment statements we use in...

Six tips to increase web page loading speed

Secondly, the ranking of keywords is also related ...