Recommended approach for using openGL or other libraries in UT app?
-
I've been developing a game called "zensekai" using godot, which I had always intended as a linux mobile game.
I have been trying to get the game to launch on the pinephone, and have already gotten it running (at separate times) on a pinebook pro and as a click package on x86_64 ubuntu:
https://codeberg.org/Valenoern/zensekai-demo/issues/7(That part was actually really hard; the documentation for clickable might need some improving as far as troubleshooting CMake. But anyway, I built a click package that ran.)
I then tried to build the game for arm64, basically using a binary I compiled on the pinebook. To my surprise, the result of running
clickable --ssh (ip address) logs
seemed to be that everything about the package was fine except the moment it tried to render graphics.The error I got was:
zensekai: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory
I'm guessing what this means is my Ubuntu Touch image didn't have openGL installed while the desktop/pinebook did. (And also that there are probably a few other missing libraries clickable will only tell me about after I fix this one.)
Is there any recommended approach for what to do when my app needs shared libraries, like including them in the app or some other method?
If you want to help me debug my specific game, you can get the source here
https://codeberg.org/Valenoern/zensekai-demo / https://codeberg.org/Valenoern/zensekai-demo.gitI will try to put up a compressed folder that contains the specific set of compiled files I'm using, and/or comprehensive instructions on what the results of compiling from the git repo should look like this evening or tomorrow, so this is actually useful to anybody
The very first caveat before you start compiling is you need to get the godot export templates from here (they start with "linux_"): https://codeberg.org/Valenoern/asekai-packages
and make sure the godot editor exports the game using one of them (probably the debug one).
After that you runmake
, and eithermake click-desktop
(to test on ubuntu) ormake click
(to build for arm64)(Again, that's not really all the instructions, so I'll be back later to provide more complete ones.)
The result should look something like this:
(because funny enough, I forgot to account for compiling a helper program as arm64 so compiling right now would have the same bug as in this screenshot.) -
Just moved to app development. Also you can remove that crossed out line by clicking on the three vertical dots and edit.
-
@Valenoern said in Recommended approach for using openGL or other libraries in UT app?:
Is there any recommended approach for what to do when my app needs shared libraries, like including them in the app or some other method?
You need to include the app in the click package. There are basically two possible solutions. Either you build the libs you need or you download binaries and include them into your click package.
-
Build the libs you need:
- Its good practice to have the libs you want to build as a git submodule, like the camera-scanner has opencv as a submodule: https://gitlab.com/jonnius/camera-scanner/-/blob/master/.gitmodules
- Theres a nice feature in clickable for building (third party) libs your app depends on and you want to ship with your app (since they are not included in the root fs). Lets take the camera-scanner as an example again: https://gitlab.com/jonnius/camera-scanner/-/blob/master/clickable.json#L10. See also the corresponding section in clickables docs: https://clickable-ut.dev/en/latest/clickable-json.html#libraries
-
Sometimes building the libs your app depends on is a pain and takes very long, then you may want to use out of the box, ready to eat binaries:
- Theres a script originally authored by @TimSueberkrueb, which downloads the deb package containing the lib you want/need of the architecture you ask it and unpacks it for you etc: https://gitlab.com/hummlbach/ubility/-/blob/master/scripts/get_libs.py
- Again you can use clickables libraries feature to download/install the binaries whenever you need: https://gitlab.com/hummlbach/ubility/-/blob/master/clickable.json#L7
-
-
I don't think any mobile devices tend to support desktop OpenGL (libGL), you'll need to compile against OpenGL ES (libGLES) which is already distributed as part of the Ubuntu Touch image.
-
@Elleo Ironically, even on the x86 system OP is working on, it is using GLES in the screenshot posted.
I think more importantly, godot will need to be using sdl2 or such with mirclient/wayland support enabled, to be able to work on all UT devices currently.
-
I have complete instructions for compiling my demo now...
https://pages.codeberg.org/Valenoern/zensekai/docs/docs.html#CompilingDemo_godot-06-30...but I had no idea I wouldn't be able to edit my post after "3600 seconds", so now I can never edit into the OP the somewhat critical information that you're not supposed to clone that "asekai-packages" repository without
--depth 1
(you'll unnecessarily get 100+ mb of previous releases).edit: to get the files either
git clone --depth 1 https://codeberg.org/Valenoern/asekai-packages.git
orgit clone https://codeberg.org/Valenoern/zensekai-demo.git && wget https://codeberg.org/Valenoern/asekai-packages/raw/branch/master/linux_x11_arm64_debug && wget https://codeberg.org/Valenoern/asekai-packages/raw/branch/master/linux_x11_arm64
(i feel like you can actually leave off the second one because the editor exports a debug version by default, but I'm not sure)
you'll need to compile against OpenGL ES (libGLES)
it is using GLES in the screenshot
Yeah, I found it a bit confusing that although godot should be using "GLES 2" I was getting an error about "libGL.so". As I said, I would have been passing it a binary made on a pinebook pro (arm64 Arch/manjaro) so I guess that was using "libGL"?
@Elleo Do you have any information about how to use the libGLES already in ubuntu touch?
My next step apart from sorting out libraries was going to be to try to compile click packages on arm64 and I wonder if that would make the library part easier. -
@Valenoern said in Recommended approach for using openGL or other libraries in UT app?:
...but I had no idea I wouldn't be able to edit my post after "3600 seconds",
It's just about "experience" in the forum.
Once you've posted and been acknowledged by the antispam you'll be able to edit your posts after this period of time. -
Just saw, someone (Jonny?) wrote an article on how to ship dependencies...
http://docs.ubports.com/de/latest/appdev/guides/dependencies.html