Building ffmpeg

487 views
Skip to first unread message

Stene

unread,
Feb 25, 2011, 5:36:59 AM2/25/11
to android-ndk
Hi,
I am compiling and building ffmpeg for android. It compiled
succesffully and but the libffmpeg.so which is created is not linked
with the static libraries liavcodec.a,libavformat.a etc.
Here is Android.mk file whic is in jni folder.

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libavutil libpostproc
libswscale
LOCAL_LDLIBS := -lz
include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))

And the static libraries libavformat.a,libavcodec.a etc.. are formed
in /obj/local/armeabi folder.
But the libffmpeg.so is not linking with anything.

i am using android-ndk-r5b.Please help me in resolving this issue?

Thanks & Regards,
Stene

David Turner

unread,
Feb 25, 2011, 6:10:14 AM2/25/11
to andro...@googlegroups.com, Stene
Use LOCAL_WHOLE_STATIC_LIBRARIES in this case.

By default, only the content of static libraries that is effectively used by your module's object files is linked into the final shared library.
Since you don't have any source/object files, the static libraries are ignored.

When you use LOCAL_WHOLE_STATIC_LIBRARIES, their full content will be included into the final binary, even if it is not used.


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


Udayakumar Rayala

unread,
Feb 25, 2011, 6:29:37 AM2/25/11
to andro...@googlegroups.com, David Turner, Stene
I am assuming you have source code of avformat, avutil etc under the sub folders. In that case, you would have to put the include to the subfolders as the first line.

Try with this build file:

include $(call all-makefiles-under,$(call my-dir))
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libavutil libpostproc
libswscale
LOCAL_LDLIBS := -lz
include $(BUILD_SHARED_LIBRARY)

My Android.mk file looks as mentioned here https://github.com/uday-rayala/TakePics/blob/master/jni/Android.mk

Thanks,
Uday.

David Turner

unread,
Feb 25, 2011, 7:19:02 AM2/25/11
to Udayakumar Rayala, andro...@googlegroups.com, Stene
On Fri, Feb 25, 2011 at 12:29 PM, Udayakumar Rayala <uday....@gmail.com> wrote:
I am assuming you have source code of avformat, avutil etc under the sub folders. In that case, you would have to put the include to the subfolders as the first line.

This is incorrect, doing this will break the LOCAL_PATH definition. See the documentation for my-dir in docs/ANDROID-MK.html

Stene

unread,
Feb 28, 2011, 12:02:02 AM2/28/11
to android-ndk
Hi David,
I changed the Android.mk as mentioned below. But still there is no
success.

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg
LOCAL_WHOLE_STATIC_LIBRARIES := libavformat libavcodec libavutil
libpostproc libswscale
include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))

i am using android-ndk-r5b and I went through the docs/ANDROID-MK.html
There i didn't get anything like LOCAL_WHOLE_STATIC_LIBRARIES..



On Feb 25, 5:19 pm, David Turner <di...@android.com> wrote:
> On Fri, Feb 25, 2011 at 12:29 PM, Udayakumar Rayala
> <uday.ray...@gmail.com>wrote:
>
> > I am assuming you have source code of avformat, avutil etc under the sub
> > folders. In that case, you would have to put the include to the subfolders
> > as the first line.
> > *
> > *
>
> This is incorrect, doing this will break the LOCAL_PATH definition. See the
> documentation for my-dir in docs/ANDROID-MK.html
>
>
>
>
>
>
>
> > **
> > Try with this build file:
> > *
> > *
> > *
> > include $(call all-makefiles-under,$(call my-dir))
> > LOCAL_PATH := $(call my-dir)
> > *
> > *include $(CLEAR_VARS)
> > LOCAL_MODULE := ffmpeg
> > LOCAL_STATIC_LIBRARIES := libavformat libavcodec libavutil libpostproc
> > libswscale
> > LOCAL_LDLIBS := -lz
> > include $(BUILD_SHARED_LIBRARY)
> > *
> > My Android.mk file looks as mentioned here
> >https://github.com/uday-rayala/TakePics/blob/master/jni/Android.mk
>
> > Thanks,
> > Uday.
>
> > <https://github.com/uday-rayala/TakePics/blob/master/jni/Android.mk>
> > On Fri, Feb 25, 2011 at 4:40 PM, David Turner <di...@android.com> wrote:
>
> >> Use LOCAL_WHOLE_STATIC_LIBRARIES in this case.
>
> >> By default, only the content of static libraries that is effectively used
> >> by your module's object files is linked into the final shared library.
> >> Since you don't have any source/object files, the static libraries are
> >> ignored.
>
> >> When you use LOCAL_WHOLE_STATIC_LIBRARIES, their full content will be
> >> included into the final binary, even if it is not used.
>

某因幡

unread,
Feb 28, 2011, 8:33:42 AM2/28/11
to andro...@googlegroups.com, Stene
hi, take a look.
https://github.com/tewilove/faplayer/blob/master/jni/ext/ffmpeg/Android.mk


2011/2/28 Stene <kate....@gmail.com>:

--
language: Chinese, Japanese, English

Reply all
Reply to author
Forward
0 new messages