qgroundcontrol icon indicating copy to clipboard operation
qgroundcontrol copied to clipboard

Dockerfile for Building Android

Open ericjohnson97 opened this issue 1 year ago • 6 comments

Fixes https://github.com/mavlink/qgroundcontrol/issues/10995

similar to https://github.com/mavlink/qgroundcontrol/pull/11855

ericjohnson97 avatar Oct 12 '24 18:10 ericjohnson97

this is almost working for me, but no matter what I do I cannot get it to compile with gstreamer properly. My build seems to get all the way to the end and then fails with the following error

ld: error: duplicate symbol: gst_android_get_application_class_loader
>>> defined at AndroidInit.cpp:23 (/project/source/android/src/AndroidInit.cpp:23)
>>>            CMakeFiles/QGroundControl.dir/android/src/AndroidInit.cpp.o:(gst_android_get_application_class_loader)
>>> defined at gstandroid.c:413 (/home/nirbheek/projects/repos/cerbero.git/1.22/build/sources/android_universal/armv7/gstreamer-1.0-1.22.12/_builddir/../gst/gstandroid.c:413)
>>>            gstandroid.c.o:(.text.gst_android_get_application_class_loader+0x1) in archive _deps/gstreamer/install/gstreamer/armv7/lib/libgstreamer-1.0.a

ld: error: duplicate symbol: JNI_OnLoad
>>> defined at AndroidInit.cpp:81 (/project/source/android/src/AndroidInit.cpp:81)
>>>            CMakeFiles/QGroundControl.dir/android/src/AndroidInit.cpp.o:(JNI_OnLoad)
>>> defined at gstandroid.c:559 (/home/nirbheek/projects/repos/cerbero.git/1.22/build/sources/android_universal/armv7/gstreamer-1.0-1.22.12/_builddir/../gst/gstandroid.c:559)
>>>            gstandroid.c.o:(.text.JNI_OnLoad+0x1) in archive _deps/gstreamer/install/gstreamer/armv7/lib/libgstreamer-1.0.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Let me know if anyone has any tips for making sure these functions aren't duplicated

ericjohnson97 avatar Oct 12 '24 18:10 ericjohnson97

Yes this is the most obnoxious error and is the reason I couldn't do several things. As far as I understand, you have to link a library that has a JNI_OnLoad dynamically then use QLibrary to load the shared lib. Although Qt6.8 changes something about how it uses JNI_OnLoad but I don't know if it fixes this or not.

HTRamsey avatar Oct 12 '24 23:10 HTRamsey

@HTRamsey what I don't understand is how the CI pipeline is building fine, but my docker container does not. I really don't understand what could be different.

ericjohnson97 avatar Oct 13 '24 17:10 ericjohnson97

What's the status on this?

HTRamsey avatar Oct 19 '24 07:10 HTRamsey

I still can't get gstreamer to build properly. I still cannot figure out how the CI pipeline is different. Other than gstreamer error above this almost works

ericjohnson97 avatar Oct 19 '24 21:10 ericjohnson97

I will try it out and see what I can do

HTRamsey avatar Oct 20 '24 00:10 HTRamsey

I tried this out and it's very strange I don't know what's happening

HTRamsey avatar Dec 21 '24 01:12 HTRamsey

I'm just going to merge this so I can work on it

HTRamsey avatar Jan 16 '25 17:01 HTRamsey