[Libav-user] Error when creating .so file using .c program and ffmpeg using android NDK
Alex Cohn
alexcohn at netvision.net.il
Fri May 31 07:45:10 CEST 2013
On May 30, 2013 9:36 PM, "prathap" <prathap.malempati at gmail.com> wrote:
>
> Hi everybody
>
> when i am trying to create .so file using .c file and ffmpeg and android
NDK
> i got this errors
>
>
> Install : libmylib.so => libs/armeabi-v7a/libmylib.so
> Install : libmylib.so => libs/armeabi/libmylib.so
> Compile x86 : mylib <= mylib.c
> cc1: error: unrecognized command line option '-mfloat-abi=softfp'
> cc1: error: unrecognized command line option '-mfpu=neon'
> jni/mylib.c:1:0: error: bad value (armv7-a) for -march= switch
> make: *** [obj/local/x86/objs/mylib/mylib.o] Error 1
>
>
----------------------------------------------------------------------------------------------------------------------
>
>
> My android.mk file is
>
> LOCAL_PATH := $(call my-dir)
>
> include $(CLEAR_VARS)
>
> LOCAL_LDLIBS = -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib
> -L$(LOCAL_PATH)/../obj/local/armeabi/ -lavformat -lavcodec -lpostproc
> -lswscale -lavutil -llog -ljnigraphics -lz -ldl -lgcc
> LOCAL_C_INCLUDES += $(LOCAL_PATH)/ffmpeg
> LOCAL_SRC_FILES := mylib.c
> LOCAL_CFLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon
> LOCAL_MODULE := mylib
> #LOCAL_SRC_FILES := mylib.c
>
> include $(BUILD_SHARED_LIBRARY)
>
> LOCAL_PATH := $(call my-dir)
> LOCAL_C_INCLUDES += $(LOCAL_PATH)/ffmpeg
> include $(all-subdir-makefiles)
>
>
-----------------------------------------------------------------------------------------------------------------------
>
>
> My .c program is like this
>
>
> #include <jni.h>
> #include <android/log.h>
> #include <com_myffmpegtest_MainActivity.h>
>
> #include <libavcodec/avcodec.h>
> #include <libavformat/avformat.h>
> #include <libavformat/avio.h>
> #include <libswscale/swscale.h>
> #include <libavutil/avstring.h>
>
> #define LOG_TAG "mylib"
> #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG,
> __VA_ARGS__)
> #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,
> __VA_ARGS__)
>
> JNIEXPORT jint JNICALL Java_com_myffmpegtest_MainActivity_logFileInfo
> (JNIEnv *env, jclass this, jstring filename)
> {
> av_register_all();
>
> AVFormatContext *pFormatCtx;
> const jbyte *str;
> str = (*env)->GetStringUTFChars(env, filename, NULL);
>
> if(avformat_open_input(&pFormatCtx, str, NULL, NULL)!=0)
> {
> LOGE("Can't open file '%s'\n", str);
> return 1;
> }
> else
> {
> LOGI("File was opened\n");
> LOGI("File '%s', Codec %s",
> pFormatCtx->filename,
> pFormatCtx->iformat->name
> );
> }
> return 0;
> }
>
>
-------------------------------------------------------------------------------------------------------------------
>
>
> Thanks for you suggestions
>
> Regards
> Prathap.M
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.
BR,
Alex Cohn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130531/a2b801f1/attachment.html>
More information about the Libav-user
mailing list