<p>On May 30, 2013 9:36 PM, "prathap" <<a href="mailto:prathap.malempati@gmail.com">prathap.malempati@gmail.com</a>> wrote:<br>
><br>
> Hi everybody<br>
><br>
> when i am trying to create .so file using .c file and ffmpeg and android NDK<br>
> i got this errors<br>
><br>
><br>
> Install        : libmylib.so => libs/armeabi-v7a/libmylib.so<br>
> Install        : libmylib.so => libs/armeabi/libmylib.so<br>
> Compile x86    : mylib <= mylib.c<br>
> cc1: error: unrecognized command line option '-mfloat-abi=softfp'<br>
> cc1: error: unrecognized command line option '-mfpu=neon'<br>
> jni/mylib.c:1:0: error: bad value (armv7-a) for -march= switch<br>
> make: *** [obj/local/x86/objs/mylib/mylib.o] Error 1<br>
><br>
> ----------------------------------------------------------------------------------------------------------------------<br>
><br>
><br>
> My <a href="http://android.mk">android.mk</a> file is<br>
><br>
> LOCAL_PATH := $(call my-dir)<br>
><br>
> include $(CLEAR_VARS)<br>
><br>
> LOCAL_LDLIBS = -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib<br>
> -L$(LOCAL_PATH)/../obj/local/armeabi/ -lavformat -lavcodec -lpostproc<br>
> -lswscale -lavutil -llog -ljnigraphics -lz -ldl -lgcc<br>
> LOCAL_C_INCLUDES += $(LOCAL_PATH)/ffmpeg<br>
> LOCAL_SRC_FILES := mylib.c<br>
> LOCAL_CFLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon<br>
> LOCAL_MODULE := mylib<br>
> #LOCAL_SRC_FILES := mylib.c<br>
><br>
> include $(BUILD_SHARED_LIBRARY)<br>
><br>
> LOCAL_PATH := $(call my-dir)<br>
> LOCAL_C_INCLUDES += $(LOCAL_PATH)/ffmpeg<br>
> include $(all-subdir-makefiles)<br>
><br>
> -----------------------------------------------------------------------------------------------------------------------<br>
><br>
><br>
> My .c program is like this<br>
><br>
><br>
> #include <jni.h><br>
> #include <android/log.h><br>
> #include <com_myffmpegtest_MainActivity.h><br>
><br>
> #include <libavcodec/avcodec.h><br>
> #include <libavformat/avformat.h><br>
> #include <libavformat/avio.h><br>
> #include <libswscale/swscale.h><br>
> #include <libavutil/avstring.h><br>
><br>
> #define LOG_TAG "mylib"<br>
> #define LOGI(...)  __android_log_print(ANDROID_LOG_INFO, LOG_TAG,<br>
> __VA_ARGS__)<br>
> #define LOGE(...)  __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,<br>
> __VA_ARGS__)<br>
><br>
> JNIEXPORT jint JNICALL Java_com_myffmpegtest_MainActivity_logFileInfo<br>
> (JNIEnv *env, jclass this, jstring filename)<br>
> {<br>
>     av_register_all();<br>
><br>
>     AVFormatContext *pFormatCtx;<br>
>     const jbyte *str;<br>
>     str = (*env)->GetStringUTFChars(env, filename, NULL);<br>
><br>
>     if(avformat_open_input(&pFormatCtx, str, NULL, NULL)!=0)<br>
>     {<br>
>         LOGE("Can't open file '%s'\n", str);<br>
>         return 1;<br>
>     }<br>
>     else<br>
>     {<br>
>         LOGI("File was opened\n");<br>
>         LOGI("File '%s', Codec %s",<br>
>            pFormatCtx->filename,<br>
>             pFormatCtx->iformat->name<br>
>         );<br>
>     }<br>
>     return 0;<br>
> }<br>
><br>
> -------------------------------------------------------------------------------------------------------------------<br>
><br>
><br>
> Thanks for you suggestions<br>
><br>
> Regards<br>
> Prathap.M</p>
<p>You set compiler options for ARM processor. In your ndk-build command, add APP_ABI=armeabi-v7a. If you really need x86 version, specify the relevant compilation options separately.</p>
<p>BR,<br>
Alex Cohn</p>