ramgalin / gstreamer-android-with-cmake

Connect gstreamer to android app with CMake
GNU General Public License v3.0
4 stars 0 forks source link

missing libs and symbols when building #1

Closed acrilique closed 1 week ago

acrilique commented 1 week ago

Hi, I'm trying to get this working on my machine. I downloaded the latest statically linked gstreamer android libraries from the official website. Opened the repo with Android Studio, I was able to sync with Gradle successfully. However, the compilation step results in a lot of errors coming from ninja (specifically, linker errors):

In the armeabi-v7a and x86 builds however, the linker errors are different to the ones in the x64 builds:

C/C++: ninja: Entering directory `/home/iim/AndroidStudioProjects/gstreamer-android-with-cmake/app/.cxx/Debug/2d6y295y/armeabi-v7a'
C/C++: : && /home/iim/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7-none-linux-androideabi28 --sysroot=/home/iim/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -fPIC -fno-limit-debug-info  -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libgstreamer_android.so -o /home/iim/AndroidStudioProjects/gstreamer-android-with-cmake/app/build/intermediates/cxx/Debug/2d6y295y/obj/armeabi-v7a/libgstreamer_android.so jni/gstreamer_android/CMakeFiles/gstreamer_android.dir/gstreamer_android.c.o -L/home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib   -L/home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0 /home/iim/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/28/liblog.so  /home/iim/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/28/libGLESv3.so  /home/iim/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/28/libEGL.so  /home/iim/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/28/libOpenSLES.so  -lpcre2-8  -liconv  -lffi  -lpng16  -ljpeg  -ltiff  -lglib-2.0  -lgobject-2.0  -lgmodule-2.0  -lgio-2.0  -lgstreamer-1.0  -lgstbase-1.0  -lintl  -lbz2  -lz  -ldv  -lxml2  -lssl  -lcrypto  -lexpat  -lfontconfig  -lharfbuzz  -lfribidi  -lfreetype  -lass  -lpixman-1  -lgdk_pixbuf-2.0  -lcairo  -lstdc++  -lorc-0.4  -lgstvideo-1.0  -lgstallocators-1.0  -lgstadaptivedemux-1.0  -lgsturidownloader-1.0  -lgstgl-1.0  -lgraphene-1.0  -lvpx  -lgstapp-1.0  -lgstaudio-1.0  -lgstnet-1.0  -lgsttag-1.0  -lgstpbutils-1.0  -lgstriff-1.0  -lgstrtp-1.0  -lgstsdp-1.0  -lgstrtsp-1.0  -lgstphotography-1.0  -lgstcontroller-1.0  -lgstcodecparsers-1.0  -lgstplay-1.0  -lavutil  -lswresample  -lavfilter  -lavcodec  -lavformat  -lFLAC  -logg  -lvorbis  -lvorbisenc  -lmp3lame  -lmpg123  -lopenh264  -lopenjp2  -lopus  -lpango-1.0  -lpangocairo-1.0  -lpangoft2-1.0  -lrsvg-2  -lgstsdp-1.0  -lspandsp  -lcroco-0.6  -lsbc  -lspeex  -ltag  -ltheora  -lwavpack  -lzbar  -lgstadaptivedemux2  -lgstadder  -lgstadpcmdec  -lgstadpcmenc  -lgstalaw  -lgstandroidmedia  -lgstapetag  -lgstapp  -lgstassrender  -lgstaudioconvert  -lgstaudiomixer  -lgstaudioparsers  -lgstaudiorate  -lgstaudioresample  -lgstauparse  -lgstautodetect  -lgstavi  -lgstbz2  -lgstcairo  -lgstcodecalpha  -lgstcodectimestamper  -lgstcompositor  -lgstcoreelements  -lgstcoretracers  -lgstdash  -lgstdv  -lgstflac  -lgstflv  -lgstflxdec  -lgstgdp  -lgstgio  -lgsthls  -lgstid3demux  -lgstid3tag  -lgsticydemux  -lgstinterlace  -lgstdeinterlace  -lgstipcpipeline  -lgstisomp4  -lgstjpeg  -lgstjpegformat  -lgstlame  -lgstmatroska  -lgstmidi  -lgstmpg123  -lgstmulaw  -lgstmultipart  -lgstmxf  -lgstogg  -lgstopengl  -lgstopenh264  -lgstopenjpeg  -lgstopensles  -lgstopus  -lgstopusparse  -lgstpcapparse  -lgstplayback  -lgstpng  -lgstpnm  -lgstrawparse  -lgstrfbsrc  -lgstrsvg  -lgstsiren  -lgstspandsp  -lgstsbc  -lgstspeex  -lgstsubenc  -lgstsubparse  -lgsttaglib  -lgsttheora  -lgsttypefindfunctions  -lgstvideoconvertscale  -lgstvideofilter  -lgstvideofiltersbad  -lgstvideoparsersbad  -lgstvideorate  -lgstvolume  -lgstvorbis  -lgstvpx  -lgstwavenc  -lgstwavpack  -lgstwavparse  -lgstxingmux  -lgsty4mdec  -lgsty4menc  -lgstrtsp-1.0  -lgstphotography-1.0  -lgstcontroller-1.0  -lgstcodecparsers-1.0  -lgstplay-1.0  -lavutil  -lswresample  -lavfilter  -lavcodec  -lavformat  -lFLAC  -logg  -lvorbis  -lvorbisenc  -lmp3lame  -lmpg123  -lopenh264  -lopenjp2  -lopus  -lpango-1.0  -lpangocairo-1.0  -lpangoft2-1.0  -lrsvg-2  -lspandsp  -lcroco-0.6  -lsbc  -lspeex  -ltag  -ltheora  -lwavpack  -lzbar  -lgstadaptivedemux2  -lgstadder  -lgstadpcmdec  -lgstadpcmenc  -lgstalaw  -lgstandroidmedia  -lgstapetag  -lgstapp  -lgstassrender  -lgstaudioconvert  -lgstaudiomixer  -lgstaudioparsers  -lgstaudiorate  -lgstaudioresample  -lgstauparse  -lgstautodetect  -lgstavi  -lgstbz2  -lgstcairo  -lgstcodecalpha  -lgstcodectimestamper  -lgstcompositor  -lgstcoreelements  -lgstcoretracers  -lgstdash  -lgstdv  -lgstflac  -lgstflv  -lgstflxdec  -lgstgdp  -lgstgio  -lgsthls  -lgstid3demux  -lgstid3tag  -lgsticydemux  -lgstinterlace  -lgstdeinterlace  -lgstipcpipeline  -lgstisomp4  -lgstjpeg  -lgstjpegformat  -lgstlame  -lgstmatroska  -lgstmidi  -lgstmpg123  -lgstmulaw  -lgstmultipart  -lgstmxf  -lgstogg  -lgstopengl  -lgstopenh264  -lgstopenjpeg  -lgstopensles  -lgstopus  -lgstopusparse  -lgstpcapparse  -lgstplayback  -lgstpng  -lgstpnm  -lgstrawparse  -lgstrfbsrc  -lgstrsvg  -lgstsiren  -lgstspandsp  -lgstsbc  -lgstspeex  -lgstsubenc  -lgstsubparse  -lgsttaglib  -lgsttheora  -lgsttypefindfunctions  -lgstvideoconvertscale  -lgstvideofilter  -lgstvideofiltersbad  -lgstvideoparsersbad  -lgstvideorate  -lgstvolume  -lgstvorbis  -lgstvpx  -lgstwavenc  -lgstwavpack  -lgstwavparse  -lgstxingmux  -lgsty4mdec  -lgsty4menc  -latomic -lm && :
C/C++: ld.lld: error: undefined symbol: ANativeWindow_fromSurface
C/C++: >>> referenced by gstamc-codec-ndk.c:235 (../sys/androidmedia/ndk/gstamc-codec-ndk.c:235)
C/C++: >>>               ndk_gstamc-codec-ndk.c.o:(gst_amc_codec_ndk_configure) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstandroidmedia.a
C/C++: ld.lld: error: undefined symbol: ANativeWindow_release
C/C++: >>> referenced by gstamc-codec-ndk.c:262 (../sys/androidmedia/ndk/gstamc-codec-ndk.c:262)
C/C++: >>>               ndk_gstamc-codec-ndk.c.o:(gst_amc_codec_ndk_configure) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstandroidmedia.a
C/C++: ld.lld: error: undefined symbol: soup_session_get_type
C/C++: >>> referenced by gstsouploader.c:512 (../ext/soup/gstsouploader.c:512)
C/C++: >>>               .._soup_gstsouploader.c.o:(_ad2_soup_session_new_with_options) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: >>> referenced by gstsouploader.c:512 (../ext/soup/gstsouploader.c:512)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_session_get_type+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_logger_new
C/C++: >>> referenced by gstsouploader.c:298 (../ext/soup/gstsouploader.c:298)
C/C++: >>>               .._soup_gstsouploader.c.o:(_ad2_soup_logger_new) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_logger_set_printer
C/C++: >>> referenced by gstsouploader.c:317 (../ext/soup/gstsouploader.c:317)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_logger_set_printer+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_session_add_feature
C/C++: >>> referenced by gstsouploader.c:329 (../ext/soup/gstsouploader.c:329)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_session_add_feature+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_uri_new
C/C++: >>> referenced by gstsouploader.c:342 (../ext/soup/gstsouploader.c:342)
C/C++: >>>               .._soup_gstsouploader.c.o:(ad2_gst_soup_uri_new) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_uri_free
C/C++: >>> referenced by gstsouploader.c:371 (../ext/soup/gstsouploader.c:371)
C/C++: >>>               .._soup_gstsouploader.c.o:(ad2_gst_soup_uri_free) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_uri_to_string
C/C++: >>> referenced by gstsouploader.c:395 (../ext/soup/gstsouploader.c:395)
C/C++: >>>               .._soup_gstsouploader.c.o:(ad2_gst_soup_uri_to_string) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: >>> referenced by gstsouploader.c:416 (../ext/soup/gstsouploader.c:416)
C/C++: >>>               .._soup_gstsouploader.c.o:(ad2_gst_soup_message_uri_to_string) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_message_get_uri
C/C++: >>> referenced by gstsouploader.c:415 (../ext/soup/gstsouploader.c:415)
C/C++: >>>               .._soup_gstsouploader.c.o:(ad2_gst_soup_message_uri_to_string) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_get_major_version
C/C++: >>> referenced by gstsouploader.c:450 (../ext/soup/gstsouploader.c:450)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_get_major_version+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_get_minor_version
C/C++: >>> referenced by gstsouploader.c:461 (../ext/soup/gstsouploader.c:461)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_get_minor_version+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_get_micro_version
C/C++: >>> referenced by gstsouploader.c:472 (../ext/soup/gstsouploader.c:472)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_get_micro_version+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_message_body_append
C/C++: >>> referenced by gstsouploader.c:487 (../ext/soup/gstsouploader.c:487)
C/C++: >>>               .._soup_gstsouploader.c.o:(_ad2_soup_message_set_request_body_from_bytes) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_logger_log_level_get_type
C/C++: >>> referenced by gstsouploader.c:523 (../ext/soup/gstsouploader.c:523)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_logger_log_level_get_type+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_content_decoder_get_type
C/C++: >>> referenced by gstsouploader.c:534 (../ext/soup/gstsouploader.c:534)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_content_decoder_get_type+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_cookie_jar_get_type
C/C++: >>> referenced by gstsouploader.c:545 (../ext/soup/gstsouploader.c:545)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_cookie_jar_get_type+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_session_abort
C/C++: >>> referenced by gstsouploader.c:556 (../ext/soup/gstsouploader.c:556)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_session_abort+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_message_new
C/C++: >>> referenced by gstsouploader.c:567 (../ext/soup/gstsouploader.c:567)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_message_new+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a
C/C++: ld.lld: error: undefined symbol: soup_message_headers_remove
C/C++: >>> referenced by gstsouploader.c:618 (../ext/soup/gstsouploader.c:618)
C/C++: >>>               .._soup_gstsouploader.c.o:(.text._ad2_soup_message_headers_remove+0x0) in archive /home/iim/Android/gstreamer-1.0-android-universal-1.24.9/armv7/lib/gstreamer-1.0/libgstadaptivedemux2.a

As you can see, most of the errors in the 32-bit builds are related to soup. I tried commenting vorbis and kate imports in gstreamer_android.c and gstreamer-libs.cmake but that didn't seem to fix the linker errors in the 64-bit builds at all.
I'm wondering, did you build the GStreamer libs you're using yourself? If so, what configuration did you use (if I may ask)? Thanks in advance for any assistance you can bring.

ramgalin commented 1 week ago

Hi @acrilique

I also used the static libs of gstreamer-1.22.9 from the official website.

What version of gstreamer do you use? Have you set up GSTREAMER_ROOT in app/src/main/cpp/cmake-external-modules/dependencies.cmake?

acrilique commented 1 week ago

Right, that must be the problem. I'm using the latest stable 1.24.9 and that requires a different NDK version too. GSTREAMER_ROOT has been set correctly. I'll try with 1.22 on monday, but anyway it would be nice to get it running with the latest version. Thx 4 the answer

ramgalin commented 1 week ago

Yeah, according to release notes for 1.24 version they removed ivorbisdec and kate.

I've created new branch gstreamer-1.24.x where I've made some changes. Please try it out.

Also try delete app/.cxx folder in the project in Android Studio. Because Android Studio cashes the paths to the dependencies there and may not react to your changes in cmakelists.

acrilique commented 1 week ago

Tried with the gstreamer-1.24.x branch and it builds correctly. I didn't know about the app/.cxx folder, so thanks for the tip, and thanks for taking the time to look into this. I'll now start porting my GStreamer app to android.