Recent

Author Topic: Lazarus and Ubuntu Touch  (Read 16135 times)

jma_sp

  • Full Member
  • ***
  • Posts: 150
  • El conocimiento si ocupa lugar.
Lazarus and Ubuntu Touch
« on: March 28, 2016, 09:50:49 am »
Hello,

Recently I have been handling a device with Ubuntu Touch and me the question arises from if some initiative exists to optimize Lazarus for this environment.

Regards.
Devuan Beowulf 3.0( JWM/ROX/iDesk) - Puppy Linux,  Haiku OS,.ReactOS 0.4.xx  - FreeDos .

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #1 on: September 20, 2016, 05:56:00 am »
Lazarus does not really need to be "optimized" for Ubuntu touch. What would be a great deal is to add qt support to lazarus in exact the version that matches the ubuntu touch QT libraries. I may be wrong on this, but I think Ubuntu Touch uses QT 5 or above.

Now, that said, you can already apt-get install fpc and use it directly inside ubuntu touch, and if you would also like lazarus, you can install it as well inside libertine container. I am currently using Lazarus on my Ubuntu touch inside libertine container. I have previously used it in my custom debootstrap container (https://www.youtube.com/watch?v=j__WaGH4aig), but installing it inside libertine has extra advantage of actually being able to run lazarus on the screen of the phone.

jma_sp

  • Full Member
  • ***
  • Posts: 150
  • El conocimiento si ocupa lugar.
Re: Lazarus and Ubuntu Touch
« Reply #2 on: September 20, 2016, 12:26:57 pm »
Thanks kris,

I havent tried to install Lazarus in my device because is a mobile BQ Aquaris E5 HD Ubuntu Edition now with OS:  Ubuntu 15.04 (OTA12) and the screen is not enough to develop with Lazarus.

The installed QT version is 5 (libqt5core5a).

I have never used libertine, i have to try.

Also i have not installed Lazarus under Ubuntu Touch. I think i have to set volume in R/W previously. I think is not recommended do a apt-get udpate because not complete applications in repo.  Is Lazarus in it?.

Other option is crosscompilation but is difficult to me. I have only compiled for x86 under Win and debian Linux.

Having Linux directly is best than Android for me.

Saludos y gracias por responder.
« Last Edit: September 20, 2016, 12:28:30 pm by jma_sp »
Devuan Beowulf 3.0( JWM/ROX/iDesk) - Puppy Linux,  Haiku OS,.ReactOS 0.4.xx  - FreeDos .

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #3 on: September 21, 2016, 12:27:34 pm »
actually, you do not install (you can't acutally) lazarus directly into your ubuntu touch. You create a chroot container (aka jail) inside it, somewhere under your home folder, so it can use your available disk space. Then you install fpc and lazarus in the chroot environment.
You can run any distro u want inside the container, I use ubuntu 14.04.
If you do want, however, you can directly install fpc inside ubuntu phone, directly:
$ sudo mount -o remount,rw /
$ sudo apt-get update
$ sudo apt-get install fpc
$ sudo mount -o remoutn,ro /

after that you have a working fpc but not lazarus in the phone system.
Now, having lazarus inside container is actually great as long as you also have linux desktop. You simply ssh into your phone, with X forwarding enabled, then while in, you chroot into your container, and then you can run any x applications inside your phone, but onto your desktop monitor. So you run lazarus inside the phone, but it is redirected into your desktop screen, and you use desktop's mouse and keyboard.
When you finish, compile, and ready, you just copy the program from your container into the libertine. Why? Because libertine has a dedicated scope for ubuntu phone, called XApps, and what it does is, it shows all your apps inside libertine on your ohone as icons, and runs them for you, inside your phone screen, even though they are x apps, not qt. It internally uses xmir and some other things, but it works great. Since not a long ago, it even supports onscreen keyboard, so you can type with ubuntu phone's OSK into the x applications.

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #4 on: September 21, 2016, 01:20:40 pm »
attached few screenshots from my Meizu MX4 Ubuntu Edition. As you can see i am running fpc natively.

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #5 on: September 22, 2016, 03:17:22 am »
x apps on the phone via Xapps scope, that lists apps installed in libertine container

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #6 on: September 22, 2016, 03:18:18 am »
Launching Lazarus on Meizu MX4 Ubuntu Edition

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #7 on: September 22, 2016, 03:19:17 am »
main Lazarus IDE window

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #8 on: September 22, 2016, 03:41:04 am »
source editor. Notice that every of lazarus undocked windows becomes fullscreen when launching on the phone via xmir. Would be usable in docked single window IDE mode which i have done for lazarus 1.7 + fpc3.0


kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #9 on: September 22, 2016, 04:02:07 am »
somehow the fpc+lazarus installed within Libertine doesn't work, there are multiple errors. It does run, yet it cannot compile programs.
Interestingly, if I use ssh and chroot into libertine container, I can run fpc from command line. But when I use XApps scopes to launch gnome-terminal, and then run fpc, I get some memory violation error. Could it be that when running apps via XApps scope it goes through something like apparmor? Perhaps, I don't know, just an idea.

So in libertine I have Lazarus that can be started, yet not usable. So what next? Well, that is why, so far, I need another container extra to Libertine. I use debootstrap for my own secondary container, and inside it I use Ubuntu 14.04. In that container I use Lazarus+fpc, and I use it over SSH with X forwarding, so it runs off the phone, but I use it on the screen of my desktop Ubuntu. VERY nice way to work btw. So I make apps in that container, and once ready, I move it into libertine, for the sake of having the app accessible on the phone screen. Otherwise I could only ever use it via SSH with X forwarding. In order to have an icon on the XApps scope, I naturally, have to also create a corresponding .desktop launcher file and place it in any of the standard locations: /usr/share/applications or ~/.local/share/applications, all will do just fine. Also, ensure that : chmod +x myapp.desktop.
Sometimes I need inside the XApps scope to use search and type the name of my app, so it can refresh itself and start showing my newly added app alongside the previously showed ones. That's all.

Finally, this last screen, is Geany text editor, X version, running on the phone, to demonstrate, that a single-window mode lazarus could be perfectly usable on the phone with BT mouse+keyboard. I connected those to my phone via USB dongle, and immediately I have a graphical mouse cursor and can type from my keyboard. It is a high DPI screen in the phone so everything looks small, but if you have good eyes, you get plenty of room and can actually work on it. And with the MX5 Pro, you can always witlessly connect to a big screen TV or monitor, and work like that, imagine, full-blown Lazarus development running purely off the Ubuntu phone, tirelessly streamed to your big screen TV, and controlled with a BT mouse and keyboard, with all the whistles and blows.

Currently though, the Lazarus/fpc are yet to reach compatibility with Libertine container (unless other native xmir layer is ready for Ubuntu phone), and you can still enjoy great workflow wit both your Ubuntu phone and an Ubuntu desktop/laptop for SSH and x forwarding.
Really, GREAT stuff.

I am committed to really finally document all this over the upcoming weekend. Will share the link here.

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #10 on: September 22, 2016, 04:14:29 am »
Btw, using Geany is not out of place, as it supports FPC compiler. So, in other words, if you install fpc inside libertine, and also install geany, then you can use it to write and compile pascal programs. Even compile, run and debug.

On this screen notice, that when editing .pas file in Geany, it recognizes and highlights the syntax, it knows by itself to use fpc compiler, and it provides means to compile, run and debug the program. Unfortunately you will also notice, the segmentation fault of fpc compiler in this use scenario. The reasons are somewhat mysterious to me. All I did, originally, is install fpc from the repos via sudo apt-get install fpc. This even works natively inside Ubuntu phone shell, as I showed in my 1st uploaded screen. It seems to break though, in the libertine container.
It does work in a custom made container again, but XApps scope cannot launch apps from that other container so far. Perhaps this will be available in the future, it would solve lot of hassle as well.

SUMMARY:

1. Currently I am totally satisfied with using fpc directly in phone's shell, however the version is a bit old, and does not provide instantfpc, which would allow me for writing bash scripts in pascal on the phone. I might be able to yet fix the issue to some degree, as I originally could have opened LibreOffice, and now it doesn't start. Perhaps I messed up some packages, will retry on a fresh libertine setup once again.

2. running full-blown Lazarus+FPC over SSH with X forwarding - this stuff is GREAT! Developing Ubuntu Phone's native apps (though x apps instead of native QT5), in a natively ran Lazarus IDE. All good here!

3. To run the created apps on the phone itself, you will depend on libertine and its XApps scope. Otherwise, you can just use them over SSH with X forwarding. Non GUI apps, no problem you can write, compile, and run them on the phone itself, natively, directly in the phone's shell.

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #11 on: September 22, 2016, 05:07:36 am »
I finally got new clue on the FPC not working in libertine.

It turns out, that it does work if you simply chroot into the libertine container, because then you are root.
However, if you launch app via XApps scope, your user will be 'phablet' not 'root'.
Now, simply typing 'su' won't work, somehow. I am not sure what is happening behind the scene, because when I chroot into libertine container, there is no user phablet, so I don't know how libertine creates it at the app launch via the scope. Seems, that when you are root, and you call fpc, it all works great. But when you launch app from the scope on the phone, you are no longer root, but a user named 'phablet' who can't run fpc compiler. Well, it can, but it will cause some segmentation error.

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #12 on: September 22, 2016, 04:46:53 pm »
now i can install lazarus written and compiled app directly in ubuntu phone without need for libertine

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #13 on: September 22, 2016, 04:48:11 pm »
and even though it is an X application i can run it directly on the phone running mir display manager

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Lazarus and Ubuntu Touch
« Reply #14 on: September 22, 2016, 04:49:40 pm »
and here it is, nothing special because just a test, but works and works well. Just no idea for now, howto bring up system onscreen keyboard. I will find a way.

 

TinyPortal © 2005-2018