Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-12

Lazarus compile project via ssh?

15 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Anthony Walter

I am wondering, is it possible to configure Lazarus to compile a project on a remote computer running a different platform/architecture through ssh?

I've been doing Lazarus development on Linux on a quad core amd64 desktop PC for a while now and it feels comfortable. But I do have a few arm6/7 Raspberry Pi computers with FPC/Lazarus as well.

While the Pi can run a Gtk2 desktop and Lazarus, it's sluggish and its web browser is just awful (I use it for copy and paste code from specific website).

For the past few days I've been using Lazarus on my Linux desktop PC to write code stored on my Pi. I keep it under /home/pi/Development folder and mount it to my desktop PC at /home/desktopuser/pi with sshfs. Then I compile a program to test my framework for compilation hints/errors using an opened ssh from my desktop PC to the PI.

e.g. Desktop PC terminal ssh'ed into a Pi:
pi at raspberrypi:~/Development/FreePascal/Projects/Bare $ fpc test.pas

And this works OK, but I still have to transcribe output hint/error line numbers back into my desktop lazarus (Ctrl+G goto line).

This leads me to think, shouldn't it be possible to skip the ssh terminal command line compiler, and instead configure Lazarus to use an ssh to compile "fpc test.pas" on the Pi for me? Through shh the build results would go to the Lazarus message window highlighting and lines with errors in the text editor on my desktop PC?

If this is possible to configure I'd appreciate it if anyone could send me a link to a guide. I would be appreciative and much more productive if this were possible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151220/aa8066f9/attachment-0001.html>

Reply by email

Martin Schreiber
to Anthony Walter
Anthony Walter wrote 7 lines
I am wondering, is it possible to configure Lazarus to compile a project on a remote computer running a different platform/architecture through ssh? I've been doing Lazarus development on Linux on a quad core amd64 desktop PC for a while now and it feels comfortable. But I do have a few arm6/7 Raspberry Pi computers with FPC/Lazarus as well.

I successfully use cross-compiling and remote debugging from x86 Linux to Raspberry Pi. MSEide has project templates for that purpose in apps/ide/templates/crossarm*.prj, please see README.TXT. http://mseide-msegui.sourceforge.net/pics/crossarm.png

It is probably possible to setup Lazarus to to the same.

The cross-compiling environment is here:
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/

Martin

Reply by email

Mark Morgan Lloyd
to Martin Schreiber
Martin Schreiber wrote 14 lines
On Sunday 20 December 2015 08:59:35 Anthony Walter wrote: > I am wondering, is it possible to configure Lazarus to compile a project on > a remote computer running a different platform/architecture through ssh? > > I've been doing Lazarus development on Linux on a quad core amd64 desktop > PC for a while now and it feels comfortable. But I do have a few arm6/7 > Raspberry Pi computers with FPC/Lazarus as well. > I successfully use cross-compiling and remote debugging from x86 Linux to Raspberry Pi. MSEide has project templates for that purpose in apps/ide/templates/crossarm*.prj, please see README.TXT. http://mseide-msegui.sourceforge.net/pics/crossarm.png It is probably possible to setup Lazarus to to the same.

Generally works well, provided that the desktop machine's X11 server fully supports the primitives expected by the target machine's widget set.

Working from memory, I think there's a problem with debugging multiple threads over SSH, and for that reason I also like to have VNC available. There's also some versions of Lazarus (which is by no means alone in this defect) that poll the input devices excessively, and again VNC can help out there.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Martin Schreiber
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 20 lines
Martin Schreiber wrote: > On Sunday 20 December 2015 08:59:35 Anthony Walter wrote: >> I am wondering, is it possible to configure Lazarus to compile a project >> on a remote computer running a different platform/architecture through >> ssh? >> >> I've been doing Lazarus development on Linux on a quad core amd64 >> desktop PC for a while now and it feels comfortable. But I do have a few >> arm6/7 Raspberry Pi computers with FPC/Lazarus as well. > > I successfully use cross-compiling and remote debugging from x86 Linux to > Raspberry Pi. MSEide has project templates for that purpose in > apps/ide/templates/crossarm*.prj, please see README.TXT. > http://mseide-msegui.sourceforge.net/pics/crossarm.png > > It is probably possible to setup Lazarus to to the same. Generally works well, provided that the desktop machine's X11 server fully supports the primitives expected by the target machine's widget set.

I use remote debugging by gdbserver running on Raspberry Pi. The target uses the Rpi X11 server, so one needs to see the Rpi screen and reach the target keyboard and mouse in order to debug a graphical application with this setup.

Martin

Reply by email

Mark Morgan Lloyd
to Martin Schreiber
Martin Schreiber wrote 6 lines
> Generally works well, provided that the desktop machine's X11 server > fully supports the primitives expected by the target machine's widget set. > I use remote debugging by gdbserver running on Raspberry Pi. The target uses the Rpi X11 server, so one needs to see the Rpi screen and reach the target keyboard and mouse in order to debug a graphical application with this setup.

