Lazarus

Installation => Linux => Topic started by: jma_sp on March 28, 2016, 09:50:49 am

Title: Lazarus and Ubuntu Touch
Post by: jma_sp 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: jma_sp 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on September 22, 2016, 03:17:22 am
x apps on the phone via Xapps scope, that lists apps installed in libertine container
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on September 22, 2016, 03:18:18 am
Launching Lazarus on Meizu MX4 Ubuntu Edition
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on September 22, 2016, 03:19:17 am
main Lazarus IDE window
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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

Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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
Title: Re: Lazarus and Ubuntu Touch
Post by: kris 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.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on September 22, 2016, 04:55:15 pm
but what seems to work is calling virtual keyboard inside Button2.OnClick event: Unix.fpSystem('florence &');
but that requires installing florence on the phone first: apt-get install florence
Title: Re: Lazarus and Ubuntu Touch
Post by: jma_sp on September 22, 2016, 06:21:25 pm
Thanks kris, a lot of things to do.

By the way i have installed fpc but with errors so i have been to run dpkg ..... to correct this.

Now fp load but generated a rte 217 ..

Is to risk because i havent a tablet, with the phone i can not make experiments because is a potential font of problems including updates (actually ubuntu 15.04 (OTA-13).

And as i have not bluetooth keyboard or mouse.....

I will read slowly all your post because there is a lot of steps...

An interesting thing may be some like lazandroid but integrating ubuntu sdk with lazarus/fpc but i do not have enough knowledge for it.

Saludos.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on September 23, 2016, 04:07:15 am
jma_sp: you are right that if you apt-get install things, after OTA update they might be gone, but if you want to be sure, keep your data and software under your home folder. This is also why you want to intall your apps under your home, and keep your .desktop launchers under ~/.local/share/applications instead of /usr/share/applications.

Also, if you create a container, you create it under your home, so it remains and also it does not use up your firmware partition space.
I am committed to finally make a neat documentation this Sunday, so be on the lookout. I will definitely share links here.
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on September 25, 2016, 09:47:42 am
Today I finally got to documenting Free Pascal development for Ubuntu Phone. The first article is about writing console mode applications. Next one will cover GUI development with Lazarus. I am very excited as I also managed to solve the problem with OSK (on-screen keyboard) inside a GTK app running directly on the phone (not via Libertine). Stay tuned.

today's first article available here:
https://kriscode.blogspot.tw/2016/09/freepascal-development-for-ubuntu-phone.html
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on October 04, 2016, 09:58:13 am
my newest blog post on Lazarus development for Ubuntu Phone
(...)
Now the absolute mind-blowing part: what is the default, standard, encouraged and promoted way to make apps for Ubuntu Phone? well, it is the Ubuntu SDK off course. Have you seen it maybe? Perhaps tried? well, I have. And let me tell you this about it:

1. IDE is nowhere as good as Lazarus IDE
2. You can't run it (the IDE) ON your Ubuntu Phone
3. Once you've written an app, you can't also compile it for Windows, MacOS and bunch of other operating systems just like that
4. PERIOD.

So that is why Free Pascal and that is why Lazarus. Write once, compile everywhere. Enjoy!
(...)
http://kriscode.blogspot.tw/2016/10/lazarus-development-for-ubuntu-phone.html

Title: Re: Lazarus and Ubuntu Touch
Post by: xinyiman on April 19, 2018, 08:50:26 am
Hi guys, I read that ubuntu touch is being carried out by the ubports project and since I bought an aquarius b10 fhd to be able to program it with lazarus, I wondered if things were the same two years ago on the lazarus / ubuntu touch front. Do you have any news about it?
Title: Re: Lazarus and Ubuntu Touch
Post by: Thaddy on April 19, 2018, 09:08:11 am
https://www.ubuntu.com/phone/devices
Title: Re: Lazarus and Ubuntu Touch
Post by: xinyiman on April 19, 2018, 09:14:57 am
The Ubuntu Touch project is no longer managed by canonical but is carried out by ubports.

https://ubports.com/
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on April 19, 2018, 09:38:45 am
nie znalazlem nikogo innego oprocz mnie kto by jakos mocniej chcial popychac temat FPC/Lazarus na tej platformie.
Jak chcesz mniej wiedziec co i jak to poczytaj na kriscode.blogspot.com, jestem w trakcie pisania instalatora GUI dla Lazarusa z dedykowanymi komponentami, ktore sie automaycznie skaluja do faktycznego dpi ekranu na UT. Instalator dziala natywnie na kazdym linuksie, intelowskim czy ARM, w tym na UT. Ale poki co recznie mozna odpalac srodowisko na telefonie.
Title: Re: Lazarus and Ubuntu Touch
Post by: xinyiman on April 19, 2018, 09:49:47 am
Hi kris, look at me very interested in lazarus on ubuntu touch. You're not the only one. When do you think your installer will be ready?
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on April 19, 2018, 09:54:29 am
I think only next month, because I am just moving and need to unpack all my workshop into the new house.
Title: Re: Lazarus and Ubuntu Touch
Post by: xinyiman on April 19, 2018, 10:18:57 am
OK perfect. I can wait. Meanwhile, I do other tests with my ubuntu tablet. Do you write it in private or on this thread when it is available? So I'm sure I'm informed. Thanks so much
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on April 19, 2018, 10:45:49 am
no better place to get update on this than on my blog at kriscode.blogspot.com
But you can also subscribe to notifications on my Sourceforge project page for that installer:
https://sourceforge.net/projects/lazfpc4atu/
It is all open source and i will be publishing there.
This project is taking off where a previous one ended, but I think it may actually be usable (the old one), so here you go: https://sourceforge.net/projects/lazarus-for-raspi-and-ut/
Title: Re: Lazarus and Ubuntu Touch
Post by: xinyiman on April 22, 2018, 09:08:12 am
I download from secondo link. Run  with  sudo  but install  dipendency only. Why ?
Title: Re: Lazarus and Ubuntu Touch
Post by: kris on April 22, 2018, 02:58:39 pm
please read the description carefully. You use sudo to install dependencies, and to run you use it without sudo.
Title: Re: Lazarus and Ubuntu Touch
Post by: xinyiman on April 22, 2018, 09:05:20 pm
But with out sudo return error

FATAL ERROR: could not  download file. Exiting.
Title: Re: Lazarus and Ubuntu Touch
Post by: xinyiman on April 25, 2018, 09:24:55 pm
kris I followed your guide (http://kriscode.blogspot.it/2017/11/lazarus-on-arm-ubuntu.html) and I have a problem. Unfortunately when I use the following command

sudo apt-get install libgtk2.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev libx11-dev


tells me that there is not enough free space in /var/cache/apt/archives/
How did you solve it?
TinyPortal © 2005-2018