Hi All!

This applies to the Raspberry Pi 2 B.

After a bit of cut and try, I got Anthony Walter's version of Lazarus to run as root (from the Raspbian menu) so I could debug programs which do DigitalRead, DigitalWrite, etc. using h2wiringPi.

Note that this could be dangerous if you are permanently connected to the web while using Lazarus, but in my case, the only time that my Pi will be connected to the web is when I am getting Lazarus set up (and it is not yet running as root). Thereafter I will be connected directly from Pi to Laptop on a private subnet with no router. Once the app is developed the Pi will not be networked at all.

Incidentally, I got the Pi setup so that if it fails DHCP (is not connected to a router) it reverts to the private subnet. If anyone wants to do this, let me know and I'll publish the "magic incantations". ;-) It is much more convenient than editing /etc/network/interfaces every time you need to change from accessing the web to a local private subnet.

The application itself must run as root to do digital I/O. If you don't want to debug using the IDE, you don't have to make the IDE run as root, though, just the app.

Using Anthony's default paths, I created a file in /home/<mydir>/Development/FreePascal/lazarus called lazroot.sh This file contains two lines:

xhost +localhost
sudo /home/<mydir>/Development/FreePascal/lazarus/lazarus.sh

Then chmod +x lazroot.sh

I used the Menu > Preferences > Main Menu Editor to change the command which starts Lazarus to:

/home/<mydir>/Development/FreePascal/lazarus/lazroot.sh

Obviously <mydir> is the directory where lazarus is located.

At first I tried to change the Menu command to the two lines in the lazroot.sh file, but the internals of the menu system did not support multi-command arguments.

For some reason, Lazarus re-built itself (as if I were installing components) the very first time I ran it as root. After that it starts normally.

Hope this helps someone in return for all the help I have been given here.

Don Ziesig



--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to