As one gets older, not having to reach out to an extra keyboard or swivel to concentrate on an extra screen becomes a blessing. Trust me.

Until recently, one could debug many embedded systems using a serial (RS232) connection: Logitech did good work on this. These days, one can debug many using telnet or SSH. In either of these cases, debugging sessions can appear in a window on ones main screen: I certainly hope that my days of having to do a Rick Wakeman impersonation, with two computers and a Tektronix logic analyser, are past.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mattias Gaertner
to Anthony Walter: I am wondering, is it possible to configure Lazarus to compile a project on a remote…
Show quoted text 6 lines
[...] This leads me to think, shouldn't it be possible to skip the ssh terminal command line compiler, and instead configure Lazarus to use an ssh to compile "fpc test.pas" on the Pi for me? Through shh the build results would go to the Lazarus message window highlighting and lines with errors in the text editor on my desktop PC?

You can use cross compiling as Martin wrote or you can call fpc remotely.

Both machines must use the same paths. For example remote host has a folder /home/user/pascal, containing FPC, Lazarus and your projects. Then mount that directory via sshfs in your local host at the same path /home/user/pascal.
Create a script to call FPC on the remote host. For example:

remotefpc.sh:

#!/bin/bash
ssh user at host cd "$(pwd);" /usr/bin/fpc $@

Test it :
./remotefpc.sh -v
./remotefpc.sh someunit.pas

When this works put "/path/to/remotefpc.sh" in Project / Project Options / Compiler Options / Compiler Commands / Compiler instead of the default "$(CompPath)".

Mattias

Reply by email

Anthony Walter
to Mark Morgan Lloyd: As one gets older, not having to reach out to an extra keyboard or swivel to concentrate…

Thanks everyone for your replies.

Regarding cross compilation, my code contains a sections linking to the broadcom driver and several other files (a whole slew of different vchi modules), which in turns links to many other files. For cross compile to work I would need to find all the required libs and static files (*.a) file upon which they depend to cross compile. And for the static libs link order needs to be preserved (
http://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc) or compilation fails. On the Pi I use a have config program (provided by broadcom) in an ifdef withing my Pi's fpc.cfg. The config program dynamically generates settings for the gnu ld command to produce the correct static lib order.

Rather than trying to solve these types of linking issues (not to mention the generating the correct hard float cross compiler) on my desktop PC, I thought my current workflow was easier a lot easier.

Also, the ssh method for me has the added benefit of allowing me to execute my Pi program from a terminal on my desktop PC, and see the results in that terminal as the Pi brings up a full screen UI on another monitor. See this video taken from another developer ->
https://www.youtube.com/watch?v=GhWs_3_SuW0 .The difference my case is that I've written code to control a fullscreen Pi app through the ssh terminal, while on the Pi the terminal is not visible/accessible. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151220/3b75853f/attachment.html>

Reply by email

Donald Ziesig
to Anthony Walter
Anthony Walter wrote 32 lines
Thanks everyone for your replies. Regarding cross compilation, my code contains a sections linking to the broadcom driver and several other files (a whole slew of different vchi modules), which in turns links to many other files. For cross compile to work I would need to find all the required libs and static files (*.a) file upon which they depend to cross compile. And for the static libs link order needs to be preserved (http://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc) or compilation fails. On the Pi I use a have config program (provided by broadcom) in an ifdef withing my Pi's fpc.cfg. The config program dynamically generates settings for the gnu ld command to produce the correct static lib order. Rather than trying to solve these types of linking issues (not to mention the generating the correct hard float cross compiler) on my desktop PC, I thought my current workflow was easier a lot easier. Also, the ssh method for me has the added benefit of allowing me to execute my Pi program from a terminal on my desktop PC, and see the results in that terminal as the Pi brings up a full screen UI on another monitor. See this video taken from another developer -> https://www.youtube.com/watch?v=GhWs_3_SuW0 .The difference my case is that I've written code to control a fullscreen Pi app through the ssh terminal, while on the Pi the terminal is not visible/accessible. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Hi Anthony,

I gave up on cross compiling, but I have had much success developing on the pi using VNC/SSH. The pi is overclocked to 1000Mhz and the responsiveness is satisfactory when compared with my quad-core laptop. The nice thing is that I only need one keyboard, display and mouse. The only bad thing is that I haven't figured out how to share the clipboard. (VNC says it can sync clipboards but it doesn't work for me.)

My next move will be to store the source code on the laptop and access it from the pi. I did this (storing common source code) between Linux Mint and Windows. It worked except that Lazarus on Linux got confused about the modified status of files saved on Windows and vice versa.

Now, if anyone could give me a script or recipe for setting up FPC 3.0.0 and Lazarus 1.6RC2 on a virgin installation of Raspbian I would be truly thankful (Preferably from source). Everything I tried so far keeps telling me I need to run *fpcmake* because it doesn't know about the target. I think I am missing parameters to the *make* command for either or both. At one point I had FPC 3.0.1 working, but Lazarus kept complaining about needing fpcmake.

Don
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151220/1ea43735/attachment.html>

Reply by email

Bo Berglund
to Donald Ziesig
Donald Ziesig wrote
The nice thing is that I only need one keyboard, display and mouse. The only bad thing is that I haven't figured out how to share the clipboard. (VNC says it can sync clipboards but it doesn't work for me.)

