Bug 59250

Summary: Error linking ffmpeg in ANDROID
Product: GStreamer SDK Reporter: Luis Linietsky <luis.linietsky>
Component: GeneralAssignee: bugs
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: 2012.11   
Hardware: ARM   
OS: other   
Whiteboard:
i915 platform: i915 features:
Attachments: jni/Android.mk
Fixed libgstffmpeg.la

Description Luis Linietsky 2013-01-11 16:26:26 UTC
Created attachment 72867 [details]
jni/Android.mk

Hi,
I have been testing the Android Tutorial5 from gstreamer-sdk. 
When I try to build the project with support for ffmpeg plugin, I keep getting following error:

luigi@Fender:~/workspace/Tutorial5$ ndk-build  
GStreamer      : [GEN] => gst-build/gstreamer_android.c
GStreamer      : [COMPILE] => gst-build/gstreamer_android.c
GStreamer      : [LINK] => gst-build/libgstreamer_android.so
/home/luigi/projects/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/luigi/projects/gstreamer-sdk/lib/libavcodec.a(flashsvenc.o): in function flashsv_encode_frame:libavcodec/flashsvenc.c:169: error: undefined reference to 'compress2'
/home/luigi/projects/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/luigi/projects/gstreamer-sdk/lib/libavcodec.a(tiffenc.o): in function encode_strip:libavcodec/tiffenc.c:165: error: undefined reference to 'compress'

The .o files are referencing compress and compress2 from zlib, but the symbols in such library are z_compress and z_compress2 (there is a #define compress z_compress in the header), so i guess this is a compilation error? also I just need to use h264 from ffmpeg, so is there any plugin or module i can disable for this error not to happen? (I don't really need flash or tiff decoding)

I am attaching the jni/Android.mk file, is the only thing I changed in tutorial5 project.

Thanks,
Luigi
Comment 1 Andoni Morales Alastruey 2013-01-11 21:17:22 UTC
Created attachment 72875 [details]
Fixed libgstffmpeg.la

That's a bug in our side. To fix it, edit the file $ANDROID_SDK_ROOT/lib/gstreamer-0.10/static/libgstffmpeg.la and append "-lz" at the end the variable "dependency_libs".
Comment 2 Luis Linietsky 2013-01-11 21:24:10 UTC
Hi, I already noticed zlib was missing and did that same thing on that same file, however it was no good.
Could it be related to the following code I found in "includes/zconf.h" for the source code?

#  ifndef Z_SOLO
#    define compress              z_compress
#    define compress2             z_compress2
#    define compressBound         z_compressBound
#  endif

I bet that Z_SOLO must be defined yet compress, compress2 and compressBound don't.
Comment 3 Lubosz Sarnecki 2013-02-16 15:16:29 UTC
I still need to add -lz to libgstffmpeg.la when I use cerbero. This does not seem to be fixed.
Comment 4 Andoni Morales Alastruey 2013-02-16 17:22:52 UTC
(In reply to comment #3)
> I still need to add -lz to libgstffmpeg.la when I use cerbero. This does not
> seem to be fixed.

It's fixed, the one provided here. It's just that it's not in any release yet.
Comment 5 Andoni Morales Alastruey 2013-02-16 17:25:55 UTC
I am sorry, I it's not pushed yet :) Thanks for the reminder
Comment 6 Andoni Morales Alastruey 2013-02-18 01:03:20 UTC
commit 1f62a483137ccf630e710deb92ef34f50cc25a28
Author: Andoni Morales Alastruey <ylatuya@gmail.com>
Date:   Mon Feb 18 02:02:02 2013 +0100

    gst-ffmpeg-static: fix static link using the libtool libs
    
    Fixes #59250
Comment 7 Luis Linietsky 2013-02-18 20:37:20 UTC
Hi, I tried to check this but when I ran "cerbero package gstreamer-sdk" I am getting the following error, could it be related to this bug resolution?

[(77/87) gst-ffmpeg-static -> post_install ]
Traceback (most recent call last):
  File "/home/luigi/gstreamer/cerbero/cerbero/main.py", line 103, in run_command
    res = commands.run(command, self.config, self.args)
  File "/home/luigi/gstreamer/cerbero/cerbero/commands/__init__.py", line 78, in run
    return _commands[command].run(config, args)
  File "/home/luigi/gstreamer/cerbero/cerbero/commands/package.py", line 67, in run
    self._build_deps(config, p)
  File "/home/luigi/gstreamer/cerbero/cerbero/commands/package.py", line 89, in _build_deps
    cookbook=self.store.cookbook)
  File "/home/luigi/gstreamer/cerbero/cerbero/commands/build.py", line 70, in runargs
    oven.start_cooking()
  File "/home/luigi/gstreamer/cerbero/cerbero/build/oven.py", line 75, in start_cooking
    self._cook_recipe(recipe, i, len(ordered_recipes))
  File "/home/luigi/gstreamer/cerbero/cerbero/build/oven.py", line 108, in _cook_recipe
    ex))
FatalError: Fatal Error: Error performing step post_install: [Errno 2] No such file or directory: '/opt/gstreamer-sdk/lib/gstreamer-0.10/static/libgstffmpeg.la'
***** Error running 'package' command:
Fatal Error: Error performing step post_install: [Errno 2] No such file or directory: '/opt/gstreamer-sdk/lib/gstreamer-0.10/static/libgstffmpeg.la'
usage: cerbero-uninstalled [-h] [-c CONFIG]
                           
                           {add-recipe,tag,genxcconfig,genlibfiles,check,list-packages,build,add-package,genvsprops,shell,run,cleanone,packageinfo,buildone,wipe,debug-packages,package,bootstrap,list,checkpackage,deps,gensdkshell}
                           ...
Comment 8 Sebastian Dröge (slomo) 2013-02-19 08:08:45 UTC
(In reply to comment #7)

> FatalError: Fatal Error: Error performing step post_install: [Errno 2] No
> such file or directory:
> '/opt/gstreamer-sdk/lib/gstreamer-0.10/static/libgstffmpeg.la'

Can you paste the complete output of "buildone gst-ffmpeg-static" and afterwards "package gstreamer-sdk" again?
Comment 9 Sebastian Dröge (slomo) 2013-02-19 14:51:41 UTC
After you update cerbero (via git pull --rebase), everything should work when first building gst-ffmpeg-static again and then calling package gstreamer-sdk again (as explained in last comment).

I just fixed a build error in gst-ffmpeg-static that caused your last problem.
Comment 10 Luis Linietsky 2013-02-19 16:03:26 UTC
That fixed it. 
Thanks.
Comment 11 Ranyu 2013-03-12 01:11:10 UTC
the la does not fix my problem.  followed link here: http://gstreamer-devel.966125.n4.nabble.com/Several-problems-in-Gstreamer-Android-tt4658132.html#a4658806 and it works for me.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.