[SOLVED]How to Import Python library to clickable?
Hello, I'm new to ubuntu touch, and want to learn it as my Student project.
So I installed Clickable and create example project like other newborn programmer do, "Hello World"
Now it run smoothly with command clickable --desktop
I want to improve it step by step. The first step that I want is import another python library into my .py
but it got this
can you tell me the proper way to import python module and include it when build the click file?
I think @TimSueberkrueb is using getlibs.py for that... Maybe this helps you: https://github.com/timsueberkrueb/ubports-gettogether/blob/master/timsueberkrueb/pyotherside/presentation.md
Clickable generate project files like this:
*- clickable.json *- hello_world.desktop.in *- CMakeLists.txt *- hello_world.apparmor *- manifest.json.in assets/ - logo.svg build/ * - #this where you get the .click file po/ - hello_world.gmnx.pot - CMakeLists.txt python-lib/ - #shared object for target platform (.so file). there is python and pyotherside in this folder qml/ - hello_world.py #the python logic is here - Main.qml
it's different structure from the link that you shared
I can't find script folder and get_libs.py
bhdouglass last edited by
If the python library you are wanting to import is not already installed on Ubuntu Touch then you won't be able to easily use it in your app. Something that other people have done is include these dependencies in their apps, you might be able to check out this script for some info: https://github.com/timsueberkrueb/ubuntu-hangups-lib/blob/ce33e2773bb4d3144ef50f4b4291e7d34ff2cad3/get_libs.py
Thanks for your hint @bhdouglass
So, if the library in the repo. we can use the get_libs.py
But, if I need library that using C++ as their backend and bundling it with swig to create Python Library. How do I build this kind of library?
is there any special tools to crosscompiling into Touch? or we can use any tools based on the Architecture ?
@GMNX if its something common, you could also find the compiled python modules packaged in the repository. If not or if you want to do it yourself, you may use any way to cross compile it, theres no unique special way afaik. But the clickable docker containers may be a good starting point as they already have the needed change root and compiler installed. Once you have them, you could use
docker run -v ~/workdir:/root/workdir -it clickable/ubuntu-sdk:16.04-armhf bash
to get a nice cross build environment for xenial for example. (The subdirectory workdir in your home directory would be mounted to /root/workdir inside the container for easy exchange of sources/buildartifacts or whatever...)
With that, compiling classical (configure&make) c/c++ stuff is straight forward. Since I'm not so familiar with pythonic packaging and build process and hadn't time to figure out how it works I simply compiled the python modules I needed on the phone lastly... so thats ugly but indeed also possible and maybe the easiest way.
I'm already finish build the library straight to device.
I connect it with
remount the root folder
sudo mount -o remount,rw /
Downloading the dependency using apt-get
Download the source code
Make and install it
It build flawlessly, but sadly the library not working properly. It crash when I'm running it, and suddenly make the phone reboot itself.
In which log I need to see what's happening before the system crash and rebooted?
this what I got in host computer after the Phone crashed. No error message showing
@gmnx are you sure the right compiler was used? What does
file yourlib.sosay? Ah... You've built it on the device right? Mhmm... now it gets tough... I'm afraid I can't help with that... Try using
stracein front of the actual command it may give you a hint. Or perhaps you see something in dmesg... But theres no python yet(?)... Probably the debugger wont help here... But who knows, you could run it with gdb.
maybe I need to open new thread, about "How to check Crash Log in Ubuntu Touch?"
"Create VoIP application with PJSIP in Ubuntu Touch"
the Strace log didn't show me exactly what make the system reboot. this show me the technique to see what happen before system crashed
since I'm using SSH to my phone, I follow the SSH step
- Log into phone using
- Open another tab. Run
- in tab 2 run
tail -f /var/log/syslogto see system log in realtime
- Reproduce the crash in tab 1
- Watch any error messages in the tab 2
Now I need to move to another thread to discuss it, and close this Thread as Solved
- Log into phone using