C++ and SDL with Clickable. A little help please.



  • @zubozrout thanks for sharing, it works nicely. I've compiled sdl2 also in a project that only requires audio, i will post the source link here whenever i will publish it



  • for reference, it helps understand about clickable and dependencies : https://docs.ubports.com/en/latest/appdev/guides/dependencies.html



  • @lduboeuf
    Thank you for your response. I ran "clickable create" and entered this option:
    [7] main-cpp - C++/QML App (built using CMake with a main.cpp)
    My project name is "mytest". I ran "clickable" and my USB connected tablet running Ubuntu Touch shows the app with "Hello World!". Good!

    Next, I changed the main.cpp file so that is has the SDL test C++ code that you see in this posting. Also, I tried to make changes to the clickable.json file so the dependencies can be met, like so:

    {
    "template": "cmake",
    "dir": "build/app",
    "libraries": {
    "SDL2": {
    "template": "cmake"
    }
    },
    "dependencies_target": [
    "libsdl2-dev"
    ]
    }

    I saw clickable downloading the SDL2 files for armhf architecture. Looked good. But I get these error messages:

    [ 90%] Linking CXX executable mytest
    CMakeFiles/mytest.dir/main.cpp.o: In function main': main.cpp:(.text+0xc): undefined reference toSDL_Init'
    main.cpp:(.text+0x2e): undefined reference to `SDL_CreateWindow'
    etc...

    What should I adjust to get this test SDL test program working? Thanks!



  • @Craig have you looked at @zubozrout example for SDL2 ?



  • https://gitlab.com/zub2/SDLDemo

    I managed to build this fine (getting some warnings btw) but the app won't start. I get

    Command 'echo "sleep 1s && ubuntu-app-launch zub.sdldemo_SDLDemo_0.2" | ssh phablet@ubuntu-phablet' returned non-zero exit status 255.
    

    And I can neither grab any log (neither with clickable logs nor with Logviewer) as the log file doesn't exist.



  • @mymike not sure but i had that also, try replacing in apparmor file 1.3 with 16.04





  • @mymike what do you think about turning your demo into a template for clickable? It could be really great way to get more people creating/porting SDL apps.



  • @bhdouglass of course! but I don't know how that app work, neither how to make a clickable template. I'll may have a look at it when I'll find some time, but if someone else wants to do it before me, no problem, just do it!



  • @mymike yes maybe @zubozrout ? who did the hard work with SDL2 template



  • @lduboeuf just for sharing, published a sample app that using only SDL2 audio https://github.com/lduboeuf/sfxr-qt. I've used template from @zubozrout SDL2 and it works fine.
    On my device, sounds are not good quality ( some noises ) , not sure if it is hardware pb or something in-between ( on Desktop it plays fine ).



  • Just FYI, the credit is not mine but goes to my brother - his nick is zub, mine is not :). Unfortunately I lack the deeper knowledge necessary for such things. All I did was that I upgraded it to work with clickable (already on the original repo) and to run on 16.04 (apparently the apparmor framework update is still not there, but whatever).

    Regarding the SDL2 clickable template it doesn't sound as a bad idea though. However I really can't spend the time on it now :(. And the second thing is that SDL is no longer supporting Mir and new stuff may require newer SDL. So the question is whether this is useful. With Unity 8 and Mir upgrades (now on Edge) Wayland-enabled stuff should start working. So it would probably be better to start from scratch and take a look at how to compile SDL apps with Wayland. And I suspect that will be much more documented and a more streamlined experience.

    Sadly Mir didn't turned out the way I was hoping it would ... it is a nicely written code on par with the latest standards as that's how Canonical rolls but that's probably not what the general Linux community wants :(.