Android ndk ffmpeg : Unknown mnemonic error
<p>I'm building a simple video app and want to embed a watermark on the recorded videos. I am using ffmpeg for this process and have successfully compiled it.  The issue is when I try to link it with my project in Android Studio using ndk-build.cmd command, it gives me the following error: </p>

<pre><code>C:\Users\MyPC\AppData\Local\Temp\ccIRLDZn.s: Assembler messages:
C:\Users\MyPC\AppData\Local\Temp\ccIRLDZn.s:8547: Error: unknown mnemonic `itt' -- `itt gt'
C:\Users\MyPC\AppData\Local\Temp\ccIRLDZn.s:8548: Error: unknown mnemonic `movgt' -- `movgt x25,x0'
C:\Users\MyPC\AppData\Local\Temp\ccIRLDZn.s:8549: Error: unknown mnemonic `movgt' -- `movgt x0,x1'
C:\Users\MyPC\AppData\Local\Temp\ccIRLDZn.s:8551: Error: unknown mnemonic `it' -- `it le'
C:\Users\MyPC\AppData\Local\Temp\ccIRLDZn.s:8552: Error: unknown mnemonic `movle' -- `movle x0,x2'
C:\Users\MyPC\AppData\Local\Temp\ccIRLDZn.s:8554: Error: unknown mnemonic `it' -- `it gt'
C:\Users\MyPC\AppData\Local\Temp\ccIRLDZn.s:8555: Error: unknown mnemonic `movgt' -- `movgt x25,x0'
make: *** [obj/local/arm64-v8a/objs/myProject_Videokit/ffmpeg.o] Error 1
</code></pre>

<p>My development environment is </p>

<ul>
<li>OS : Windows10 x86_64 </li>
<li>Command line : Cygwin 64bit </li>
<li>Android NDK version : android-ndk-r11c</li>
<li>ffmpeg version : ffmpeg-3.0.2</li>
<li>Android Studio : 2.1.1</li>
</ul>

<p>First, I installed Cygwin64bit and added 'make', 'dos2unix', 'c++ gcc' packages. And I decompressed ffmpeg folder in C:/android-ndk-r11c/sources. This is the build script I used. </p>

<p><strong>config.sh</strong></p>

<pre><code>#!/bin/bash
NDK=C:/android-ndk-r11c
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64

#I used cygpath to avoid path errors in Cygwin. 

CUR="$(cygpath -m "$(pwd)")" 
TEMPDIR="$(cygpath -m "/tmp")"
TMP="$(cygpath -m "/tmp")"
TMPDIR="$(cygpath -m "/tmp")"
CPU=arm
PREFIX=$CUR/android/$CPU 
ADDI_CFLAGS="-marm"

./configure 
    --prefix=$PREFIX 
    --enable-shared 
    --disable-static 
    --disable-doc 
    --disable-ffmpeg 
    --disable-ffplay 
    --disable-ffprobe 
    --disable-ffserver 
    --disable-doc 
    --disable-symver 
    --enable-protocol=concat
    --enable-protocol=file
    --enable-muxer=mp4
    --enable-demuxer=mpegts
    --enable-memalign-hack
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- 
    --target-os=linux 
    --arch=arm 
    --enable-cross-compile 
    --sysroot=$SYSROOT 
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" 
    --extra-ldflags="$ADDI_LDFLAGS" 
    $ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install
</code></pre>

<p>I ran this .sh in Cygwin(as administrator) but it didn't work. So I typed each of those lines on Cygwin and it compiled successfully. I tried both <code>--target-os=android</code> and <code>--target-os=linux</code>, but both didn't solve the problem above. </p>

<p>Then I followed this tutorial (enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/). Based on that, I made a native method in my project and built header file and c file.(To do that, I followed this video. youtube.com/watch?v=kFtxo7rr2HQ) </p>

<p>After that, I cloned this repo(github.com/HikoQiu/JNI_INVOKE_FFMPEG) and copied - pasted the jni folder into my project. And after making the Android.mk and Application.mk, I ran the C:/android-ndk-r11c/ndk-build.cmd in the Android Studio terminal and it gave me the error above. </p>

<p>These are the Makefiles I used. </p>

<p><strong>myProject/app/src/main/jni/Android.mk</strong> </p>

<pre><code>LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := com_example_project_Videokit
LOCAL_LDLIBS := -llog -ljnigraphics -lz
LOCAL_CFLAGS := -Wdeprecated-declarations
ANDROID_LIB := -landroid
LOCAL_C_INCLUDES := C:\android-ndk-r11c\sources\ffmpeg-3.0.2
LOCAL_SRC_FILES := com_example_project_Videokit.c ffmpeg.c ffmpeg_filter.c ffmpeg_opt.c cmdutils.c
LOCAL_SHARED_LIBRARIES := libavformat libavcodec libswscale libavutil
include $(BUILD_SHARED_LIBRARY)
$(call import-module,ffmpeg-3.0.2/android/arm)
</code></pre>

<p><strong>myProject/app/src/main/jni/Application.mk</strong></p>

<pre><code>APP_ABI := all
</code></pre>

<p><strong>C:/android-ndk-r11c/sources/ffmpeg-3.0.2/android/arm/Android.mk</strong></p>

<pre><code>LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavcodec
LOCAL_SRC_FILES:= lib/libavcodec-57.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavformat
LOCAL_SRC_FILES:= lib/libavformat-57.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libswscale
LOCAL_SRC_FILES:= lib/libswscale-4.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavutil
LOCAL_SRC_FILES:= lib/libavutil-55.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavfilter
LOCAL_SRC_FILES:= lib/libavfilter-6.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libwsresample
LOCAL_SRC_FILES:= lib/libswresample-2.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
</code></pre>

<p>And this is my project structure so far. com_example_myProjct.c is the file that I used as a moduleName in build.gradle file and as LOCAL_MODULE in Android.mk . </p>

<pre><code>app
 - build
 - libs
 - src
   - androidTest
   - main
     - java
        -com.example.myProject
          -MainActivity
          -Videokit   //this is the class where I called the native method.
     - jni
        -Android.mk
        -Application.mk
        -cmdutils.c
        -cmdutils.h
        -com_example_myProject.c
        -com_example_myProject.h
        -ffmpeg.c
        -ffmpeg.h
        -ffmpeg_filter.c
        -ffmpeg_opt.c
        -ffmpeg_opt.h
        -logjam.h
   - obj
   - res
   AndroidManifest.xml
 - test 
</code></pre>

<p><strong>app/gradle.build</strong></p>

<pre><code>apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.myProjct"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0.0"

        ndk {
            moduleName "com_example_myProjet_Videokit"
        }
        sourceSets.main {
            jni.srcDirs = []
            jniLibs.srcDir 'src/main/libs'
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-rules.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}
</code></pre>

<p>Any ideas? </p>