I ran into the problem of shared clipboards on my RPi2 with Raspbian Jessie too. After some investigation it turned out that the culprit was the Lazarus IDE itself!
What happened was that when I coipy text inside Lazarus it does not reach through VNC to the PC. But the other way is OK!

The workaround I found is to open an Non-Lazarus edit window on the Pi and after copying text in Lazarus switch to that edit window and paste it (this will work).
Now go to the place in Windows where the text needs to go and paste it. This also works! It seems like the Lazarus clipboard is incomplete inasmuch as it only targets the internal Pi clipboard but as soon as one pastes inside another editor application on the pi it rectifies itself and the text is now available also in Windows via VNC.

I have reported this here before but got no real solution to it.

If I use any other Raspbian application to copy text it is immediately available via VNC in Windows, it is just the Lazarus code editor that is broken. Even copying properties from the component property editor in Lazarus works fine, just not the thing one REALLY wants to work i.e. the copy from the code editor does not work through VNC.

Bo Berglund Developer in Sweden

Reply by email

Mark Morgan Lloyd
to Bo Berglund
Bo Berglund wrote 10 lines
The workaround I found is to open an Non-Lazarus edit window on the Pi and after copying text in Lazarus switch to that edit window and paste it (this will work). Now go to the place in Windows where the text needs to go and paste it. This also works! It seems like the Lazarus clipboard is incomplete inasmuch as it only targets the internal Pi clipboard but as soon as one pastes inside another editor application on the pi it rectifies itself and the text is now available also in Windows via VNC. I have reported this here before but got no real solution to it.

You didn't mention that particular combination which is... interesting. Does it depend on the widget set being used for Lazarus (incomplete C&P) and the other programs (which work)?

Show quoted text 5 lines
If I use any other Raspbian application to copy text it is immediately available via VNC in Windows, it is just the Lazarus code editor that is broken. Even copying properties from the component property editor in Lazarus works fine, just not the thing one REALLY wants to work i.e. the copy from the code editor does not work through VNC.

As previously discussed, VNC is broken in many areas and it's unclear how much this is fixable since newer versions aren't open source: there's been no significant work done on it for something like ten years. If you want to run Lazarus remotely then tunnel it over SSH.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Anthony Walter
to Donald Ziesig: I gave up on cross compiling, but I have had much success developing on the pi using…

Don,

Regarding a script to setup FPC 3.0.0 and Lazarus on a virgin Pi, you might want to try my Pi installer script at this location:

http://www.getlazarus.org/setup/?download#raspberry_pi

The script doesn't require super user rights, it asks where you want to put FPC 3.0.0 and Lazarus (recent trunk revision) below you home folder (e.g. /home/pi/Development/FreePascal). It will guide you through installing the pre-requisites for FPC and Lazarus on Raspbian (make, gdb, gtk pixbuf) and is reduced in install size speifically for the Pi.

About keeping sharing files on your PC <-> Pi, I use sshfs to share folders between the Pi and my Linux development PC. The share can go either direction, but can be configured it go either way. Maybe this maybe will help ...

On the Pi:

sudo rasp-config

Go to advanced and turn on ssh server.

On your Linux desktop install sshfs.

sudo apt-get install sshfs

Then you can mount the Pi file system

mkdir $HOME/pi
sshfs mount :/home/pi $HOME/pi

Where 192.168.XX.XX is the local IP address of your Pi. You can then access you Pi folder through $HOME/pi on your desktop PC. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160104/5c2fbdbf/attachment.html>

Reply by email

Bo Berglund
to Mark Morgan Lloyd: You didn't mention that particular combination which is... interesting. Does it depend on…
Mark Morgan Lloyd wrote
As previously discussed, VNC is broken in many areas and it's unclear how much this is fixable since newer versions aren't open source: there's been no significant work done on it for something like ten years. If you want to run Lazarus remotely then tunnel it over SSH.

Hi Mark,
yes I have seen several times such suggestions and yet I have no idea how to accomplish such a tunneling....
How could the Lazarus GUI appear in my Windows machine over SSH when Lazarus is running on a Raspberry Pi2? There must be some software running on the Windows box to accomplish that, right?

