cerbero jni compilation __register_atfork problem

Andrew Esh andrew.esh at qterics.com
Tue Jul 2 18:20:36 UTC 2019


I am in the midst of updating Cerbero to use NDK r20. Here is the change I
made to update which NDK is being used by Cerbero. You would have to do the
same this with NDK 19.

https://gitlab.freedesktop.org/andrewes/cerbero/commit/963f7b3ba859e029050b6d7f815e9be89774f821

NOTE: The checksums in cerbero/bootstrap/android.py are sha256sum. You
would have to supply the sha256sum for the NDK 19 file(s) you reference in
that file.

On Tue, Jul 2, 2019 at 11:45 AM Carl Blake <carlb at williamsav.com> wrote:

> I'm pretty sure I'm linking to libc, or at least I am when I use
> gstreamer 1.16.0 downloaded binaries.  The problem occurs when I use
> gstreamer 1.16.0 compiled using cerbero.
>
> I'm having some difficulty figuring out what libraries are being linked
> because of how android studio hides things.  I'm looking through make
> files to try and figure it out.
>
> I think part of the problem is that android studio is using ndk r19 and
> gstreamer compiled with cerbero wants to use ndk r18.  I attempted to
> change android studio to use the ndk r18 cerbero is using, but then I
> couldn't get anything to link.  For example, android studio could no
> longer even find crtbegin_so.o.  So now I'm trying to get cerbero to
> compile using android studio's ndk r19.
>
> I didn't think this would be this difficult.  I suspect I have
> something wrong with my setup.
>
> ----------------------------------------------------
>
> Andrew Esh andrew.esh at qterics.com wrote:
>
> Do you have the API specific library path as a -L argument to your
> linker?
> Here's what I found:
>
> andrewes at
> ubuntu:~/Android/Sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/linux-
> x86_64/sysroot/usr/lib/aarch64-linux-android/23$
> for file in * ; do echo $file; objdump -x $file | grep register_atfork;
> done
> crtbegin_dynamic.o
> 0000000000000000         *UND* 0000000000000000 __register_atfork
> 0000000000000080 UNKNOWN           __register_atfork
> crtbegin_so.o
> 0000000000000000         *UND* 0000000000000000 __register_atfork
> 0000000000000044 UNKNOWN           __register_atfork
> crtbegin_static.o
> 0000000000000000         *UND* 0000000000000000 __register_atfork
> 0000000000000080 UNKNOWN           __register_atfork
> ...
> libc.a
>   4 .text.__register_atfork
> 0000009c  0000000000000000  0000000000000000
>  00000128  2**2
>   5 .text.__unregister_atfork
> 000000a0  0000000000000000  0000000000000000
>  000001c4  2**2
> 0000000000000000 l       .text.__register_atfork 0000000000000000 $x.3
> 0000000000000000 l       .text.__unregister_atfork 0000000000000000
> $x.4
> ...
> libc.so
> 000000000000d144 g     F .text 0000000000000004
>  __register_atfork
>
> (Note the path in my CLI prompt.) So, linking with either one of those
> files will provide the symbol. Perhaps you are getting your libc.so
> from
> another place?
>
> On Fri, Jun 28, 2019 at 6:49 AM Carl Blake <carlb at williamsav.com>
> wrote:
>
> > I have an android app being compiled with gstreamer.  When I use
> > gstreamer 1.16.0 from the download I'm able to compile the app
> without
> > any problems.  When I attempt to use gstreamer compiled using cerbero
> > (1.16.0) I get the following compilation error:
> >
> > Build command failed.
> > Error while executing process /home/cdb/Android/Sdk/ndk-bundle/ndk-
> > build with arguments {NDK_PROJECT_PATH=null
> > APP_BUILD_SCRIPT=/home/cdb/WaveCAST_Receiver/app/jni/Android.mk
> > NDK_APPLICATION_MK=/home/cdb/WaveCAST_Receiver/app/jni/Application.mk
> > APP_ABI=x86_64 NDK_ALL_ABIS=x86_64 NDK_DEBUG=1 APP_PLATFORM=android-
> 23
> >
> NDK_OUT=/home/cdb/WaveCAST_Receiver/app/build/intermediates/ndkBuild/de
> > bug/obj
> >
> NDK_LIBS_OUT=/home/cdb/WaveCAST_Receiver/app/build/intermediates/ndkBui
> > ld/debug/lib NDK_APPLICATION_MK=jni/Application.mk
> > GSTREAMER_JAVA_SRC_DIR=src GSTREAMER_ROOT_ANDROID=/opt/gstreamer-1.0-
> > android-universal-1.16.0-wav GSTREAMER_ASSETS_DIR=src/assets
> >
> /home/cdb/WaveCAST_Receiver/app/build/intermediates/ndkBuild/debug/obj/
> > local/x86_64/libgststart.so}
> > [x86_64] Compile        : gststart <= gststart.c
> > [x86_64] Compile++      : gststart <= dummy.cpp
> > GStreamer      : [GEN] => gst-build-x86_64/gstreamer_android.c
> > GStreamer      : [COMPILE] => gst-build-x86_64/gstreamer_android.c
> > GStreamer      : [LINK] => gst-build-x86_64/libgstreamer_android.so
> >
> > /home/cdb/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-
> > x86_64/sysroot/usr/lib/x86_64-linux-
> > android/23/crtbegin_so.o:crtbegin_so.c:function pthread_atfork:
> error:
> > undefined reference to '__register_atfork'
> > clang++: error: linker command failed with exit code 1 (use -v to see
> > invocation)
> > make: *** [buildsharedlibrary_x86_64] Error 1
> >
> > I'm using android studio 3.3.1.
> >
> > Does anybody have any ideas why this might be happening?
> >
> > Carl
> >
> >
> > _______________________________________________
> > gstreamer-android mailing list
> > gstreamer-android at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-android
>
>
>
> --
> Andrew Esh
> Senior Software Engineer
> Qterics
> 612-564-2580
> www.qterics.com
> <http://www.nielsen.com/>
>
> _______________________________________________
> gstreamer-android mailing list
> gstreamer-android at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-android



-- 
Andrew Esh
Senior Software Engineer
Qterics
612-564-2580
www.qterics.com
<http://www.nielsen.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-android/attachments/20190702/89167375/attachment.html>


More information about the gstreamer-android mailing list