ijkplayer 之一:从零开始编译

Posted by DysaniazzZ on September 7, 2019

Build

  • My build Environment

    macOS Mojave 10.14.6
    NDK r10e (strongly recommended)
    
  • install homebrew, git, yasm (skip this step if you have already installed)

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    brew install git
    brew install yasm
    
  • add these lines to your ~/.bash_profile and use source to refresh

    export ANDROID_SDK=<your sdk path>
    export ANDROID_NDK=<your ndk path>
        
    eg:
    open ~/.bash_profile
        
    # android sdk
    export ANDROID_SDK=/Users/dysania/Library/Android/sdk
    export PATH=${PATH}:${ANDROID_SDK}/tools
    export PATH=${PATH}:${ANDROID_SDK}/platform-tools
    export PATH=${PATH}:${ANDROID_SDK}/build-tools/24.0.3
    # android ndk
    export ANDROID_NDK=/Users/dysania/Library/Android/sdk/ndk-bundle/android-ndk-r10e
    export PATH=${PATH}:${ANDROID_NDK}
    
    source ~/.bash_profile
    
  • download the repo and checkout to a new branch

    git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
    cd ijkplayer-android
    git checkout -B latest k0.8.8
    
  • optional: customize your codec/format

    cd config
    rm module.sh
    ln -s <module-yours.sh> module.sh
    cd ..
    
  • start to build

    ./init-android.sh
    
    # optional: init to support https
    ./init-android-openssl.sh
    
    cd android/contrib
    # optional: build to support https
    ./compile-openssl.sh clean
    ./compile-openssl.sh armv7a     // or use "all" for all abis and "armv7a|arm64" to filter
    
    ./compile-ffmpeg.sh clean
    ./compile-ffmpeg.sh arm7a       // or use "all" for all abis and "armv7a|arm64" to filter
    cd ..
    
    ./compile-ijk.sh armv7a         // or use "all" for all abis and "armv7a|arm64" to filter
        
    Yep, all is done now.
    

Compile terminated with errors?

  • linux/perf_event.h: No such file or directory
    • add these lines to the end of module.sh and clean to rebuild
    export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-linux-perf"
    export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bzlib"