I have tried to find various solutions such as an X client on Windows (or is it a server?) to display the desktop of RPi, but it seems like these are extremely difficult to install and are also not opensource. In any case after I installed one of the available X thingies on my Win7 PC I was totally unable to understand how to make it connect to the RPi, so I gave up and uninstalled it.

TightVNC OTOH worked right out of the box so that is what I continue to use now, with the limitations.

But then again X is probably not SSH either. The only SSH client I use (but I use it a lot) is PuTTY, through which I do all of my install chores on the Pi devices. But that is not a desktop GUI, only a terminal connection.

My clipboard problems have mainly focused on copying lines of code from Lazarus into my newsreader on Windows so I could ask questions regarding coding. So the need varies with programming activity (now is a low activity time what with the holidays and a trip to Gran Canaria etc).

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Mark Morgan Lloyd: You didn't mention that particular combination which is... interesting. Does it depend on…
Mark Morgan Lloyd wrote 5 lines
> I have reported this here before but got no real solution to it. You didn't mention that particular combination which is... interesting. Does it depend on the widget set being used for Lazarus (incomplete C&P) and the other programs (which work)?

Now I don't follow..
What do you mean by "widget set being used for Lazarus"? I have just installed Lazarus and then used startlazarus to get it running (via an entry in the main menu).
What is a "widget set" and how does one specify it?

Bo Berglund Developer in Sweden

Reply by email

Mark Morgan Lloyd
to Bo Berglund: On Mon, 04 Jan 2016 09:41:37 +0000, Mark Morgan Lloyd yes I have seen several times such…
Bo Berglund wrote 14 lines
On Mon, 04 Jan 2016 09:41:37 +0000, Mark Morgan Lloyd wrote: > As previously discussed, VNC is broken in many areas and it's unclear > how much this is fixable since newer versions aren't open source: > there's been no significant work done on it for something like ten > years. If you want to run Lazarus remotely then tunnel it over SSH. Hi Mark, yes I have seen several times such suggestions and yet I have no idea how to accomplish such a tunneling.... How could the Lazarus GUI appear in my Windows machine over SSH when Lazarus is running on a Raspberry Pi2? There must be some software running on the Windows box to accomplish that, right?

I believe there's a combination of XMing and Putty that will do this

http://www.straightrunning.com/xmingnotes/

However if you simply run XMing it will probably just give you a window representing your entire Raspbian (etc.) desktop, which won't help C&P. Also I don't know whether the Display Manager supplied with Raspbian supports remote sessions, and I'd not suggest fiddling with it.

I have tried to find various solutions such as an X client on Windows (or is it a server?)

Strictly, server since it provides graphical services to the actual program. This is non-intuitive and most people will look uncomfortable if you ask them to justify it :-)

Show quoted text 5 lines
to display the desktop of RPi, but it seems like these are extremely difficult to install and are also not opensource. In any case after I installed one of the available X thingies on my Win7 PC I was totally unable to understand how to make it connect to the RPi, so I gave up and uninstalled it.

Well stop fscking around with Windows and use your Ubuntu machine as the controlling desktop. As I've said, to the extent that my patience is exhausted, the standard OpenSSH supplied with both Debian/Ubuntu and Raspbian allows you to tunnel X, you'll probably need to change one setting on your desktop system (in /etc/ssh/ssh_config):

Host *
# ForwardAgent no
ForwardX11 yes
# ForwardX11Trusted yes

after which the SSH client (i.e. your desktop system) will tell the SSH server (Raspbian) that it's prepared to tunnel X traffic, so if you use a shell over SSH to start lazarus the GUI will appear on your desktop system.

There's advantages and disadvantages to this that I've described more than once, so I'm afraid that I'm not going to do so again.

Now for heavens sake man, if there's something about this that you don't understand then /ask/ rather than just ignoring it.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Bart
to Bo Berglund: On Mon, 04 Jan 2016 09:41:37 +0000, Mark Morgan Lloyd Now I don't follow.. What do you…
Bo Berglund wrote
What do you mean by "widget set being used for Lazarus"?

The WidgetSet draws all the widgets.
This mostly depeds on your platform, not all WidgetSets are supported on all platforms.

azarus supports the following WidgetSets:
Win32, Win64, WinCE, QT, GTK2, GTK3 (experimental), Cocoa, Carbon, fpGUI, Cutomdrawn, noGUI.

If you change nothing Lazarus/LCL uses the default widgetset for your system (e.g. win32 on Windows, GTK2 on Linux).

You can build for a different widgetset using
ProjectOptions->CompilerOptions->Config and target->"Select another LCL widgetset (macro LCLWidgetType)".

Note: you need the libraries for the WS installed on your system, e.g. you can build for GTK2 on Windows, but it requires you to install; GTK for Windows.

Bart

Reply by email