Navigation

    UBports Robot Logo

    UBports Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Recommended approach for using openGL or other libraries in UT app?

    App Development
    6
    8
    516
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Valenoern
      Valenoern last edited by

      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.git

      I 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 run make, and either make click-desktop (to test on ubuntu) or make 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.)

      Screenshot of an ubuntu 20.04 desktop with the zensekai demo in one window, and in another window, the output of a program called "clickable" which just built it. In this picture the demo is just a vast green field containing one cube, as the program to add monsters didn't run correctly. The best part of the picture may be the default wallpaper filled with a bright warm orange to violet gradient

      H Valenoern 2 Replies Last reply Reply Quote 0
      • Lakotaubp
        Lakotaubp last edited by

        Just moved to app development. Also you can remove that crossed out line by clicking on the three vertical dots and edit.

        1 Reply Last reply Reply Quote 0
        • H
          hummlbach @Valenoern last edited by hummlbach

          @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.

          1. 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
          2. 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
          1 Reply Last reply Reply Quote 1
          • Elleo
            Elleo last edited by

            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.

            dobey 1 Reply Last reply Reply Quote 0
            • dobey
              dobey @Elleo last edited by

              @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.

              1 Reply Last reply Reply Quote 1
              • Valenoern
                Valenoern @Valenoern last edited by Valenoern

                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 or
                • git 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.

                AppLee 1 Reply Last reply Reply Quote 1
                • AppLee
                  AppLee @Valenoern last edited by

                  @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.

                  1 Reply Last reply Reply Quote 0
                  • H
                    hummlbach last edited by

                    Just saw, someone (Jonny?) wrote an article on how to ship dependencies...
                    http://docs.ubports.com/de/latest/appdev/guides/dependencies.html

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post