Giter VIP home page Giter VIP logo

cross-compile-nginx-with-rtmp-module-for-android's Introduction

Cross Compile Nginx with RTMP Module for Android

See full Chinese explanation blog here: https://zhangtom.com/2017/07/11/交叉编译带RTMP模块的Nginx到Android/

Succeed on macOS Sierra 10.12.5, macOS High Sierra 10.13.6, Ubuntu 14.04.5, with Android NDK r15c

Feel free to open issue if you have any question.

Prerequisites

  • Download latest stable version source code tarball of Nginx (make_nginx.sh will extract it automatically)
  • Download latest stable version source code of nginx-rtmp-module
  • Download and extract latest LTS version source code of openssl and openssl-fips(no need for openssl-1.1.0 series)
  • Download this repo and place source codes as following:
    .
    ├── Setenv-android.sh
    ├── glob (glob.c and glob.h will be copied to nginx/src/os/unix/ by make_nginx.sh)
    │   ├── glob.c
    │   └── glob.h
    ├── portable_cmds.sh
    ├── make_nginx.sh
    ├── make_openssl.sh
    │
    ├── nginx-1.12.0/ (this directory is generated by make_nginx.sh during extracting the counterpart tarball file)
    │   └── ...
    ├── nginx-1.12.0.tar.gz (Nginx source code tarball file, the version could be different)
    ├── nginx-rtmp-module/
    │   └── ...
    ├── openssl-1.1.0f/ (openssl source code directory, the version could be different)
    │   └── ...
    ├── openssl-fips-2.0.16/ (openssl-fips source code directory, the version could be different, no need for openssl-1.1.0 series)
    │   └── ...
    └── sdcard (this directory will be generated if compile successfully)
        └── nginx
    
  • Download and install Android SDK if never installed before, make sure adb path is added to environment PATH and it works well
  • Download and install Android NDK if never installed before, modify Setenv-android.sh if needed (ANDROID_NDK_ROOT, _ANDROID_EABI, _ANDROID_API, etc.)

Build

execute these commands in Terminal:

# the leading period is important
. ./make_openssl.sh
. ./make_nginx.sh

How to run nginx on Android

See NginxDemo.

License

Setenv-android.sh: OpenSSL license
glob.c and glob.h(source): BSD-3-Clause License
other files: WTFPL

cross-compile-nginx-with-rtmp-module-for-android's People

Contributors

tatowilson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cross-compile-nginx-with-rtmp-module-for-android's Issues

openssl cross compile error

arm-linux-androideabi-gcc -I. -Icrypto/include -Iinclude -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR=""/usr/local/ssl/android-14"" -DENGINESDIR=""/usr/local/ssl/android-14/lib/engines-1.1"" -Wall -O3 -pthread -mandroid -fPIC --sysroot=/Users/ouzhijie/Library/Android/sdk/ndk-bundle/platforms/android-14/arch-arm -Wa,--noexecstack -march=armv7-a -Wa,--noexecstack -fPIC -DOPENSSL_USE_NODELETE -c -o crypto/armcap.o crypto/armcap.c
crypto/armcap.c:10:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>

build error : sed: can't read s@\( *\)case "$ngx_feature_run" in@\1adb push $NGX_AUTOTEST /data/local/tmp 2>\&1 >/dev/null\

sed: can't read s@( *)case "$ngx_feature_run" in@\1adb push $NGX_AUTOTEST /data/local/tmp 2>&1 >/dev/null
&@: No such file or directory
sed: can't read s@( )esac@&
\1adb shell rm /data/local/tmp/$(basename $NGX_AUTOTEST)@: No such file or directory
sed: can't read s@/bin/sh -c $NGX_AUTOTEST@adb shell /data/local/tmp/$(basename $NGX_AUTOTEST)@: No such file or directory
sed: can't read s@$NGX_AUTOTEST@adb shell /data/local/tmp/$(basename $NGX_AUTOTEST)@: No such file or directory
sed: can't read s@ngx_test="$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c"@ngx_test="$CC $CC_AUX_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c"@: No such file or directory
sed: can't read s@( )ngx_size=$NGX_AUTOTEST@\1adb push $NGX_AUTOTEST /data/local/tmp 2>&1 >/dev/null
\1ngx_size=adb shell /data/local/tmp/$(basename $NGX_AUTOTEST)
\1adb shell rm /data/local/tmp/$(basename $NGX_AUTOTEST)@: No such file or directory
sed: can't read [email protected]/@@: No such file or directory
sed: can't read s@UNIX_DEPS=.
@&
src/os/unix/glob.h \@: No such file or directory
sed: can't read s@UNIX_SRCS=.
@&
src/os/unix/glob.c \@: No such file or directory
sed: can't read s@#include <ngx_core.h>@&
#include <openssl/des.h>@: No such file or directory
sed: can't read s@value = crypt((char *) key, (char *) salt);@value = DES_crypt((char *) key, (char *) salt);@: No such file or directory
building for android-arm
checking for C compiler ... not found

./configure: error: C compiler /gcc is not found

make: *** No rule to make target build', needed by default'. Stop.
make: *** No rule to make target `install'. Stop.

Pcre support issue.

make_pcre.sh.txt
make_pcre.sh.txt
Info
OS & Version: ubuntu 18.04
Android NDK Version: NDK-13b
Nginx Version: 1.14.2
OpenSSL Version: 1.1.1b
OpenSSL FIPS Version(if any): 2.0.16

Describe the error
Hi sir, I have built success without pcre according this script, but regex must be support in our project, so i enable pcre and built pcre OK. However I got error when i built nginx again.

Log
checking for int size ... CANNOT LINK EXECUTABLE: library "libgnustl_shared.so" not found
page record for 0xb6f3e01c was not found (block_size=16)

make_pcre.log
make_nginx.sh.txt
make_pcre.sh.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.