Lazarus

Installation => Linux => Topic started by: Linkat on August 17, 2019, 04:14:22 pm

Title: Tutorial: Install Lazarus to Raspberry Pi
Post by: Linkat on August 17, 2019, 04:14:22 pm
Hi Raspi user,
because in the past 6 years I had a lot of trouble to install the current stable Lazarus versions with all the differently methods to my raspis, I wrote this tutorial. I'm sure there will be problems in the future too. So please give me information about this problems and how to solve this problems, so I can work on this tutorial.
Hopefully you'll have success with the installation.

The Raspberry Pi computers is a story of success. Unfortunately Lazarus is a language with minor importance on this. A main reason for it is, that the installation of Lazarus is to complex.

For the Intel- and AMD-CPU you have the easy to install deb- and rpm-packages.

So it would be very useful, if we had packages for the arm-CPU in the same way.

By the way: I think it would be nice to have a own section for the Raspberry Pi in this forum.

I hope we'll have a good discussion on it.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Handoko on August 17, 2019, 04:26:54 pm
I've purchased my Raspberry but busy still don't have time to try it. Your tutorial will be very useful to me. Will follow your method when I have time.

Thank your for sharing it.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: trev on August 19, 2019, 04:57:10 am
Do the Wiki instructions no longer work?

See: https://wiki.freepascal.org/Lazarus_on_Raspberry_Pi#Simple_installation_under_Raspbian
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Thaddy on August 19, 2019, 08:50:13 am
Do the Wiki instructions no longer work?

See: https://wiki.freepascal.org/Lazarus_on_Raspberry_Pi#Simple_installation_under_Raspbian

Yes, they still work.  Raspbian Buster has fpc 3.0.4 and lazarus 2.0.0
As simple as sudo apt-get install fpc && sudo apt-get install lazarus.
Note that you will have to check of all paths are set up correctly in /etc/fpc.cfg

I would recommend, though, to install just fpc 3.0.4, then check out lazarus fixes and do make all install. After lazarus is compiled start lazarus, add/remove the packages you want (like OPM and  the two anchordocking) .
Subsequent re-compiles can be done with make clean all useride. Note you need to create a swap file with size 1024MB for this to work.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Thaddy on August 19, 2019, 09:06:36 am
Hi Raspi user,
because in the past 6 years I had a lot of trouble to install the current stable Lazarus versions with all the differently methods to my raspis, I wrote this tutorial. I'm sure there will be problems in the future too. So please give me information about this problems and how to solve this problems, so I can work on this tutorial.
Hopefully you'll have success with the installation.
Thanks for the effort, but it is not necessary, because there are supported .debs in the Rasbian repository that are created and maintained by Debian.
If  you perform these simple steps you can subsequently update your installations by building from source and gives you a good and proper foundation to work with.

The recommended way is different from yours
Simply this is enough and strongly recommended:
Code: Bash  [Select][+][-]
  1. sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install fpc && sudo apt-get install lazarus

For Raspbian buster this installs fpc 3.0.4 and Lazarus 2.0.0 and all its dependencies. and creates menu entries and icons.

Just verify that all the paths are correct in /etc/fpc.cfg
The install base is /usr so /usr/bin/ for the compiler and  /usr/lib/arm-linux-gnueabihf/fpc/3.0.4/ for the libraries.
If you need to adapt paths, use $FPCVERSION instead of 3.0.4.
Normally the paths are correct, but not if you have any previous installed versions or used an install from the freepascal or lazarus website. (these install in /usr/local)

===========================================================================================================================
The next is only necessary if you did not follow the above install previously:
Trouble shooting guidelines before a recommended install:
Steps for messed up and previous installations before installing from apt:
Should you have installations from the fpc/lazarus website first remove those:
Code: Bash  [Select][+][-]
  1. sudo apt-get purge lazarus && sudo apt-get purge fpc && sudo apt-get autoremove
If you did previously build from source, go to the directory root with the fpc directory as child and do
Code: Bash  [Select][+][-]
  1.  sudo rm -rf fpc && sudo rm /etc/fpc.cfg
do the same for lazarus, go to the parent directory of the lazarus directory and
Code: Bash  [Select][+][-]
  1.  sudo rm -rf lazarus
Last step: delete the hidden lazarus directory in /home/<user>:
Code: Bash  [Select][+][-]
  1. cd /home/<username>
  2. sudo rm -rf .lazarus
  3.  
Note the dot: it is a hidden directory (if it exists)

After that you can perform the above recommended  installation from apt without trouble.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Linkat on August 19, 2019, 04:49:42 pm
Yes, with  the lazarus debian-packages you get the Lazarus 2.0.0 version. Not bad, but not good enough. If I work on my desktop with the 2.0.4 version, I would like to work with the current version on my raspi  too.

In the internet (wiki etc.) you can find some descriptions, most of them are pretty old, and you will have some problems. So for me, to have a new  and stable Lazarus version in the /usr directory is the way, I described in the tutorial above. Especially for beginners the installation should be easy.

For the Intel- and AMD- PC, nobody demands such a complicated installation. You have the deb- or rpm- packages for it.

But the best would be, if we had packages for raspian to install Lazarus.

The raspberry pi users would be glad to have an easy way to install Lazarus. I'm sure we'll find a lot of new lazarus-users with it.

Where are the people who can make these packages?
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Thaddy on August 19, 2019, 06:08:11 pm
Yes, with  the lazarus debian-packages you get the Lazarus 2.0.0 version. Not bad, but not good enough. If I work on my desktop with the 2.0.4 version, I would like to work with the current version on my raspi  too.

In the internet (wiki etc.) you can find some descriptions, most of them are pretty old, and you will have some problems. So for me, to have a new  and stable Lazarus version in the /usr directory is the way, I described in the tutorial above. Especially for beginners the installation should be easy.

For the Intel- and AMD- PC, nobody demands such a complicated installation. You have the deb- or rpm- packages for it.

But the best would be, if we had packages for raspian to install Lazarus.

The raspberry pi users would be glad to have an easy way to install Lazarus. I'm sure we'll find a lot of new lazarus-users with it.

Where are the people who can make these packages?
The point of my advice is to have a proper install first!.
After that it is quite easy to build a new lazarus from source..
Most noobs fall over the first hurdle, because they make assumptions that are not warranted, like that the freepascal provided packages are better.
Do not try anything different.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: af0815 on August 19, 2019, 09:56:33 pm
i use the best tool for installing 😊 fpcupdeluxe. so it is meaningless if i use windows, a linux on a pc or raspi. and i can handle more than one install or crosscpmpilers.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Linkat on August 23, 2019, 06:52:42 pm
@af0815 good to here that you are happy with the fpcupdeluxe.
And I think it's a good tool for not standard installation.
For me: this fpcupdeluxe is an overkill for beginners. And for every new lazarus version you need a new fpcupdeluxe version.

My favorite is not a manually  installation (like the tutorial).
I prefer a just-in-time lazarus-stable package for the raspbian OS like you have it for the Intel/AMD CPU. Thats it.

Who is a packager, who can do this?

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Thaddy on August 23, 2019, 07:31:13 pm
i use the best tool for installing 😊 fpcupdeluxe. so it is meaningless if i use windows, a linux on a pc or raspi. and i can handle more than one install or crosscpmpilers.
Unfortunately it does not explain the swap size! nor does it work without a swap size >= 1 GB
That is absolutely required on systems below 2 GB. E.g, everything but a raspberry 4 with at least 2 GB memory.

Currently fpcdeluxe "assumes" you have already done that.
(and I am a bit tired to repeat myself|)
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: DonAlfredo on August 23, 2019, 09:54:32 pm
Will see if I can add a warning about SWAP into fpcupdeluxe.
For certain it will never get tired.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 24, 2019, 08:10:27 am
....
I would recommend, though, to install just fpc 3.0.4, then check out lazarus fixes and do make all install. After lazarus is compiled start lazarus, add/remove the packages you want (like OPM and  the two anchordocking) .
Subsequent re-compiles can be done with make clean all useride. Note you need to create a swap file with size 1024MB for this to work.

I agree. If there is a distro provided fpc 3.0.4, use that (but install it with a tool that resolves dependencies),  then download Lazarus fixes source and build. Its easy and you end up with a flexible system, easy to track new developments in Lazarus.  As long as official Lazarus releases are based on 3.0.4 this is by far the best way to go.

The wiki page https://wiki.freepascal.org/Installing_Lazarus_on_Linux shows it step by step including how to get icons and menu entries.  I don't have a Pi with me but expect that recipe will work there too. The Pi is, after all, a Linux box.

Dependencies ?   "apt install ...", "apt-get install ..." and gdebi  all resolve dependencies. "dpkg -i ..." does not !

Davo

 
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Mi-Ki on August 25, 2019, 10:26:11 am
Hi
I'm a beginner in Lazarus.
I have Raspberry 4 4GB RAM - raspbian-buster
CONF_SWAPSIZE=1024

They don't add packers
lazarus.pp(1,1) Fatal: Cannot find fpdebug used by Lazarus.
How to solve?
Thank you
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Linkat on August 25, 2019, 07:01:09 pm
Hi Mi-Ki,
what was your method to install Lazarus?
Did you use the tutorial in the first post of this thread?

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 26, 2019, 06:38:12 am
Disclaimer, I don't have a pi with me so what I say here is 'linux' generically. Sort of valid.

Quote
Fatal: (10022) Can't find unit system used by fcllaz

The system unit is provided by fpc, you should have an entry in your /etc/fpc.cfg that looks a bit like -
Code: Pascal  [Select][+][-]
  1. # searchpath for units and other system dependent things
  2. -Fu/usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget

(not a lot like it, obviously it won't say /x86_64.. but you get the idea. It should point to a place where there are a lot of fpc units.

fpdebug is provided by the lazarus source, its in [Lazarus source dir]/components/fpdebug

Generally, I don't like the idea of putting source that you intend to compile under /usr/lib.  There is no need, you can build Lazarus as an ordinary user in your home directory. You might want to then do a make install but there is absolutly no need to, cd into the lazarus dir, where the "lazarus" binary is (after a successful build) and run launch from there.

Davo



Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 26, 2019, 11:22:50 am
That error at least makes perfect sense. You cannot create a file under /usr/lib as a normal user. And good thing too !

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Mi-Ki on August 26, 2019, 11:28:41 am
@ dbannon - you're right
sudo  ./startlazarus

works and they're going to add packers.
How to solve it to work without sudo?

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Mi-Ki on August 26, 2019, 11:44:39 am
It works, thank you. :D

I installed according to the instructions.
/ usr / lib / lazarus /
All directories group pi, owner pi
Just / usr / lib / lazarus / units / to root

The first time you run lazarus is this error, but everything works.
How to solve?
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on August 26, 2019, 11:48:57 am
How to solve it to work without sudo?
Don't run install.sh with sudo (as root).

I never liked installing Lazarus and FPC as root.

You might want to just install it to /home/pi/dev/fpc and /home/pi/dev/lazarus

My current script (will install in /home/pi/dev and only needs sudo for some packages)
Works for Linux on Raspberry as well as i686 and x86_64.

Code: Bash  [Select][+][-]
  1. #!/bin/sh
  2. # ======================================================
  3. # by rvk (v.1.2, 2018-02-21)
  4. # ======================================================
  5. echo ""
  6. echo "=============================================================="
  7. echo "Running on: $([ -f /proc/device-tree/model ] && cat /proc/device-tree/model || cat /sys/devices/virtual/dmi/id/product_name)"
  8.  
  9. BASE=$HOME/dev
  10. mkdir -p $BASE
  11. cd $BASE
  12.  
  13. begin=$(date +%s)
  14.  
  15. # ======================================================
  16. # minimal swap space needed is 1024MB
  17. # ======================================================
  18. while true; do
  19.  
  20.   # FREESWAP=$(swapon -s | tail -n 1 | awk '{print $3}')
  21.   FREESWAP=$(free | tail -n1 | awk '{print $2}')
  22.   if [ $FREESWAP -lt 900000 ]; then
  23.  
  24.     # we can increase this if /etc/dphys-swapfile exists
  25.     echo "Swap size is too small. Minimum required is 1024MB.";
  26.     [ -f /etc/dphys-swapfile ] && {
  27.  
  28.       echo "=============================================================="
  29.       free -h
  30.       echo "Setting in /etc/dphys-swapfile $(cat /etc/dphys-swapfile | grep CONF_SWAPSIZE)"
  31.       echo "Current size is $FREESWAP"
  32.       echo "=============================================================="
  33.       while true; do
  34.         read -p "Do you want to increase it to 1024MB? (y/n) " yn
  35.         case $yn in
  36.           [Yy]* ) break;;
  37.           [Nn]* ) echo >&2 "Please increase the swap space manually. Aborting..."; exit 1;;
  38.           * ) echo "Please answer yes or no.";;
  39.         esac
  40.       done
  41.       echo "Increasing value and restarting swap"
  42.       sudo sed -i 's/CONF_SWAPSIZE=[0-9]*$/CONF_SWAPSIZE=1024/g' /etc/dphys-swapfile
  43.       sudo /etc/init.d/dphys-swapfile stop
  44.       sudo /etc/init.d/dphys-swapfile restart
  45.       echo "=============================================================="
  46.  
  47.     } || {
  48.  
  49.       echo >&2 "Please increase the swap space manually. Aborting..."; exit 1;
  50.  
  51.     }
  52.   else
  53.     break;
  54.   fi
  55.  
  56. done
  57.  
  58. # ======================================================
  59. # update packages list to latest version
  60. # ======================================================
  61. echo "=============================================================="
  62. echo ""
  63. echo "Updating package list to latest version (sudo needed)"
  64. echo ""
  65. apt-get --version >/dev/null 2>&1 || { echo >&2 "I require apt-get but it's not installed. Aborting."; exit 1; }
  66. sudo apt-get update >/dev/null || { echo >&2 "apt-get update cannot be run. Aborting."; exit 1; }
  67.  
  68. # ======================================================
  69. # some other essentials
  70. # ======================================================
  71. echo "=============================================================="
  72. echo ""
  73. echo "Installing required packages (sudo used)"
  74. echo ""
  75. sudo apt-get -y install build-essential bzip2 p7zip-full subversion >/dev/null
  76. sudo apt-get -y install libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev lpango-1.0 libpangox-1.0-dev xorg-dev libatk1.0-dev libgtk2.0-dev >/dev/null
  77. sudo apt-get -y install libssl-dev >/dev/null # for all your ssl stuff
  78.  
  79. #sudo apt-get install -y freetds-dev
  80. sudo apt-get -y install pv >/dev/null # pipeviewer for progress http://www.catonmat.net/blog/unix-utilities-pipe-viewer/
  81. svn --version >/dev/null 2>&1 || { echo >&2 "I require svn but it's not installed. Aborting."; exit 1; }
  82.  
  83. # ======================================================
  84. # We need a bootstrap compiler fpc 3.0.4
  85. # There is NONE AVAILABLE so we need to download complete
  86. # fpc-3.0.4.arm-linux-raspberry1wq.tar
  87. # in virtualbox Rasbian stretch we need i386
  88. # ======================================================
  89. CPU=$(uname -m)
  90. if [ "$CPU" = "armv7l" ]; then # note L not 1
  91.   echo "Compiling for ARMv7 Processor (Pi2 and Pi3 only)"
  92.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0 -vh- -dFPC_ARMHF"
  93.   OPTIONS_LAZ="-v0"
  94.   OS_TARGET="linux"
  95.   CPU_TARGET="arm"
  96.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/arm-linux/fpc-3.0.4.arm-linux-eabihf-raspberry.tar"
  97.   COMP=ppcarm
  98. elif [ "$CPU" = "x86_64" ]; then
  99.   echo "Compiling for x64 Processor"
  100.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0"
  101.   OPTIONS_LAZ="-v0"
  102.   OS_TARGET="linux"
  103.   CPU_TARGET="x86_64"
  104.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/x86_64-linux/fpc-3.0.4.x86_64-linux.tar" # complete version
  105.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/bootstrap/x86_64-linux-ppcx64.bz2" # bootstrap
  106.   COMP=ppcx64
  107. elif [ "$CPU" = "i686" ]; then
  108.   echo "Compiling for i686 Processor"
  109.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0"
  110.   OPTIONS_LAZ="-v0"
  111.   OS_TARGET="linux"
  112.   CPU_TARGET="i386"
  113.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/i386-linux/fpc-3.0.4.i386-linux.tar" # complete version
  114.   COMP=ppc386
  115. else
  116.   echo >&2 "$CPU is not supported as processor (needed armv7l/x86_64/i686). Aborting."; exit 1;
  117. fi
  118.  
  119. # ------------------------------------------------------
  120.  
  121. if [ ! -x ./compiler3/$COMP ]; then
  122.   if echo "$COMP3_DOWNLOAD" | grep -q "\.bz2"; then
  123.  
  124.     echo "Downloading bootstrap compiler 3.0.4"
  125.     echo ""
  126.     wget --continue --quiet --show-progress -O compiler3.bz2 $COMP3_DOWNLOAD
  127.     echo ""
  128.     [ -f ./compiler3.bz2 ] || { echo >&2 "Download of bootstrap compiler failed. Aborting."; exit 1; }
  129.     mkdir -p ./compiler3
  130.     bzip2 -d -c compiler3.bz2 > ./compiler3/$COMP
  131.     chmod ug+rx ./compiler3/ppcx64
  132.     rm ./compiler3.bz2
  133.  
  134.   else
  135.  
  136.     echo "Downloading compiler 3.0.4"
  137.     echo ""
  138.     wget --continue --quiet --show-progress -O compiler3.tar $COMP3_DOWNLOAD
  139.     echo ""
  140.     [ -f ./compiler3.tar ] || { echo >&2 "Download of bootstrap compiler failed. Aborting."; exit 1; }
  141.     mkdir -p ./compiler3/ex
  142.     tar xf compiler3.tar -C ./compiler3/ex --strip=1 >/dev/null
  143.     tar xvf ./compiler3/ex/binary.*-linux.tar -C ./compiler3/ex >/dev/null
  144.     tar zxvf ./compiler3/ex/base.*-linux.tar.gz -C ./compiler3/ex >/dev/null
  145.     mv $(find -name $COMP) ./compiler3
  146.     rm ./compiler3/ex -Rf
  147.     rm ./compiler3.tar
  148.  
  149.   fi
  150. fi
  151. [ -x ./compiler3/$COMP ] || { echo >&2 "Bootstrap $BASE/compiler3/$COMP compiler not found. Aborting."; exit 1; }
  152.  
  153. # ======================================================
  154. # downloading fpc and lazarus
  155. # ======================================================
  156. echo "=============================================================="
  157. echo ""
  158. echo "Downloading FPC sources $(svn info fpc 2>&1 | grep Rev:)"
  159. echo ""
  160. # svn co https://svn.freepascal.org/svn/fpc/trunk fpc -r42644 >/dev/null
  161. svn co https://svn.freepascal.org/svn/fpc/trunk fpc >/dev/null
  162. [ -f ./fpc/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  163. echo "Now: $(svn info fpc | grep Rev:)"
  164. echo ""
  165.  
  166. echo "Downloading Lazarus sources $(svn info lazarus 2>&1 | grep Rev:)"
  167. echo ""
  168. # svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus -r61689 >/dev/null
  169. svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus >/dev/null
  170. [ -f ./lazarus/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  171. echo "Now: $(svn info lazarus | grep Rev:)"
  172. echo ""
  173.  
  174. # ======================================================
  175. # compiling fpc
  176. # ======================================================
  177. echo "=============================================================="
  178. echo ""
  179. echo "Now compiling FPC, this will take some time"
  180. echo ""
  181. cd $BASE/fpc
  182. make -s all install OPT="$OPTIONS_FPC" OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET INSTALL_PREFIX=$BASE/fpc PP=$BASE/compiler3/$COMP \
  183.   | pv -l -bp >$BASE/fpc.log \
  184.   || { echo >&2 "Compilation of FPC failed. Aborting."; exit 1; }
  185. cd $BASE
  186. [ -x ./fpc/bin/fpc ] || { echo >&2 "Something went wrong compiling FPC. Aborting."; exit 1; }
  187.  
  188. echo ""
  189. echo "Doing some extra configuration"
  190. [ -f $HOME/.fpc.cfg ] && rm $HOME/.fpc.cfg
  191. ln -sf $BASE/fpc/lib/fpc/3.3.1/$COMP $BASE/fpc/bin/$COMP
  192. ln -sf $BASE/fpc/lib/fpc/3.3.1/samplecfg $BASE/fpc/bin/samplecfg
  193. $BASE/fpc/bin/fpcmkcfg -d basepath=$BASE/fpc -o $HOME/.fpc.cfg
  194.  
  195. # sudo find / -name crtbegin.o
  196. # This library needs to be added to the fpc.cfg file.
  197.  
  198. cat << EOF >> $HOME/.fpc.cfg
  199. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget
  200. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/*
  201. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/rtl
  202. -Fl$(find / -name crtbegin.o -printf '%h\n' 2>/dev/null | head -n 1)
  203. -FD$BASE/fpc/bin
  204. EOF
  205.  
  206.  
  207. echo ""
  208.  
  209. # ======================================================
  210. # compiling lazarus
  211. # ======================================================
  212. echo "=============================================================="
  213. echo ""
  214. echo "Now compiling Lazarus, this will take some time"
  215. echo ""
  216. cd $BASE/lazarus
  217. make -s bigide OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET OPT="$OPTIONS_LAZ" PP="$BASE/fpc/bin/fpc" \
  218.   | pv -l -bp >$BASE/laz.log \
  219.   || { echo >&2 "Compilation of Lazarus failed. Aborting."; exit 1; }
  220. cd $BASE
  221. [ -f ./lazarus/lazarus ] || { echo >&2 "Something went wrong compiling Lazarus. Aborting."; exit 1; }
  222.  
  223. echo ""
  224. echo "Doing some extra configuration"
  225. echo ""
  226.  
  227. # set path withhout old fpc
  228. PATH=$(echo $PATH | sed "s|$BASE/fpc/bin\:||g")
  229.  
  230. # strip previous $BASE from .profile
  231. sed -i '/# FPC PATH/,/fi/d' $HOME/.profile
  232.  
  233. cat << EOF >> $HOME/.profile
  234.  
  235. # FPC PATH
  236. if [ -d $BASE/fpc/bin ] ; then
  237.     PATH="$BASE/fpc/bin:\$PATH"
  238. fi
  239. EOF
  240.  
  241. # replace all double empty lines with one
  242. sed -i '/^$/N;/^\n$/D' $HOME/.profile
  243.  
  244. cat << EOF > $HOME/Desktop/Lazarus.desktop
  245. [Desktop Entry]
  246. Name=Lazarus
  247. Comment=Lazarus
  248. Icon=$BASE/lazarus/images/ide_icon48x48.png
  249. Exec=$BASE/lazarus/startlazarus
  250. Path=$BASE/lazarus
  251. Type=Application
  252. Encoding=UTF-8
  253. Terminal=false
  254. Categories=None;
  255. EOF
  256.  
  257. end=$(date +%s)
  258. echo "=============================================================="
  259. echo ""
  260. echo "$((($end-$begin) / 60)) minutes and $((($end-$begin) % 60)) seconds elapsed."
  261. echo ""
  262. echo "We are done. Please logout and back in before starting Lazarus"
  263. echo "Otherwise you need to supply the fpc location on 1st start"
  264. echo ""
  265. echo "=============================================================="
  266. echo ""
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 26, 2019, 12:51:35 pm
Nice script rvk, you must have done a few pis to put that together !

However, it seems (http://www.raspberryconnect.com/raspbian-packages/29-raspbian-devel) that Buster now includes fpc 304, no need for the bootstrap compiler. So I think the best approach is to use Buster's fpc and then install and build Lazarus in the user's home directory (as you note).

Mi-Ki - this means that if you are happy with your fpc install, then you proceed to install Lazarus in your own, home directory. Maybe that is /home/pi ?

First, use app-get to install a pretty standard app called subversion, it provides the svn command. Then follow the instructions in https://wiki.freepascal.org/Installing_Lazarus_on_Linux#Build_Lazarus_from_Source

You might be well advised to clean out the lazarus install under /usr/ - it really should not be there. And, to be sure, clean it out before doing what I suggested above.

Davo



 
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on August 26, 2019, 01:04:07 pm
However, it seems (http://www.raspberryconnect.com/raspbian-packages/29-raspbian-devel) that Buster now includes fpc 304, no need for the bootstrap compiler. So I think the best approach is to use Buster's fpc and then install and build Lazarus in the user's home directory (as you note).
True. My next step would indeed be to use FPC 3.0.4 from the repositories. I haven't got around to that yet.

But because I also want the trunk version of FPC itself as end-result, I would only want to download FPC 3.0.4 with apt-get download and unpack the compiler and use that. In that case there are no lingering FPC files from an older version.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 26, 2019, 01:26:30 pm
But because I also want the trunk version of FPC itself as end-result, I would only want to download FPC 3.0.4 with apt-get download and unpack the compiler and use that. In that case there are no lingering FPC files from an older version.

Ah, thats why you manually install the dependencies rather than let apt do it. Makes sense !

Lingering Files cause problems, no doubt. Particularly when the OS is updated.

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on August 26, 2019, 01:40:06 pm
But because I also want the trunk version of FPC itself as end-result, I would only want to download FPC 3.0.4 with apt-get download and unpack the compiler and use that. In that case there are no lingering FPC files from an older version.
Ah, thats why you manually install the dependencies rather than let apt do it. Makes sense !
Yeah, I saw (with a dry-run) a whole lot of packages being installed too.

Just doing this gave me an ppcarm compiler (FPC) which should also just work fine as bootstrap compiler without all the other junk (I hope, didnt test yet).

Code: Bash  [Select][+][-]
  1. apt-get download fp-compiler-3.0.4
  2. dpkg-deb --fsys-tarfile fp-compiler*.deb | tar -x ./usr/lib/arm-linux-gnueabihf/fpc/3.0.4/ppcarm --strip-components 6

Edit: Yep, new script works.
Only problem is, it takes a wopping 42 minutes to compile FPC and Lazarus on a RPI3 B with 1GB.
Can't remember it took so long in the past.
(I use the first and last line to copy and paste this into a SSH session and run it from there)

Code: Bash  [Select][+][-]
  1. cat << 'EEOF' > laz
  2. #!/bin/sh
  3. # ======================================================
  4. # by rvk (v.1.3, 2019-08-26)
  5. # ======================================================
  6. echo ""
  7. echo "=============================================================="
  8. echo "Running on: $([ -f /proc/device-tree/model ] && cat /proc/device-tree/model || cat /sys/devices/virtual/dmi/id/product_name)"
  9.  
  10. BASE=$HOME/dev
  11. mkdir -p $BASE
  12. cd $BASE
  13.  
  14. begin=$(date +%s)
  15.  
  16. # ======================================================
  17. # minimal swap space needed is 1024MB
  18. # ======================================================
  19. while true; do
  20.  
  21.   # FREESWAP=$(swapon -s | tail -n 1 | awk '{print $3}')
  22.   FREESWAP=$(free | tail -n1 | awk '{print $2}')
  23.   if [ $FREESWAP -lt 900000 ]; then
  24.  
  25.     # we can increase this if /etc/dphys-swapfile exists
  26.     echo "Swap size is too small. Minimum required is 1024MB.";
  27.     [ -f /etc/dphys-swapfile ] && {
  28.  
  29.       echo "=============================================================="
  30.       free -h
  31.       echo "Setting in /etc/dphys-swapfile $(cat /etc/dphys-swapfile | grep CONF_SWAPSIZE)"
  32.       echo "Current size is $FREESWAP"
  33.       echo "=============================================================="
  34.       while true; do
  35.         read -p "Do you want to increase it to 1024MB? (y/n) " yn
  36.         case $yn in
  37.           [Yy]* ) break;;
  38.           [Nn]* ) echo >&2 "Please increase the swap space manually. Aborting..."; exit 1;;
  39.           * ) echo "Please answer yes or no.";;
  40.         esac
  41.       done
  42.       echo "Increasing value and restarting swap"
  43.       sudo sed -i 's/CONF_SWAPSIZE=[0-9]*$/CONF_SWAPSIZE=1024/g' /etc/dphys-swapfile
  44.       sudo /etc/init.d/dphys-swapfile stop
  45.       sudo /etc/init.d/dphys-swapfile restart
  46.       echo "=============================================================="
  47.  
  48.     } || {
  49.  
  50.       echo >&2 "Please increase the swap space manually. Aborting..."; exit 1;
  51.  
  52.     }
  53.   else
  54.     break;
  55.   fi
  56.  
  57. done
  58.  
  59. # ======================================================
  60. # update packages list to latest version
  61. # ======================================================
  62. echo "=============================================================="
  63. echo ""
  64. echo "Updating package list to latest version (sudo needed)"
  65. echo ""
  66. apt-get --version >/dev/null 2>&1 || { echo >&2 "I require apt-get but it's not installed. Aborting."; exit 1; }
  67. sudo apt-get update >/dev/null || { echo >&2 "apt-get update cannot be run. Aborting."; exit 1; }
  68.  
  69. # ======================================================
  70. # some other essentials
  71. # ======================================================
  72. echo "=============================================================="
  73. echo ""
  74. echo "Installing required packages (sudo used)"
  75. echo ""
  76. sudo apt-get -y install build-essential bzip2 p7zip-full subversion >/dev/null
  77. sudo apt-get -y install libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev lpango-1.0 libpangox-1.0-dev xorg-dev libatk1.0-dev libgtk2.0-dev >/dev/null
  78. sudo apt-get -y install libssl-dev >/dev/null # for all your ssl stuff
  79.  
  80. #sudo apt-get install -y freetds-dev
  81. sudo apt-get -y install pv >/dev/null # pipeviewer for progress http://www.catonmat.net/blog/unix-utilities-pipe-viewer/
  82. svn --version >/dev/null 2>&1 || { echo >&2 "I require svn but it's not installed. Aborting."; exit 1; }
  83.  
  84. # ======================================================
  85. # We need a bootstrap compiler fpc 3.0.4
  86. # There is NONE AVAILABLE so we need to download complete
  87. # fpc-3.0.4.arm-linux-raspberry1wq.tar
  88. # in virtualbox Rasbian stretch we need i386
  89. # ======================================================
  90. CPU=$(uname -m)
  91. if [ "$CPU" = "armv7l" ]; then # note L not 1
  92.   echo "Compiling for ARMv7 Processor (Pi2 and Pi3 only)"
  93.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0 -vh- -dFPC_ARMHF"
  94.   OPTIONS_LAZ="-v0"
  95.   OS_TARGET="linux"
  96.   CPU_TARGET="arm"
  97.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/arm-linux/fpc-3.0.4.arm-linux-eabihf-raspberry.tar"
  98.   COMP3_DOWNLOAD="fp-compiler"
  99.   COMP=ppcarm
  100. elif [ "$CPU" = "x86_64" ]; then
  101.   echo "Compiling for x64 Processor"
  102.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0"
  103.   OPTIONS_LAZ="-v0"
  104.   OS_TARGET="linux"
  105.   CPU_TARGET="x86_64"
  106.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/x86_64-linux/fpc-3.0.4.x86_64-linux.tar" # complete version
  107.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/bootstrap/x86_64-linux-ppcx64.bz2" # bootstrap
  108.   COMP=ppcx64
  109. elif [ "$CPU" = "i686" ]; then
  110.   echo "Compiling for i686 Processor"
  111.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0"
  112.   OPTIONS_LAZ="-v0"
  113.   OS_TARGET="linux"
  114.   CPU_TARGET="i386"
  115.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/i386-linux/fpc-3.0.4.i386-linux.tar" # complete version
  116.   COMP=ppc386
  117. else
  118.   echo >&2 "$CPU is not supported as processor (needed armv7l/x86_64/i686). Aborting."; exit 1;
  119. fi
  120.  
  121. # ------------------------------------------------------
  122.  
  123. if [ ! -x ./compiler3/$COMP ]; then
  124.  
  125.   if echo "$COMP3_DOWNLOAD" | grep -q "fp-compiler"; then
  126.  
  127.     echo "Downloading package fp-compiler-3.0.4"
  128.     echo ""
  129.     mkdir -p ./compiler3
  130.     apt-get download fp-compiler-3.0.4
  131.     dpkg-deb --fsys-tarfile fp-compiler*.deb | tar -x ./usr/lib/arm-linux-gnueabihf/fpc/3.0.4/ppcarm --strip-components 6
  132.     mv ppcarm ./compiler3
  133.     rm ./fp-compiler*.deb
  134.  
  135.   else
  136.  
  137.     if echo "$COMP3_DOWNLOAD" | grep -q "\.bz2"; then
  138.  
  139.       echo "Downloading bootstrap compiler 3.0.4"
  140.       echo ""
  141.       wget --continue --quiet --show-progress -O compiler3.bz2 $COMP3_DOWNLOAD
  142.       echo ""
  143.       [ -f ./compiler3.bz2 ] || { echo >&2 "Download of bootstrap compiler failed. Aborting."; exit 1; }
  144.       mkdir -p ./compiler3
  145.       bzip2 -d -c compiler3.bz2 > ./compiler3/$COMP
  146.       chmod ug+rx ./compiler3/ppcx64
  147.       rm ./compiler3.bz2
  148.  
  149.     else
  150.  
  151.       echo "Downloading compiler 3.0.4"
  152.       echo ""
  153.       wget --continue --quiet --show-progress -O compiler3.tar $COMP3_DOWNLOAD
  154.       echo ""
  155.       [ -f ./compiler3.tar ] || { echo >&2 "Download of bootstrap compiler failed. Aborting."; exit 1; }
  156.       mkdir -p ./compiler3/ex
  157.       tar xf compiler3.tar -C ./compiler3/ex --strip=1 >/dev/null
  158.       tar xvf ./compiler3/ex/binary.*-linux.tar -C ./compiler3/ex >/dev/null
  159.       tar zxvf ./compiler3/ex/base.*-linux.tar.gz -C ./compiler3/ex >/dev/null
  160.       mv $(find -name $COMP) ./compiler3
  161.       rm ./compiler3/ex -Rf
  162.       rm ./compiler3.tar
  163.  
  164.     fi
  165.    
  166.   fi
  167.  
  168. fi
  169. [ -x ./compiler3/$COMP ] || { echo >&2 "Bootstrap $BASE/compiler3/$COMP compiler not found. Aborting."; exit 1; }
  170.  
  171. # ======================================================
  172. # downloading fpc and lazarus
  173. # ======================================================
  174. echo "=============================================================="
  175. echo ""
  176. echo "Downloading FPC sources $(svn info fpc 2>&1 | grep Rev:)"
  177. echo ""
  178. # svn co https://svn.freepascal.org/svn/fpc/trunk fpc -r42644 >/dev/null
  179. svn co https://svn.freepascal.org/svn/fpc/trunk fpc >/dev/null
  180. [ -f ./fpc/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  181. echo "Now: $(svn info fpc | grep Rev:)"
  182. echo ""
  183.  
  184. echo "Downloading Lazarus sources $(svn info lazarus 2>&1 | grep Rev:)"
  185. echo ""
  186. # svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus -r61689 >/dev/null
  187. svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus >/dev/null
  188. [ -f ./lazarus/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  189. echo "Now: $(svn info lazarus | grep Rev:)"
  190. echo ""
  191.  
  192. # ======================================================
  193. # compiling fpc
  194. # ======================================================
  195. echo "=============================================================="
  196. echo ""
  197. echo "Now compiling FPC, this will take some time"
  198. echo ""
  199. cd $BASE/fpc
  200. make -s all install OPT="$OPTIONS_FPC" OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET INSTALL_PREFIX=$BASE/fpc PP=$BASE/compiler3/$COMP \
  201.   | pv -l -bp >$BASE/fpc.log \
  202.   || { echo >&2 "Compilation of FPC failed. Aborting."; exit 1; }
  203. cd $BASE
  204. [ -x ./fpc/bin/fpc ] || { echo >&2 "Something went wrong compiling FPC. Aborting."; exit 1; }
  205.  
  206. echo ""
  207. echo "Doing some extra configuration"
  208. [ -f $HOME/.fpc.cfg ] && rm $HOME/.fpc.cfg
  209. ln -sf $BASE/fpc/lib/fpc/3.3.1/$COMP $BASE/fpc/bin/$COMP
  210. ln -sf $BASE/fpc/lib/fpc/3.3.1/samplecfg $BASE/fpc/bin/samplecfg
  211. $BASE/fpc/bin/fpcmkcfg -d basepath=$BASE/fpc -o $HOME/.fpc.cfg
  212.  
  213. # sudo find / -name crtbegin.o
  214. # This library needs to be added to the fpc.cfg file.
  215.  
  216. cat << EOF >> $HOME/.fpc.cfg
  217. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget
  218. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/*
  219. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/rtl
  220. -Fl$(find / -name crtbegin.o -printf '%h\n' 2>/dev/null | head -n 1)
  221. -FD$BASE/fpc/bin
  222. EOF
  223.  
  224.  
  225. echo ""
  226.  
  227. # ======================================================
  228. # compiling lazarus
  229. # ======================================================
  230. echo "=============================================================="
  231. echo ""
  232. echo "Now compiling Lazarus, this will take some time"
  233. echo ""
  234. cd $BASE/lazarus
  235. make -s bigide OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET OPT="$OPTIONS_LAZ" PP="$BASE/fpc/bin/fpc" \
  236.   | pv -l -bp >$BASE/laz.log \
  237.   || { echo >&2 "Compilation of Lazarus failed. Aborting."; exit 1; }
  238. cd $BASE
  239. [ -f ./lazarus/lazarus ] || { echo >&2 "Something went wrong compiling Lazarus. Aborting."; exit 1; }
  240.  
  241. echo ""
  242. echo "Doing some extra configuration"
  243. echo ""
  244.  
  245. # set path withhout old fpc
  246. PATH=$(echo $PATH | sed "s|$BASE/fpc/bin\:||g")
  247.  
  248. # strip previous $BASE from .profile
  249. sed -i '/# FPC PATH/,/fi/d' $HOME/.profile
  250.  
  251. cat << EOF >> $HOME/.profile
  252.  
  253. # FPC PATH
  254. if [ -d $BASE/fpc/bin ] ; then
  255.     PATH="$BASE/fpc/bin:\$PATH"
  256. fi
  257. EOF
  258.  
  259. # replace all double empty lines with one
  260. sed -i '/^$/N;/^\n$/D' $HOME/.profile
  261.  
  262. cat << EOF > $HOME/Desktop/Lazarus.desktop
  263. [Desktop Entry]
  264. Name=Lazarus
  265. Comment=Lazarus
  266. Icon=$BASE/lazarus/images/ide_icon48x48.png
  267. Exec=$BASE/lazarus/startlazarus
  268. Path=$BASE/lazarus
  269. Type=Application
  270. Encoding=UTF-8
  271. Terminal=false
  272. Categories=None;
  273. EOF
  274.  
  275. end=$(date +%s)
  276. echo "=============================================================="
  277. echo ""
  278. echo "$((($end-$begin) / 60)) minutes and $((($end-$begin) % 60)) seconds elapsed."
  279. echo ""
  280. echo "We are done. Please logout and back in before starting Lazarus"
  281. echo "Otherwise you need to supply the fpc location on 1st start"
  282. echo ""
  283. echo "=============================================================="
  284. echo ""
  285.  
  286. EEOF
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: valdir.marcos on August 26, 2019, 06:49:03 pm
But because I also want the trunk version of FPC itself as end-result, I would only want to download FPC 3.0.4 with apt-get download and unpack the compiler and use that. In that case there are no lingering FPC files from an older version.
Ah, thats why you manually install the dependencies rather than let apt do it. Makes sense !
Yeah, I saw (with a dry-run) a whole lot of packages being installed too.
Just doing this gave me an ppcarm compiler (FPC) which should also just work fine as bootstrap compiler without all the other junk (I hope, didnt test yet).
Very interesting.
When you finish, could you write a wiki or blog article about your discoverings and solution?
Thanks.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Linkat on August 27, 2019, 06:34:12 am
Hi, this thread is an very good example, how a discussion shouldn't work.
With one thank you post, and about 20 posts missing the topic.
But this was exactly the reason writing the tutorial.
You can find a lot of old descriptions or installation scripts, which are no more up-to-date and have all these different problems.

@Mi-Ki, if you did use the tutorial, you could find the sudo before ./install.sh

@rvk, why an installation of Lazarus as root is an absolutely no go? If you have more then one user, an installation in the home space is not very useful. For installing a program you almost do it as root.

Back to topic.

Again the question to the experts:
Why no lazarus-stable-deb package of the current version (like the deb- and rpm-packages for Intel/AMD) exists for the raspbian OS?
It would be very helpful for the beginners. And it would bring a lot of new users.

Linkat
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 27, 2019, 10:46:29 am
Hi, this thread is an very good example, how a discussion shouldn't work.
With one thank you post, and about 20 posts missing the topic.

Yes Linkat, you are probably right in some respects. I would be the last person to discourage anyone from contributing documentation for fpc/lazarus. So, thank you !

@rvk, why an installation of Lazarus as root is an absolutely no go? If you have more then one user, an installation in the home space is not very useful. For installing a program you almost do it as root.
Every time you install a package, you rebuild lazarus. And the 'copy' of lazarus you are talking about is in a read only part of your hard disk. Hmm, how is that possible ? Because, behind the scenes, lazarus realises you are trying to do something a bit odd, it cleverly deflects all your rebuild and puts it in a hidden copy below your home dir. So, from very first rebuild, you are no longer using that copy you have installed in /usr. This is done to help people who install from binaries such as debs or rpms.  Unnecessary complication and a total waste of diskspace if you are building your own however.
 
Further, you will find that as you use lazarus, you are often browsing through the LCL code in particular, maybe you want to add a debug statement, fix a bug or what ever. But you cannot, its read only !

Next, you decide you would like to have a look at a trunk or fixes version, Lazarus is a rapidly evolving product. But doing that is a lot harder if if your main copy of Lazarus is locked into /usr.   

Finally, as a very long term Unix System Admin, take my word for it, nothing should be in the system area that can live in user space.  On a true multiuser system, no developer would want to be sharing, for example, the LCL.

Why no lazarus-stable-deb package of the current version (like the deb- and rpm-packages for Intel/AMD) exists for the raspbian OS?
It would be very helpful for the beginners. And it would bring a lot of new users.

Please see http://www.raspberryconnect.com/raspbian-packages/29-raspbian-devel
There you will that there are (Buster) debs for fpc304 and Lazarus200. So, if you are happy with the limitations of using them, why not just use them ?
However, Lazarus200 is two releases behind the current version and, as I said earlier, you are far, far better off building your own Lazarus (but using the distro version of fpc). Its  impossible for any timed release disro to have all the uptodate versions of all packages. Anyway, thats a question you should take to Debian or Raspian, not here.

But Linkat, please don't be discouraged. That you took the time to write up that tutorial is a good thing, with a bit more experience I am very sure you will be a very valuable contributor to fpc/lazarus. But, we all have to accept that sometimes, we get stuff wrong. Thats better than not trying at all !

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: ttomas on August 27, 2019, 11:03:08 am
To speed up build/compile time try this:
https://forum.lazarus.freepascal.org/index.php/topic,39140.msg267617.html#msg267617 (https://forum.lazarus.freepascal.org/index.php/topic,39140.msg267617.html#msg267617)
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 27, 2019, 11:24:29 am
Neat ttomas, do you use zram to provide swap (zswap like) or use it to make extra ram ?

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: kupferstecher on August 27, 2019, 12:27:04 pm
Why no lazarus-stable-deb package of the current version (like the deb- and rpm-packages for Intel/AMD) exists for the raspbian OS?

Please see http://www.raspberryconnect.com/raspbian-packages/29-raspbian-devel
There you will that there are (Buster) debs for fpc304 and Lazarus200. So, if you are happy with the limitations of using them, why not just use them ?
[...]
Its  impossible for any timed release disro to have all the uptodate versions of all packages. Anyway, thats a question you should take to Debian or Raspian, not here.
It's imho not a question to take to Debian or Raspian, the reason you already mentioned:
"Its  impossible for any timed release disro to have all the uptodate versions of all packages."

I see it the same as Linkat, for a non-experienced user the best way would be up-to-date fpc/Lazarus packages provided from official side, i.e. on lazarus-ide.org. And even for experienced users this could mean a smoother/quicker installation.
By the way, the fpc binaries are available, but not the Lazarus ones: https://freepascal.org/download.html
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 27, 2019, 01:33:02 pm
I see it the same as Linkat, for a non-experienced user the best way would be up-to-date fpc/Lazarus packages provided from official side, i.e. on lazarus-ide.org. And even for experienced users this could mean a smoother/quicker installation.
Hi kupferstecher, we'll have to disagree  there. As I said in above very long winded post, in my opinion by far the best Lazarus install for most users is to build from source in user's home directory. Its not much harder than a binary install and is much more usable. Its only four commands !

By the way, the fpc binaries are available, but not the Lazarus ones: https://freepascal.org/download.html
Thats not a deb install you realise ? Right now we are lucky, Buster has current fpc in its repo and just needs one (su) command to install. Why do anything else ?

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: kupferstecher on August 27, 2019, 03:29:44 pm
Hello Davo

By the way, the fpc binaries are available, but not the Lazarus ones: https://freepascal.org/download.html
Thats not a deb install you realise ?
Yes, I actually checked that before writing the last post.

Quote
Right now we are lucky, Buster has current fpc in its repo and just needs one (su) command to install. Why do anything else ?
The thing is, one normally wants to have the same version on the raspberry as on the desktop. Especially for cross compilation this is important, to prevent trouble opening the project on the raspberry while usually using the desktop. The up-to-dateness of 2.0.0 is ok right now, but there were a long time very old versions.

Quote
Hi kupferstecher, we'll have to disagree  there. As I said in above very long winded post, in my opinion by far the best Lazarus install for most users is to build from source in user's home directory. Its not much harder than a binary install and is much more usable. Its only four commands !
The fact that such tutorials like in this thread even exist, shows that some people struggle with the installation (that includes me). As far as I know there isn't even a official instruction on how to do the installation. I use pfcupdeluxe and it works. But sometimes there are strange errors and it's imho not the right tool for beginners, the install options are too various.

What is the problem in providing packages? Probably the additional efforts, but perhaps someone is willing to support here.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: af0815 on August 27, 2019, 10:40:49 pm
The package way is IMHO not designed for an selfcompiling project like fpc and lazarus. The deb are normaly fire and forget. But Lazarus must be able to make a selfcompiling. And this ist not a optimal way for programs residing in /usr. Under Windows you have nearly the same issue if you have a well configured system with a normal user, but normally you work under a elevated user. This is working like root under Linux. And root have no problems with recompiling 😊
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: ttomas on August 28, 2019, 12:02:47 am
Neat ttomas, do you use zram to provide swap (zswap like) or use it to make extra ram ?

Davo
Yes i use zram for swap. Pi 3 with 1gb ram cant build lazarus. Regular swap on sdcard is slooow. I watch the video of compiling qt5 36min with swap vs 7 min with zram swap and try the same with lazarus. Time difference is same.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on August 28, 2019, 02:22:29 am
The thing is, one normally wants to have the same version on the raspberry as on the desktop.
I wonder if I have not been very clear here ? My recommendation is that you use fpc3.0.4 one way or another. And the Current Lazarus. So, the same on all platforms. Only way to do that is build from source.

Quote
....As far as I know there isn't even a official instruction on how to do the installation.
https://wiki.freepascal.org/Installing_Lazarus_on_Linux
It does not mention RaspberryPi, however it sounds like all thats different is you have to deal with the Pi's lower than typical memory.  I have never installed fpc/Lazarus on a Pi so until I am sure, I'd not add that to the wiki. Be great is someone esle did.  Thats how "official instructions" work here.

Quote
What is the problem in providing packages? Probably the additional efforts, but perhaps someone is willing to support here.
As you say, "someone to do it" - Lazarus and FPC are driven by volunteers. People do things they are fired up about, don't do the things that don't interest them personally. Its open source, you do something, someone else is free to criticize or build on it.
So, why don't you, as a RasPi user build a binary deb ?  Put it on your own website initially and tell the forum. If its well received, maybe someone will ask you to supply such ready made debs 'officially'. Who knows ?

David
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: valdir.marcos on August 28, 2019, 04:36:49 am
Hi, this thread is an very good example, how a discussion shouldn't work.
With one thank you post, and about 20 posts missing the topic.
I have to disagree.
Collaborative work may take many forms. This topic is just an example of them.

Quote
But this was exactly the reason writing the tutorial.
You can find a lot of old descriptions or installation scripts, which are no more up-to-date and have all these different problems.
After the discussion, the tutorial, wiki or blog article would be welcome.

Quote
@Mi-Ki, if you did use the tutorial, you could find the sudo before ./install.sh
@rvk, why an installation of Lazarus as root is an absolutely no go? If you have more then one user, an installation in the home space is not very useful. For installing a program you almost do it as root.
Standard package installation is neither a show stopper nor the only solution for everybody.

Quote
Back to topic.
Again the question to the experts:
Why no lazarus-stable-deb package of the current version (like the deb- and rpm-packages for Intel/AMD) exists for the raspbian OS?
Lack of Debian developers to do the job. It's as simple as that:
The problem here is bigger than you think: man power lacking on many open source projects.
-------------------
Is Debian Dying?
Off the Beat: Bruce Byfield's Blog
Feb 11, 2011 GMT
Bruce Byfield
http://www.linux-magazine.com/Online/Blogs/Off-the-Beat-Bruce-Byfield-s-Blog/Is-Debian-Dying
-------------------

Open source developers are getting old, retiring and dying, and not being replaced as fast as that...
And a last piece of information: of course, Debian won't be dying any time soon.


Quote
It would be very helpful for the beginners. And it would bring a lot of new users.
Now, I think nothing would bring those many new users (programmers). Time has proved that.
Hypothetically, maybe if Delphi would be open sourced, as happened to Interbase 6.0, or abandoned, as happened to OpenOffice or Netbeans, that would bring some new programmers, not that many.
Pascal is neither taught in technical schools nor in universities any more as it was massively done in 1980's and 1990's. That era is gone.
Many new programmers went and still go to web and mobile development.
Delphi lost many programmers to other programming languages (mainly web and mobile) in the last two decades and they hardly ever come back...

[fpc-pascal] tiOPF is looking for a new project maintainer
Graeme Geldenhuys
Thu May 30 13:25:47 CEST 2019
https://lists.freepascal.org/pipermail/fpc-pascal/2019-May/056133.html
http://free-pascal-general.1045716.n5.nabble.com/tiOPF-is-looking-for-a-new-project-maintainer-td5733650.html
https://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg50984.html
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: valdir.marcos on August 28, 2019, 04:58:19 am
The package way is IMHO not designed for an selfcompiling project like fpc and lazarus. The deb are normaly fire and forget.
Correct.
I can't remember any programming languages or IDEs that need to be recompiled similarly to Lazarus when installing new packages of components.

Quote
But Lazarus must be able to make a selfcompiling.
Others IDEs usually have another implementation for plugins and addons that does not require rebuilding the IDE itself.

Quote
And this ist not a optimal way for programs residing in /usr.
According to LFH (Linux Filesystem Hierarchy), the best place for solutions such as Lazarus would be /opt:
https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/c23.html
https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/opt.html

Quote
Under Windows you have nearly the same issue if you have a well configured system with a normal user, but normally you work under a elevated user.
Correct.

Quote
This is working like root under Linux. And root have no problems with recompiling.
Correct.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: valdir.marcos on August 28, 2019, 05:09:37 am
What is the problem in providing packages? Probably the additional efforts, but perhaps someone is willing to support here.
As you say, "someone to do it" - Lazarus and FPC are driven by volunteers. People do things they are fired up about, don't do the things that don't interest them personally. Its open source, you do something, someone else is free to criticize or build on it.
So, why don't you, as a RasPi user build a binary deb ?  Put it on your own website initially and tell the forum. If its well received, maybe someone will ask you to supply such ready made debs 'officially'. Who knows ?
David
+1

@kupferstecher
You should attend Debian Events. They are really amazing.
https://www.debian.org/events/index.en.html
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: kupferstecher on August 28, 2019, 02:47:49 pm
The package way is IMHO not designed for an selfcompiling project like fpc and lazarus. The deb are normaly fire and forget. But Lazarus must be able to make a selfcompiling. And this ist not a optimal way for programs residing in /usr. Under Windows you have nearly the same issue if you have a well configured system with a normal user, but normally you work under a elevated user.
I normally use Lazarus under Windows, using the binaries from lazarus-ide.org and installed with the install wizard in a "non windows" directory. Rebuilds are no problem and no admin rights needed. In the PC-Linux installation (only for testing), I used the debian packages. As far as I remember there were also no issues with package installations/rebuilds. But I don't know what is happening under the hood.

Quote
....As far as I know there isn't even a official instruction on how to do the installation.
https://wiki.freepascal.org/Installing_Lazarus_on_Linux
It does not mention RaspberryPi, however it sounds like all thats different is you have to deal with the Pi's lower than typical memory.  I have never installed fpc/Lazarus on a Pi so until I am sure, I'd not add that to the wiki. Be great is someone esle did.  Thats how "official instructions" work here.
From the wiki:
- Option 1: Package manager -> outdated version
- Option 2: Compiled packages -> not available for ARM-Linux
- Option 3: Compile from source ->  :)

What is the problem in providing packages? Probably the additional efforts, but perhaps someone is willing to support here.
As you say, "someone to do it" - Lazarus and FPC are driven by volunteers. People do things they are fired up about, don't do the things that don't interest them personally. Its open source, you do something, someone else is free to criticize or build on it.
So, why don't you, as a RasPi user build a binary deb ?  Put it on your own website initially and tell the forum. If its well received, maybe someone will ask you to supply such ready made debs 'officially'. Who knows ?
David
+1

It's a good advice. And I'll have a look at it (never bundled a debian package before...).
But in my opinion it's only useful if it (regularly) finds it way to the official page. Perhaps the admins don't want to upload it for any reasons. Than it would be better to know in advance.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Linkat on August 28, 2019, 05:12:09 pm

Quote from: af0815 27.08.19 22:40
Quote
And this ist not a optimal way for programs residing in /usr.
Quote from: valdir.marcos 28.08.19 4:58
Quote
the best place for solutions such as Lazarus would be /opt:

I'm not an expert for installing linux programs.
I had a look in my filesystem of my (desktop pc) linux mint OS and voir là I found the fpc and lazarus folders in /usr/local/ /usr/share/ /usr/lib/ folders. I got this deb-package via lazarus-ide.org --> sourceforge.net. On my desktop PC and on my raspis Lazarus (in /usr) runs pretty good with it.
Please send your comments to the deb-packager.

Again: As you can see  we have a (endless) discussion.


Would be nice, if a team of experts starts to make a Lazarus installation package for the Raspberry Pi


Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: metal mark on October 01, 2019, 09:38:04 pm
Thanks for your tutorial. i ran through it today and managed to get lazarus up and running on my RPi with 'on line package manager' included. I downloaded BGRA controls and when it asked for a rebuild instead of the 'cannot find fpdebug'  (which is a step forward )  it came up with :-
SVN not in path.
Lazarus.pp(167.0) Error.cant create assembler file :/usr/lib/lazarus/units/arm-linux/gtk2/lazarus.s

Any suggestions would be most welcome.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Linkat on October 10, 2019, 08:05:18 am
Hi metal mark,
I've the same problem with the BGRA components. But I've no idea for this problem. Please give a note, if you have a solution for this problem.

Best regards, linkat
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: metal mark on October 14, 2019, 07:27:24 pm
Well my way round it was to load a minimal operating system called DietPi. As I am not fluent with command line stuff I installed LXDE to give me a GUI. I tried installing Fpc and Lazarus but that failed on can't find 'make'. Last ditch time so I installed code typhon and it works really well and way faster than with buster or stretch. It loads as the 32 bit version so I had to install the BGRA controls which wasn't a problem. Takes quit some time but worth it in the end  :D.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Thaddy on October 14, 2019, 08:07:53 pm
Code: Bash  [Select][+][-]
  1. sudo apt-get install lazarus

How would I write a tutorial for that?  :( :o 8) %) :P :-[ :'(

One note: increase the swap file from 100Mb to 1 (or 2) GB , otherwise installing new packages will fail on anything other than a raspberry pi 4 with 2GB+ memory.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: metal mark on October 14, 2019, 09:54:36 pm
If that's an attempt at sarcasm it somewhat fails. I have tried every conceivable combination of hints and tips on my RPi 3b+ to get Lazarus and fpc to work with BRGA controls installed , all sadly failing. I can understand why the people who teach programming to youngsters are abandoning Pascal if they, like me, have to spend hours learning the guts of the system it runs on to get it to work .  Lazarus is in my view a beautyful  GUI IDE  , but at the moment it is shooting itself in the foot by it not working out of the box. By the way making the swapfile 2Gig made no difference what so ever. I was over joyed to get a Pascal environment working on my RPi  with reasonable performance sadly not with Lazarus.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Thaddy on October 14, 2019, 10:15:33 pm
Alas BGRA controls indeed fail. I grant you that. But it is not part of the default distribution and I already (amongst others) complained about that it does not work.
Some cynicism is always allowed on this forum, btw... Otherwise I do a Trexit... O:-)

There are better options, though, since the OpenGL stuff works OK since buster came out.
As it stands BGRA * should be excluded for armhf as incompatible.

Just don't use BGRA *. It is not the Holy Grail but just nice to have....
(If the maintainers of BGRA need a Raspberry Pi I will send them one, for free)
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: ottod on October 31, 2019, 07:06:46 am
I wrote this on the wiki: https://wiki.freepascal.org/Build_current_FPC_and_Lazarus_for_Raspbian (https://wiki.freepascal.org/Build_current_FPC_and_Lazarus_for_Raspbian)
Which tonight resulted on this: https://app.box.com/s/7g54gml6p9bfn10157go430oyputw2au (https://app.box.com/s/7g54gml6p9bfn10157go430oyputw2au)
Lazarus 2.0.6 for Raspbian Buster.
My Box account has only so much bandwidth so tell me if someone can host the files somewhere else.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on November 02, 2019, 05:02:39 am
I wrote this on the wiki: https://wiki.freepascal.org
 (https://wiki.freepascal.org/Build_current_FPC_and_Lazarus_for_Raspbian)

Nice work ottod.

But I am a bit surprised how you went about it. I was under impression that Buster had has fpc 3.0.4 in its repos ?  I have not tried but would see no reason why that could not be used to build lazarus from source, would simplify things. But, as I said, have not tried it !

Nice how you went go on to build debs !

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: ottod on November 04, 2019, 07:04:32 pm
I also use an Ubuntu 64 PC. Even if Ubuntu also has current FPC/Lazarus packages I still prefer the ones provided at https://lazarus-ide.og (https://lazarus-ide.og). Why? Debian packaged Lazarus has many permission related problems while rebuilding the IDE, because Debian recommends a certain directory structure and specific user rights to them. This works with "typical" packages that get their functionality from installing piece by piece. Lazarus gets its features by recompiling the IDE on demand according to user needs. Debian/Ubuntu does not like this because resulting binaries have to be installed to system directories, to which a regular user has not enough rights. All of this does not happen with packages from the Lazarus team. That's why I wanted to build debs from sources like the ones from Lazarus team, but for armhf.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on November 05, 2019, 12:23:44 am
...Even if Ubuntu also has current FPC/Lazarus packages I still prefer the ones provided at https://lazarus-ide.og (https://lazarus-ide.og). Why? Debian packaged Lazarus has many permission related problems while rebuilding the IDE,......

In practice, the rebuilding issues don't apply to FPC/FPC-src. Yours is a very good argument when applied to Lazarus. And there are several more good reasons to keep Lazarus in user space. My recommended approach is to install FPC/FPC-src from debs and download Lazarus source into user space and build it there.

The practicability of editing and recompiling FPC or its scr is questionable in my humble opinion. But absolutely, you really need that level of access with Lazarus. Its important to realise that FPC and Lazarus are different products.  Right now, we are lucky, the various distros almost all have FPC304 in their repos, when we finally see FPC320 released, we will certainly need to use the sourceforge ones for some time.

Davo

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Linkat on November 28, 2019, 02:09:37 pm
Hi ottod,
that's exactly what I wanted. In your  post from 31-10-19, the second link giude you to the 3 debian packages:
fpc-laz_3.0.4_armhf.deb,
fpc-src_3.0.4_armhf.deb,
lazarus-project_2.0.6-0_armhf.deb

I just installed it on my Raspberrry Pi 4 without any modifications (swap etc.). It works fine.
It's a great job!!!!

It would be nice, if these packages could be found at the lazarus-ide.org download page.

Thank you very much again.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: tkramer3 on December 01, 2019, 06:15:26 pm
Hello All,

I compiled the Lazarus debs following the tutorial of Ottod, tested them and they work great, and put them on my site on the following URL

tkramer3.info.tm

Hope this helps anyone, best regards,

Theo

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dpaulc on April 11, 2020, 03:52:15 pm
Hello,

I tried installing the deb packages Ottod created today. fpc-laz and fpx-src installed fine, but lazarus-project failed. It seems two packages it depends on are no longer available.

I got the following errors:

W: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/i/icu/icu-devtools_63.1-6_armhf.deb
  404  Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/i/icu/libicu-dev_63.1-6_armhf.deb
  404  Not Found [IP: 93.93.128.193 80]

I'm guessing it is a version issue, but not expert enough to fix it.

Can anyone help?

Thanks!
Paul
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dpaulc on April 11, 2020, 04:02:12 pm
A bit more info,,,
A dpkg install states:

dpkg: dependency problems prevent configuration of lazarus-project:
 lazarus-project depends on libgtk2.0-dev (>= 2.6.0); however:
  Package libgtk2.0-dev is not installed.

Apparently, libgtk2.0-dev depends on the two packages mentioned previously.

Thanks
Paul
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dpaulc on April 11, 2020, 04:28:57 pm
Resolved!

I'm not sure what exactly solved this issue, but I did the following and lazarus is now installed.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libgtk2.0-dev

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: JuhaManninen on April 11, 2020, 08:12:02 pm
In practice, the rebuilding issues don't apply to FPC/FPC-src. Yours is a very good argument when applied to Lazarus. And there are several more good reasons to keep Lazarus in user space. My recommended approach is to install FPC/FPC-src from debs and download Lazarus source into user space and build it there.
+1
Exactly! I don't know why people confuse these 2 projects so badly.
@ottod, dbannon asked you why FPC 3.0.4 could not be used from the distro's repository. You started to explain Lazarus issues. Why?
The best way to get a recent Lazarus is to build from sources using the FPC provided by your distro. Building and installing FPC from sources is difficult. Building Lazarus from sources is easy. No installation is needed.
Once FPC is there, just do: "svn co ..." (either Lazarus fixes or trunk), then "make". And that's it.
Using external .deb packages is unfortunately a source of continuous problems. This forum has seen hundreds of threads about installing those packages for Ubuntu, Mint and other Debian derivatives.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: ottod on April 18, 2020, 07:22:41 am
Updated Lazarus 2.0.8 for Raspberry Pi.
https://app.box.com/s/7g54gml6p9bfn10157go430oyputw2au (https://app.box.com/s/7g54gml6p9bfn10157go430oyputw2au)
UNOFFICIAL packages built from modified official sources, according to this updated wiki article: https://wiki.freepascal.org/Build_current_FPC_and_Lazarus_for_Raspbian (https://wiki.freepascal.org/Build_current_FPC_and_Lazarus_for_Raspbian)

DO NOT ASK FOR SUPPORT IN THIS FORUM.
Use at your own risk.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: hansotten on April 18, 2020, 12:16:44 pm
Thank you ;)
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: donagin on May 23, 2020, 12:09:05 am
@RVK - Thanks on the script.  It really saved my bacon.

-Don
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Fred vS on May 23, 2020, 02:46:09 am
Alas BGRA controls indeed fail. I grant you that. But it is not part of the default distribution and I already (amongst others) complained about that it does not work.
Some cynicism is always allowed on this forum, btw... Otherwise I do a Trexit... O:-)

There are better options, though, since the OpenGL stuff works OK since buster came out.
As it stands BGRA * should be excluded for armhf as incompatible.

Just don't use BGRA *. It is not the Holy Grail but just nice to have....
(If the maintainers of BGRA need a Raspberry Pi I will send them one, for free)

Huh, BGRABitmap and BGRAControls work perfectly on the RPi.

There is even a Raspbian binary release of LazPaint, done with them:

https://github.com/bgrabitmap/lazpaint/releases
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 13, 2020, 07:33:48 am
Is there an easy way like apt-get install lazarus 2.010 for Stretch?  I just tried the write one compile anywhere concept with an application that runs on both WIN-7 and WIN-10 and I'm running into issues with the Lazarus 1.6.  At the moment I've got too much stuff installed on this Pi3 so I don't really want to start over with a new OS.  Although I guess I might have to.

Granted the reason I have a WIN-10 laptop now is because the latest version of Embarcadero Studio 10.4 no longer will run on WIN-7.  But I've always thought the Linux world wouldn't create those sort of stunts.

So shouldn't an apt-get install Lazarus be able to install the latest version or will it just not run on Stretch? 

Alternatively maybe I should try and install Lazarus 1.6 on Windows, rebuild the project to compile and run on that and then it should work on both the Pi and the Beaglebone.

I kind of need the software to have a life of more than 6 months to a year before it needs to be totally rebuilt because everything changes.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: TRon on July 13, 2020, 08:25:20 am
Is there an easy way like apt-get install lazarus 2.010 for Stretch?
What do you think the answer to that question would be after you've read this: https://endoflife.software/operating-systems/linux/debian

Quote
So shouldn't an apt-get install Lazarus be able to install the latest version or will it just not run on Stretch? 
apt-get isn't obligated to install anything at all.

Latest Lazarus runs just fine on Jessie, Stretch and/or Buster.

That is, not counting the generic errors that comes from such a release (and which apply to each and every platform that is supported by Lazarus)

Quote
I kind of need the software to have a life of more than 6 months to a year before it needs to be totally rebuilt because everything changes.
1. download FreePascal 3.2.0 arm executable archive (https://sourceforge.net/projects/freepascal/files/Linux/3.2.0/fpc-3.2.0.arm-linux.tar/download), extract and install that into your homedir (or any other appropriate directory that you are comfortable with).
2. download and extract FreePascal 3.2.0 source archive (https://sourceforge.net/projects/freepascal/files/Source/3.2.0/fpc-3.2.0.source.tar.gz/download), required for proper working of Lazarus.
3. increase your swap-space
4. download Lazarus 2.0.10 release source archive (https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/Lazarus%202.0.10/lazarus-2.0.10-2.tar.gz/download) and extract that somewhere to a suitable location.
5. navigate to the root of the extracted Lazarus archive
6. type make
7. Drink some coffee/thee/beer/wine/milk and eat a cookie until make is done. Depending on your setup, that might take 15-30 minutes.
8. Make a desktop-link to the startlazarus executable that was just created (make sure to use a custom configuration especially when you have other versions of Lazarus installed).
9. decrease your swap-space a little (latest Lazarus IDE rebuild seems to require around 500 MB swap, I have not tried less but default 200 MB setting did not work for me).
10. Enjoy.

That is the most easy and sane way to install the latest official release without the need to wait for maintainers to update their distribution (if still maintained) and/or the need to mess around with svn.

Alternatively, use fpcup-deluxe (https://wiki.lazarus.freepascal.org/fpcupdeluxe) which is able to do it in less steps/mouseclicks for you.

Don't use .debs from the official Raspbian repositories, unless you are very bored and/or have plenty of time on your hands to be able to cleanup the mess. Use those only if you are a very conservative user that does not require multiple installations, and has no problem at all waiting for years for a new update from the official Raspbian repositories so that they can replace your previous installation.

edit: forgot to mention FreePascal sources.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 13, 2020, 09:34:08 am
Your link for end of life just supports why Microsoft is still the predominant OS.  I'm really not interested in rebuilding a number of different Pi and Beaglebone systems every 2 years. 

I just installed the latest 2.0.10 Lazarus 32 bit onto an old WIN-XP system.  Then the package Lazserial.  Plugged in the CANSUB from Lawicel in Sweden and connected to a CAN bus.  Compiled and ran the same application that also runs on WIN-7 and WIN-10.    It all works.

Dug out the Pi4.  It does have the latest OS and Lazarus 2.0.0 but won't let me install the LazSerial component.  Something about debugging.  So I'm running that script posted by rvk.   It locked a folder and died.  A reboot and unlocking seems to have it now compiling fpc.

Have to wait and see what's up with that. 

I'd really hoped that Lazarus would be that bridge between operating systems.  As long as it's this difficult to set up or upgrade Python will continue to be that clumsy language of choice.   

Which is a pity since Delphi/Lazarus is such a better and easier way to do things.  This is one of my projects from 10 years ago.  Delphi 5 and then Delphi 7 on the PC via USB to two dedicated controllers with CAN bus channels to the 1500 intelligent lights.
http://www.autoartisans.com/rings/Barge1a.jpg

Time for me to go have a Scotch since here it's 12:30AM.  Since you said Thee I'm assuming you are in The Netherlands.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: TRon on July 13, 2020, 09:58:35 am
Your link for end of life just supports why Microsoft is still the predominant OS. 
Strange, as I have exactly the opposite experience. The continues (unstoppable and breaking) updates from latest Microsoft disaster named windows 10 was reason for me to drop the OS completely. It is undo-able to maintain properly unless you are willing to waste too much time on it.

Every day you start the machine, it is a complete surprise at what revision you end up (if it will end up at all as it usually trips over it own updates).

Quote
I'm really not interested in rebuilding a number of different Pi and Beaglebone systems every 2 years. 
That is exactly why I maintain it myself, as I have also no interest in doing so. You had to do that anyways as official repo is lagging behind since the day it was released (very annoying to get confronted with faulty packages and/or packages that are outdated sometimes for over a decade).

If you'd consider maintaining your current installation as  a burden then you should perhaps consider dropping Raspbian and select a rolling distro instead.

Quote
I'd really hoped that Lazarus would be that bridge between operating systems.  As long as it's this difficult to set up or upgrade Python will continue to be that clumsy language of choice.   
I don't really see what is so difficult to setup in comparison to windows (XP!). There you are running an executable in order to install.  For Linux you could replace that with a simple batch script, which then performs the steps as described. potato/patato  :)

Quote
Time for me to go have a Scotch since here it's 12:30AM.  Since you said Thee I'm assuming you are in The Netherlands.
Cheers !!

fwiw I simply dislike coffee ;)
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 13, 2020, 10:22:17 am
It dies here:
cat << EOF >> $HOME/.fpc.cfg
-Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget
-Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/*
-Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/rtl
-Fl$(find / -name crtbegin.o -printf '%h\n' 2>/dev/null | head -n 1)
-FD$BASE/fpc/bin
EOF

After the message :
Line 266: warning: here-document at line 198 delimited by end-of-file (wanted 'EOF')

Never gets around to compiling Lazarus.  But did succeed with fpc.

So much easier and reliable to click on an 'install' button.

But I do agree.  WIN-10 is Microsoft trying to be like Apple.  I still think WIN-7 is where they should have stopped.  Spent their time on making the OS more efficient. Faster. Capable of running on old hardware and not just something with 233 cores. (a joke).
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 13, 2020, 10:27:26 am
Quick question too.  Does this scrip only work with Pi2,P3 since it may have been written before Pi4.  Am I wasting my time trying to update Lazarus on a Pi4 with 1 GB memory


if [ "$CPU" = "armv7l" ]; then # note L not 1
  echo "Compiling for ARMv7 Processor (Pi2 and Pi3 only)"
  OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0 -vh- -dFPC_ARMHF"
  OPTIONS_LAZ="-v0"
  OS_TARGET="linux"
  CPU_TARGET="arm"
  COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/arm-linux/fpc-3.0.4.arm-linux-eabihf-raspberry.tar"
  COMP=ppcarm

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on July 13, 2020, 10:36:55 am
Quick question too.  Does this scrip only work with Pi2,P3 since it may have been written before Pi4.  Am I wasting my time trying to update Lazarus on a Pi4 with 1 GB memory
My script should work on RPI4 too. But I'm not sure what version you have. I've made some changes during the years.

(Running a test now to see if it fails in creating the .fpc.cfg but this is on a slow RPI behind slow VPN so could take a while)

Only thing I can think of with your error is that EOF could be enclosed by quotes. Not doing so might trigger a wildcard substitution and with * that could be a problem.

So you could try to change that to

Code: [Select]
cat << 'EOF' >> $HOME/.fpc.cfgEdit: No, we need the substitution for find there.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: TRon on July 13, 2020, 10:52:45 am
So much easier and reliable to click on an 'install' button.
;D

In case it did not came across, I was suggesting to put my method into a script. fwiw: it is already done, I just did a fresh installation on a pi3.

But, rvk's script should be able to help you out as well.

Quote
But I do agree.  WIN-10 is Microsoft trying to be like Apple.  I still think WIN-7 is where they should have stopped.  Spent their time on making the OS more efficient. Faster. Capable of running on old hardware and not just something with 233 cores. (a joke).
WIN7 was Indeed a nice refreshment and should have been enough. But I am not a marketing genius... seems like the rest of the world is enjoying WIN10 so it must work for them *cough* (hot tea ;) )
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on July 13, 2020, 11:45:14 am
Just ran my script and it runs still fine on a RPI3. It should, without change, also run on a RPI4.

Here is the latest version (took 40 min on a RPI3 on slow VPN).
Code: Text  [Select][+][-]
  1. #!/bin/sh
  2. # ======================================================
  3. # by rvk (v.1.4, 2020-07-13)
  4. # ======================================================
  5. echo ""
  6. echo "=============================================================="
  7. echo "Running on: $([ -f /proc/device-tree/model ] && cat /proc/device-tree/model || cat /sys/devices/virtual/dmi/id/product_name)"
  8.  
  9. BASE=$HOME/dev
  10. mkdir -p $BASE
  11. cd $BASE
  12.  
  13. begin=$(date +%s)
  14.  
  15. # ======================================================
  16. # optional use zram as swapfile
  17. # ======================================================
  18.  
  19. # ======================================================
  20. # minimal swap space needed is 1024MB
  21. # ======================================================
  22. while true; do
  23.  
  24.   # FREESWAP=$(swapon -s | tail -n 1 | awk '{print $3}')
  25.   FREESWAP=$(free | tail -n1 | awk '{print $2}')
  26.   if [ $FREESWAP -lt 900000 ]; then
  27.  
  28.     # we can increase this if /etc/dphys-swapfile exists
  29.     echo "Swap size is too small. Minimum required is 1024MB.";
  30.     [ -f /etc/dphys-swapfile ] && {
  31.  
  32.       echo "=============================================================="
  33.       free -h
  34.       echo "Setting in /etc/dphys-swapfile $(cat /etc/dphys-swapfile | grep CONF_SWAPSIZE)"
  35.       echo "Current size is $FREESWAP"
  36.       echo "=============================================================="
  37.       while true; do
  38.         read -p "Do you want to increase it to 1024MB? (y/n) " yn
  39.         case $yn in
  40.           [Yy]* ) break;;
  41.           [Nn]* ) echo >&2 "Please increase the swap space manually. Aborting..."; exit 1;;
  42.           * ) echo "Please answer yes or no.";;
  43.         esac
  44.       done
  45.       echo "Increasing value and restarting swap"
  46.       sudo sed -i 's/CONF_SWAPSIZE=[0-9]*$/CONF_SWAPSIZE=1024/g' /etc/dphys-swapfile
  47.       sudo /etc/init.d/dphys-swapfile stop
  48.       sudo /etc/init.d/dphys-swapfile restart
  49.       echo "=============================================================="
  50.  
  51.     } || {
  52.  
  53.       echo >&2 "Please increase the swap space manually. Aborting..."; exit 1;
  54.  
  55.     }
  56.   else
  57.     break;
  58.   fi
  59.  
  60. done
  61.  
  62. # ======================================================
  63. # update packages list to latest version
  64. # ======================================================
  65. echo "=============================================================="
  66. echo ""
  67. echo "Updating package list to latest version (sudo needed)"
  68. echo ""
  69. apt-get --version >/dev/null 2>&1 || { echo >&2 "I require apt-get but it's not installed. Aborting."; exit 1; }
  70. sudo apt-get update >/dev/null || { echo >&2 "apt-get update cannot be run. Aborting."; exit 1; }
  71.  
  72. # ======================================================
  73. # some other essentials
  74. # ======================================================
  75. echo "=============================================================="
  76. echo ""
  77. echo "Installing required packages (sudo used)"
  78. echo ""
  79. sudo apt-get -y install build-essential bzip2 p7zip-full subversion >/dev/null
  80. sudo apt-get -y install libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev lpango-1.0 libpangox-1.0-dev xorg-dev libatk1.0-dev libgtk2.0-dev >/dev/null
  81. sudo apt-get -y install libssl-dev >/dev/null # for all your ssl stuff
  82.  
  83. #sudo apt-get install -y freetds-dev
  84. sudo apt-get -y install pv >/dev/null # pipeviewer for progress http://www.catonmat.net/blog/unix-utilities-pipe-viewer/
  85. svn --version >/dev/null 2>&1 || { echo >&2 "I require svn but it's not installed. Aborting."; exit 1; }
  86.  
  87. # ======================================================
  88. # We need a bootstrap compiler fpc 3.0.4
  89. # There is NONE AVAILABLE so we need to download complete
  90. # fpc-3.0.4.arm-linux-raspberry1wq.tar
  91. # in virtualbox Rasbian stretch we need i386
  92. # ======================================================
  93. CPU=$(uname -m)
  94. if [ "$CPU" = "armv7l" ]; then # note L not 1
  95.   echo "Compiling for ARMv7 Processor (Pi2 and Pi3 only)"
  96.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0 -vh- -dFPC_ARMHF"
  97.   OPTIONS_LAZ="-v0"
  98.   OS_TARGET="linux"
  99.   CPU_TARGET="arm"
  100.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/arm-linux/fpc-3.0.4.arm-linux-eabihf-raspberry.tar"
  101.   COMP3_DOWNLOAD="fp-compiler"
  102.   COMP=ppcarm
  103. elif [ "$CPU" = "x86_64" ]; then
  104.   echo "Compiling for x64 Processor"
  105.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0"
  106.   OPTIONS_LAZ="-v0"
  107.   OS_TARGET="linux"
  108.   CPU_TARGET="x86_64"
  109.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/x86_64-linux/fpc-3.0.4.x86_64-linux.tar" # complete version
  110.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/bootstrap/x86_64-linux-ppcx64.bz2" # bootstrap
  111.   COMP=ppcx64
  112. elif [ "$CPU" = "i686" ]; then
  113.   echo "Compiling for i686 Processor"
  114.   OPTIONS_FPC="-g -gl -O2 -Xs -CX -XX -v0"
  115.   OPTIONS_LAZ="-v0"
  116.   OS_TARGET="linux"
  117.   CPU_TARGET="i386"
  118.   COMP3_DOWNLOAD="ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/i386-linux/fpc-3.0.4.i386-linux.tar" # complete version
  119.   COMP=ppc386
  120. else
  121.   echo >&2 "$CPU is not supported as processor (needed armv7l/x86_64/i686). Aborting."; exit 1;
  122. fi
  123.  
  124. # ------------------------------------------------------
  125.  
  126. if [ ! -x ./compiler3/$COMP ]; then
  127.  
  128.   if echo "$COMP3_DOWNLOAD" | grep -q "fp-compiler"; then
  129.  
  130.     echo "Downloading package fp-compiler-3.0.4"
  131.     echo ""
  132.     mkdir -p ./compiler3
  133.     apt-get download fp-compiler-3.0.4
  134.     dpkg-deb --fsys-tarfile fp-compiler*.deb | tar -x ./usr/lib/arm-linux-gnueabihf/fpc/3.0.4/ppcarm --strip-components 6
  135.     mv ppcarm ./compiler3
  136.     rm ./fp-compiler*.deb
  137.  
  138.   else
  139.  
  140.     if echo "$COMP3_DOWNLOAD" | grep -q "\.bz2"; then
  141.  
  142.       echo "Downloading bootstrap compiler 3.0.4"
  143.       echo ""
  144.       wget --continue --quiet --show-progress -O compiler3.bz2 $COMP3_DOWNLOAD
  145.       echo ""
  146.       [ -f ./compiler3.bz2 ] || { echo >&2 "Download of bootstrap compiler failed. Aborting."; exit 1; }
  147.       mkdir -p ./compiler3
  148.       bzip2 -d -c compiler3.bz2 > ./compiler3/$COMP
  149.       chmod ug+rx ./compiler3/ppcx64
  150.       rm ./compiler3.bz2
  151.  
  152.     else
  153.  
  154.       echo "Downloading compiler 3.0.4"
  155.       echo ""
  156.       wget --continue --quiet --show-progress -O compiler3.tar $COMP3_DOWNLOAD
  157.       echo ""
  158.       [ -f ./compiler3.tar ] || { echo >&2 "Download of bootstrap compiler failed. Aborting."; exit 1; }
  159.       mkdir -p ./compiler3/ex
  160.       tar xf compiler3.tar -C ./compiler3/ex --strip=1 >/dev/null
  161.       tar xvf ./compiler3/ex/binary.*-linux.tar -C ./compiler3/ex >/dev/null
  162.       tar zxvf ./compiler3/ex/base.*-linux.tar.gz -C ./compiler3/ex >/dev/null
  163.       mv $(find -name $COMP) ./compiler3
  164.       rm ./compiler3/ex -Rf
  165.       rm ./compiler3.tar
  166.  
  167.     fi
  168.    
  169.   fi
  170.  
  171. fi
  172. [ -x ./compiler3/$COMP ] || { echo >&2 "Bootstrap $BASE/compiler3/$COMP compiler not found. Aborting."; exit 1; }
  173.  
  174. # ======================================================
  175. # downloading fpc and lazarus
  176. # ======================================================
  177. echo "=============================================================="
  178. echo ""
  179. echo "Downloading FPC sources $(svn info fpc 2>&1 | grep Rev:)"
  180. echo ""
  181. # svn co https://svn.freepascal.org/svn/fpc/trunk fpc -r42644 >/dev/null
  182. svn co https://svn.freepascal.org/svn/fpc/trunk fpc >/dev/null
  183. [ -f ./fpc/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  184. echo "Now: $(svn info fpc | grep Rev:)"
  185. echo ""
  186.  
  187. echo "Downloading Lazarus sources $(svn info lazarus 2>&1 | grep Rev:)"
  188. echo ""
  189. # svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus -r61689 >/dev/null
  190. svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus >/dev/null
  191. [ -f ./lazarus/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  192. echo "Now: $(svn info lazarus | grep Rev:)"
  193. echo ""
  194.  
  195. # ======================================================
  196. # compiling fpc
  197. # ======================================================
  198. echo "=============================================================="
  199. echo ""
  200. echo "Now compiling FPC, this will take some time"
  201. echo ""
  202. cd $BASE/fpc
  203. make -s all install OPT="$OPTIONS_FPC" OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET INSTALL_PREFIX=$BASE/fpc PP=$BASE/compiler3/$COMP \
  204.   | pv -l -bp >$BASE/fpc.log \
  205.   || { echo >&2 "Compilation of FPC failed. Aborting."; exit 1; }
  206. cd $BASE
  207. [ -x ./fpc/bin/fpc ] || { echo >&2 "Something went wrong compiling FPC. Aborting."; exit 1; }
  208.  
  209. echo ""
  210. echo "Doing some extra configuration"
  211. [ -f $HOME/.fpc.cfg ] && rm $HOME/.fpc.cfg
  212. ln -sf $BASE/fpc/lib/fpc/3.3.1/$COMP $BASE/fpc/bin/$COMP
  213. ln -sf $BASE/fpc/lib/fpc/3.3.1/samplecfg $BASE/fpc/bin/samplecfg
  214. $BASE/fpc/bin/fpcmkcfg -d basepath=$BASE/fpc -o $HOME/.fpc.cfg
  215.  
  216. # sudo find / -name crtbegin.o
  217. # This library needs to be added to the fpc.cfg file.
  218.  
  219. cat << EOF >> $HOME/.fpc.cfg
  220. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget
  221. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/*
  222. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/rtl
  223. -Fl$(find / -name crtbegin.o -printf '%h\n' 2>/dev/null | head -n 1)
  224. -FD$BASE/fpc/bin
  225. EOF
  226.  
  227.  
  228. echo ""
  229.  
  230. # ======================================================
  231. # compiling lazarus
  232. # ======================================================
  233. echo "=============================================================="
  234. echo ""
  235. echo "Now compiling Lazarus, this will take some time"
  236. echo ""
  237. cd $BASE/lazarus
  238. make -s bigide OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET OPT="$OPTIONS_LAZ" PP="$BASE/fpc/bin/fpc" \
  239.   | pv -l -bp >$BASE/laz.log \
  240.   || { echo >&2 "Compilation of Lazarus failed. Aborting."; exit 1; }
  241. cd $BASE
  242. [ -f ./lazarus/lazarus ] || { echo >&2 "Something went wrong compiling Lazarus. Aborting."; exit 1; }
  243.  
  244. echo ""
  245. echo "Doing some extra configuration"
  246. echo ""
  247.  
  248. # set path withhout old fpc
  249. PATH=$(echo $PATH | sed "s|$BASE/fpc/bin\:||g")
  250.  
  251. # strip previous $BASE from .profile
  252. sed -i '/# FPC PATH/,/fi/d' $HOME/.profile
  253.  
  254. cat << EOF >> $HOME/.profile
  255.  
  256. # FPC PATH
  257. if [ -d $BASE/fpc/bin ] ; then
  258.     PATH="$BASE/fpc/bin:\$PATH"
  259. fi
  260. EOF
  261.  
  262. # replace all double empty lines with one
  263. sed -i '/^$/N;/^\n$/D' $HOME/.profile
  264.  
  265. cat << EOF > $HOME/Desktop/Lazarus.desktop
  266. [Desktop Entry]
  267. Name=Lazarus
  268. Comment=Lazarus
  269. Icon=$BASE/lazarus/images/ide_icon48x48.png
  270. Exec=$BASE/lazarus/startlazarus
  271. Path=$BASE/lazarus
  272. Type=Application
  273. Encoding=UTF-8
  274. Terminal=false
  275. Categories=None;
  276. EOF
  277.  
  278. end=$(date +%s)
  279. echo "=============================================================="
  280. echo ""
  281. echo "$((($end-$begin) / 60)) minutes and $((($end-$begin) % 60)) seconds elapsed."
  282. echo ""
  283. echo "We are done. Please logout and back in before starting Lazarus"
  284. echo "Otherwise you need to supply the fpc location on 1st start"
  285. echo ""
  286. echo "=============================================================="
  287. echo ""
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 13, 2020, 06:59:17 pm
This line #219 is still causing issues.  I've looked at the script file with a hex editor and there are no EOF characters.
cat << EOF >> $HOME/.fpc.cfg

Using NotePad++ which does syntax high lighting of scripts I see that the EOF in that line signals something to the rest of the script.  Removing the << EOF also now shows the rest of the file as a proper script.

Rerunning the script without the << EOF now has it busy "Doing some extra configuration" after the compiling FPC for 311  [    <=>  ]

Now to wait and see if this line is ever executed.
echo "Now compiling Lazarus, this will take some time"
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on July 13, 2020, 07:23:19 pm
You could remove lines 219-225. They belong together.
They add some lines to .fpc.cfg which are needed.

It's strange it doesn't work for you.
Maybe some malformation during copy/pasting?

It's normal that notepad++ shows it different because from << EOF to the EOF line should be added to the.fpc.cfg.

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 13, 2020, 07:44:54 pm
Very strange.
I can type in
pi@raspberrypi:~ $ cat << EOF >> .fcp.cfg
># Hello World
>EOF

And then look at the file and sure enough at the end of it is Hello World.

I've gone to this forum with cromium on the Pi4 and pasted the script into Geany.  Once saved it recognizes it as a script and doesn't highlight the offending lines as bad.  Trying a recompile now.  Very strange since the actual content of the files don't look any different.

It's now made it through the extra configuration and is compiling lazarus.  I'll report back

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 13, 2020, 11:09:25 pm
Well that worked right up to the desktop ICON that is supposed to run Lazarus but first always asks if I want to run the executable.  I've yet to figure out how to remove that particular nag dialog.

But when I finally run this I get an error box with
"The project uses target OS=Linux and CPU=arm.  The system.ppu for this target was not found in the FPC binary directories. Make sure the fpc is installed correctly for this target and the fpc.cfg contains the right directories."

I wonder if this is a Pi4 issue?
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on July 13, 2020, 11:12:51 pm
I wonder if this is a Pi4 issue?
Did you remove that EOF part for .foc.cfg?

How does your /home/pi/.fpc.cfg look like?

Code: [Select]
cat /home/pi/.fpc.cfg
And did you logout and logged back in?
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 13, 2020, 11:41:18 pm
Yes.  Did all of that but I think I mucked up on one of the paths.  Probably should have uninstalled Lazarus 1.6 first.  Just rebooted.  Ran the makelazarus script again.  It's now finished compiling the package LazSerial and is busy recompiling the IDE to install the package as I'm writing this.
At the Linking ../lazarus stage.
That it built the package is the major step forward over Rev 1.6 and 2.0.
Done.  When it launches the Configure Lazarus IDE dialog the Fppkg is empty and the suggestion is leave empty to use the default.  Not sure what to do there.

BTW, since this makelazarus script worked I ran a side by side byte compare between the original and the new one.  Absolutely identical.  Except when I then asked it to include leading and trailing spaces.  The defective makelazarus script had a consistent 2 space insert on all lines.  The Chrome select and copy to clipboard did not.

However appears to work.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 14, 2020, 12:02:20 am
So it's not quite write once, compile anywhere so I'll have to add some conditional stuff to make it work right.  But it's close.

The documentation for the LazSerial component says there are issues with enumerating the serial port.   I'm seeing only a small problem that should be easy to solve.

So at the moment. 
1. The last script rvk posted works well as long as it's captured and pasted without leading spaces.

2. The ICON installed on the desktop is the usual piece of crap that tells me it's a script and asks if I want to edit or run it.  I want to run it.  Always.  Never figured out how to fix that.  It also restarts the config dialog each time rather than directly to Lazarus.  Perhaps because of the fppkg issue.?

3. The identical Lazarus program compiled by 2.0.8 or 2.0.10 on WIN-XP, WIN-7, WIN-10 also compiles with 2.1.0 on the Pi4.  However the size of fonts and spacing of components on the form is incorrect.  Both development environments are using 1080 screens.

With respect to point 3, one shouldn't have to re-edit all the forms so there's perhaps some Lazarus defaults that are different on the Windows 32/64 bit targets.  Line ends are also handled slightly differently but that's to be expected given CRLF for Windows and LF for Linux.

But at least the LazSerial component compiles and installs.  And an application using the COM port works.  That's why everyone should be using Lazarus instead of Python.  IMHO.

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 14, 2020, 10:27:41 am
The attached photo shows the same source code on Stretch Pi3.  Although the Lazarus 1.6 won't run the installed component due to missing files the screenshot does show that the fonts, buttons etc match the Windows versions unlike the latest Pi OS.

So the three year cycle of OS upgrades results in more man hours of useless work with what appears to be very little benefit.  The MakeLazarus script that ran on the Pi4 with Buster does not finish on the Pi3.  So I guess I might as well trash the 16GB MicroSD with Stretch and rebuild with Buster so that I can load the newest Lazarus.  What a colossal waste of time for no apparent benefit. 

Perhaps someone can explain why Buster is better than Stretch?  My first OS on a Pi was Wheezy on a Pi2B.  That one also bit me in the backside when Octoprint did and automatic upgrade that wouldn't run on Wheezy. It could have checked first and refused to upgrade.  But not.   I had to upgrade the OS to do the exact same thing it was doing the previous day.  The 'new' features of Octoprint were for hardware I didn't have on my 3D printer.  That cost a couple of days of screwing around I'll never get back.

 IMHO I think a 3 year life cycle on an OS is way too short.  Fine if we were still using vacuum tubes and paper oil filled capacitors that had a life of 2 years but the hardware now has a life of 10 to 20.  It's time the software reflected that.

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on July 14, 2020, 11:44:03 am
1. The last script rvk posted works well as long as it's captured and pasted without leading spaces.
Argh... Yes. There should be no leading spaces. I think the browser you used, inserted them during copy. Chrome does it correctly. This is since the code-tags also have advanced formatting (unlike before).

2. The ICON installed on the desktop is the usual piece of crap that tells me it's a script and asks if I want to edit or run it.  I want to run it.  Always.  Never figured out how to fix that.  It also restarts the config dialog each time rather than directly to Lazarus.  Perhaps because of the fppkg issue.?
I'm not sure I had that too? I can't test it right now because I don't have a spare PI.
But to remove the prompt you can do the following:
Open File Manager, Select Edit - Preferences - General, Tick the option "Don't ask options on launch executable file"

3. The identical Lazarus program compiled by 2.0.8 or 2.0.10 on WIN-XP, WIN-7, WIN-10 also compiles with 2.1.0 on the Pi4.  However the size of fonts and spacing of components on the form is incorrect.  Both development environments are using 1080 screens.

With respect to point 3, one shouldn't have to re-edit all the forms so there's perhaps some Lazarus defaults that are different on the Windows 32/64 bit targets.  Line ends are also handled slightly differently but that's to be expected given CRLF for Windows and LF for Linux.
Isn't the font-size taken from the desktop-font? Look at the size of the font of the form. If it's 0 it will take a default. I think the font-size on the RPI desktop is larger than it should be. So you should take different font-size into consideration OR specify exactly what font-size you want.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on July 14, 2020, 03:03:44 pm
Mind if I suggest another, quite different approach ?

I have just had a quick play with building my tomboy-ng on a Pi. I installed FPC from a tar then downloaded Lazarus source and built just lazbuild and lcl.  That way, i could build an existing project quite easily, from the command line (as computer are meant to be used) without building Lazarus the IDE at all.

I write the code on a more suitable machine than a Pi, all I want to do is build it. Sounds like you have some legacy code, might work for you too ! 

Now, obviously I am using Buster but the same process should work with any viable OS. Stretch is old but still pretty widely used on larger systems. If its a new stretch install, you will probably need to install libgtk2.0-0-dev first ....

And if this is a silly solution, sorry about that !

Davo

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 14, 2020, 06:58:42 pm
Mind if I suggest another, quite different approach ?

I have just had a quick play with building my tomboy-ng on a Pi. I installed FPC from a tar then downloaded Lazarus source and built just lazbuild and lcl.  That way, i could build an existing project quite easily, from the command line (as computer are meant to be used) without building Lazarus the IDE at all.
Davo

Your suggestion might work.  However, I did my share of command line stuff on PDP-10s and Unix.  I detest (with a passion) doing anything from the command line.  There wouldn't be a need for Delphi or Lazarus if we were back in the 70's with punch cards writing ALOGOL-W programs on IBM-370s.  (Been there, done that).   So although the socketCAN (https://github.com/linux-can/can-utils) library is useful at the command line for dumping and sending CAN messages it's not really all that useful at the command line. 

As shown in the second photo the second tab, and there are a few more to come, for interacting and simulating a CANopen Master or Slave are much better done with a graphical user interface.  And that philosophy is probably best supported by probably 99.99999...% of PCs, laptops, tablets and even now phones not using a command line interface.  One can use one for a lifetime and never have to use a command line interface.  My two cents.

I'll have to check what OS is available on the Beaglebone Black.  My goal for this project, and the reason for using Lazarus rather than RAD Studio is to make the code available to everyone.  RAD Studio with either C++ or Delphi can compile for Microsoft, Apple and now Linux but not for ARMs like Pi and Beagle.  Not only that Delphi can do multi-platform user interface design so the components on the desktop or tablet surface have the look and feel of that particular environment.  iPad and iPhone buttons look like what you get from Apple.  Android buttons are different as are the ones for PCs and MACs.  All on one development environment. 

Different from Lazarus with Write once, Compile many times, Distribute executable.   In C++ or Delphi or a mix.  But next year when my RAD Studio support license expires I'm not sure I'll have the funds to renew.  And for this project I want to reach a hobby small business market with source code.
John
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 14, 2020, 07:14:14 pm
Oh and I'm also using Lazarus under LinuxCNC to create the equivalent of MACH3 (WIN-XP) wizards that take away the tedium of writing long G-Code applications to do simple things like instruct a milling machine to bore a hole at a specific location.

Even this program could be designed to run from a command line with a whole bunch of parameters.  And some LinuxCNC users have done exactly that.  But not me.

The PC for my mill is dual boot and runs both LinuxCNC and MACH3 but I don't think I've booted WIN-XP up now for several months so I think I've made my decision to stay with LinuxCNC.  That and to use MACH3 properly it really needs an Ethernet SmoothStepper for $150US or so.  The LinuxCNC is now using a MESA 7i92 Ethernet to Parallel module ($89US).  So a bit of apples and oranges there too.  And MACH4 costs too much and requires either the discontinued WIN-7 or WIN-10 and WIN-10 will never end up running machines in my shop.

I am trying really hard to become a Lazarus user.  MachineKit (a derivation of LinuxCNC) runs on a BeagleBone Black taking advantage of the built in dual hardware processors.  There are others now using a Raspberry Pi for LinuxCNC along with the MESA 7i92.  So once again, Lazarus applications with full source code released are the best way to develop these wizards without ever touching the command line.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on July 15, 2020, 02:07:06 am
.....
Your suggestion might work.  However, I did my share of command line stuff on PDP-10s and Unix.  I detest (with a passion) doing anything from the command line.  There wouldn't be a need for Delphi or Lazarus if we were back in the 70's with punch cards writing ALOGOL-W programs on IBM-370s.  (Been there, done that).   So although the socketCAN (https://github.com/linux-can/can-utils) library is useful at the command line for dumping and sending CAN messages it's not really all that useful at the command line. 
....
I was not suggesting you build a command line app, my suggestion was that you can build any app (GUI or otherwise) from the command line and so avoid having to build Lazarus.  If you already have the code for your app, or are developing it on a bigger machine, its a way to get it built on the raspberry pi.   I might be wrong but developing any sort of substantial app on the raspberry Pi might be a bit tedious.

Good luck with your project !

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 15, 2020, 03:10:19 am
I see your point but as my previous screen shots show, what looks great on Stretch, WIN-XP, WIN-7 and WIN-10 looks terrible on Buster. I've tried changing screen fonts with no luck.  And things like rounded corners on buttons that are square on the Buster version along with positioning out of whack. 

So the Lazurus IDE really has to be there to get around a useless/broken Buster version of the OS.  And again, other than because they have this schedule of upgrading every 3 years I still don't see anything better in Buster.  I've just created a new 16GB SD card for the Pi3.  I'll see what happens there. 

I think overall my better solution might be to move backwards and since I've already had to make changes to LazSerial to get it to work right fixing it so it compiles with Lazarus 1.6 would mean no issues with either the Pi or the Beaglebone.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 15, 2020, 03:11:47 am
Oh and downloaded your Tomboy-ng to give it a try.  Neat!
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 15, 2020, 09:08:51 pm
Brand new 16GB MicroSD card for Pi3.  Install Buster.
The script poisted by rvk fails every time.  This is just one of the failures.  Initially it was failing with me not being allowed access to /root.  And so on.  So I can install 2.0.0 but the moment I try and install a component package I get this type of error.

https://forum.lazarus.freepascal.org/index.php/topic,46612.0.html (https://forum.lazarus.freepascal.org/index.php/topic,46612.0.html)

I wasn't getting it with the Pi4 and Buster after running the script from rvk. 

I cannot believe how badly installing the newest lazarus IDE and Free Pascal is broken.  Don't even know where to start looking next.


Code: Text  [Select][+][-]
  1. echo ""pi@raspberrypi:~/lazarus $ ./MakeLazarus
  2.  
  3. ==============================================================
  4. Running on: Raspberry Pi 3 Model B Rev 1.2
  5. ==============================================================
  6.  
  7. Updating package list to latest version (sudo needed)
  8.  
  9. ==============================================================
  10.  
  11. Installing required packages (sudo used)
  12.  
  13. Compiling for ARMv7 Processor (Pi2 and Pi3 only)
  14. ==============================================================
  15.  
  16. Downloading FPC sources
  17.  
  18. Now: Last Changed Rev: 45792
  19.  
  20. Downloading Lazarus sources
  21.  
  22. svn: E120106: ra_serf: The server sent a truncated HTTP response body.
  23. Now:
  24.  
  25. ==============================================================
  26.  
  27. Now compiling FPC, this will take some time
  28.  
  29. /usr/bin/ld.bfd: warning: ./link.res contains output sections; did you forget -T?
  30. /usr/bin/ld.bfd: warning: arm/bin/arm-linux/link.res contains output sections; did you forget -T?    ]
  31. 2.52k [                             <=>                                                              ]
  32.  
  33. Doing some extra configuration
  34.  
  35. ==============================================================
  36.  
  37. Now compiling Lazarus, this will take some time
  38.  
  39. Makefile:2956: warning: overriding recipe for target '.'                                             ]
  40. Makefile:2954: warning: ignoring old recipe for target '.'
  41. Makefile:2956: warning: overriding recipe for target '.'
  42. Makefile:2954: warning: ignoring old recipe for target '.'
  43. Makefile:2956: warning: overriding recipe for target '.'                                             ]
  44. Makefile:2954: warning: ignoring old recipe for target '.'
  45. Makefile:2956: warning: overriding recipe for target '.'                                             ]
  46. Makefile:2954: warning: ignoring old recipe for target '.'
  47. Makefile:2956: warning: overriding recipe for target '.'                                             ]
  48. Makefile:2954: warning: ignoring old recipe for target '.'
  49. make[2]: *** [Makefile:4667: lazarus] Error 1                             <=>                        ]
  50. make[1]: *** [Makefile:5108: bigide] Error 2
  51. make: *** [Makefile:3610: idebig] Error 2
  52.  132  [                                                                 <=>                          ]
  53. Something went wrong compiling Lazarus. Aborting.
  54.  
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: rvk on July 15, 2020, 09:51:16 pm
Downloading Lazarus sources
svn: E120106: ra_serf: The server sent a truncated HTTP response body.
Yikes. Looks like the Lazarus sources are not completely downloaded. I had this too last week. With a second try the error went away.

The script doesn't check if the checkout on svn is successful.
(Maybe I should build that in)

If you keep getting the error you could do
svn cleanup /home/pi/dev/lazarus

And if that doesn't work, you can remove the complete /home/pi/dev directory (including subdirs) and /home/pi/.fpc.cfg

BTW. The script doesn't need root. I run it as pi. But pi has sudo root privileges by default (which are used for the apt-get command).
Nowhere in the script is /root accessed. So what error message did you get for that???

Are you on WiFi or cable? If on WiFi, the svn has a timeout which might get hit (due to WiFi of svn server problems)
see https://stackoverflow.com/questions/27267742/why-do-i-get-svn-e120106-ra-serf-the-server-sent-a-truncated-http-response-b

(I think I also had massive problems with the default integrated WiFi in the RPI3. I used a separate usb-dongle to fix that)

Edit: The lazarus svn seems to be having some problems.
For me:
Quote
==============================================================
Running on: Raspberry Pi 3 Model B Rev 1.2
==============================================================

Updating package list to latest version (sudo needed)

==============================================================

Installing required packages (sudo used)

Compiling for ARMv7 Processor (Pi2 and Pi3 only)
Downloading package fp-compiler-3.0.4

Get:1 http://mirror.serverius.net/raspbian/raspbian buster/main armhf fp-compiler-3.0.4 armhf 3.0.4+dfsg-22+rpi1 [1,789 kB]
Fetched 1,789 kB in 1s (1,600 kB/s)
==============================================================

Downloading FPC sources

Now: Last Changed Rev: 45793

Downloading Lazarus sources

svn: E120108: Error running context: The server unexpectedly closed the connection.
Download of fpc failed. Aborting.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 15, 2020, 10:06:17 pm
I'm going to start over and reflash the SD card.  Too much of try this and then try that.  I thought I got rid of everything.
Direct.  not WiFi.
And here's an interesting point.  Put Stretch SD card back into Pi3.  The one with Lazarus 1.6.  Seems now for some reason the gdb is not failing and the component is installed and the LazSerial appears to work.  The Beaglebone black only has a command line version of Buster and the newest graphical one is still Stretch and Lazarus is 1.6.  Haven't been able to install anything newer on the BBB.

I think for this project, which is for a series of articles on CANopen, I may see if I can install Lazarus 1.6 on the Windows machines since I now have the LazSerial component (access to USB based Serial ports) working.

The Buster SD card already has the CAN-utils installed and I've been logging CAN messages via the CAN HAT that uses the MCP2515.  The object of the Pi and BBB versions of this application was to select either the USB CAN dongle or select the MCP2515 (CAN0 device) and have identical operation.  Then the Lazarus Pascal code can show how to write CAN bus applications for either a serial port USB to CAN dongle or the SocketCAN Library.  The SocketCAN should be portable to the BBB with it's internal CAN hardware inside the processor.

So I don't really want to reprogram the Buster SD but it may be the best way to start over and not install anything else until I have a newer Lazarus.  But, OTOH, if 1.6 works...
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: avra on July 15, 2020, 11:28:16 pm
Don't even know where to start looking next.
If other ways do not work for you, then you can take a look at fpcupdeluxe:
https://wiki.lazarus.freepascal.org/fpcupdeluxe

It can be used to install any imaginable Lazarus+FPC combo (official, fixes, trunks...) native on Pi, or for easy install of cross compiler targeting Pi.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 15, 2020, 11:52:15 pm
If other ways do not work for you, then you can take a look at fpcupdeluxe:
https://wiki.lazarus.freepascal.org/fpcupdeluxe
It can be used to install any imaginable Lazarus+FPC combo (official, fixes, trunks...) native on Pi, or for easy install of cross compiler targeting Pi.

That looks really interesting.  Do we just use the fpcupdeluxe-arm-linux link or what needs to be done to install this on a pi (or BBB)?

My eyes are sore from staring at the screen and trying to figure out what to do next.  So I went and played in the shop for a bit.  Just finished changing over a single phase 2HP motor on my mill to a 1.8kW AC Servo controlled by LinuxCNC.
https://youtu.be/VvXMoC917O0 (https://youtu.be/VvXMoC917O0)
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 16, 2020, 12:12:56 am
BTW, mucking with the font size directly and resizing a few things results in a more presentable display.  I still need to find out what to do to prevent the extra LF that is needed on the WIN systems but not on the Linux.   But considering the LazSerial component had a comment that it wasn't working with Linux ports I've had success here. 

What also doesn't work the same is the ON Change event when the first item in the list is selected from the drop box. Select the 2nd or 3rd and the event is called.  But select the first and it's not.  The WIN version of Lazarus does not have that problem.

The attached screen shot is a grab from real time on Stretch, Lazarus 1.6, Lawicel CANUSB attached v/ttyUSB0.  The screen on the right is a CAN RS485 HAT using an MCP2515 and ifconfig shows it as can0:  They are both on a larger network generating a number of CAN messages.

The next step with either Lazarus 1.6.0 or 2.1.0 is to add those devices into the COM Port selection list and from there chose either the LazSerial connection or the socketCAN connection.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 16, 2020, 12:33:19 am
OK.  Did a quick download of the WIN32 version.  Wow!   Downloaded the ARM one onto the Pi.  It appears to be installing...2.0.10 which is what I have on the WIN PCs.  I wonder if this will run on the BBB...

Update on Pi3 (Stretch Version 9):  Had a bunch of warnings with SVN client return Error Code 256
and in pink unexpectedly closed connection.
Then after a while.. restarted.  May take some time...

Downloaded same ARM package to BBB (Stretch Version 9).  Had to use terminal to chmod +x and then run ./fpcupdeluxe.
It's poor little single core is usage bar is pinned at 100%.  May take some time...
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on July 16, 2020, 03:11:48 am
jcdammeyer, I really feel for you, you are getting well meaning advice from all quarters and I have been part of that.  And sadly will continue to do so ...

rvk's script is cool but it has two problems IMHO, firstly, it goes to a lot of trouble to download a boot compiler and the build FPC from that, secondly, it scripts a fairly complicated process that is done, but most users, very infrequently. Step by step is safer.

A far easier approach, again, IMHO, on just about any Linux system (and Rasberry Pi is just another Linux system) is to install FPC from a tar ball, see https://wiki.lazarus.freepascal.org/Installing_the_Free_Pascal_Compiler#FPC_Tar_Balls and then  download and compile Lazarus, this is documented at https://wiki.freepascal.org

Both documented processes are a handful of steps, not a script, because that way, you can adapt as you see fit and you can see, and isolate any errors when they happen.

The only non "Linux standard" thing there is the need to increase swap space (as per rvk's script), something that not uncommon on Raspberry Pi and other systems with not a lot of memory.

I hope I have not made things worse.

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 16, 2020, 03:38:25 am
I hope I have not made things worse.
Davo
Not worse actually.  All these suggestions have led me to the fpcupdeluxe which is pretty neat.   At the moment on the Pi3 I'm editing using Lazarus 2.0.10 which is the same version as the Windows one.  And it's almost working on the Beagle except I think that when I started the program and install sequence I made a rather dumb mistake.  I think I was using a root terminal.  So the whole thing installed as root with root permissions.  Now trying the generic project (with 2.0.10 BTW) I run into write permissions for saving files and compiling etc.  So not quite working but it's the thought that counts  ;)

Not only that it put it all in the Downloads folder for some reason and didn't create a desktop ICON which was properly created on the Pi3 and in the user folder.  Again probably because of write permissions. 

Had to increase swap space on BB what with only that tiny bit of 512MB of Ram.  I can remember compiling with only 64K using Turbo Pascal and CP/M-80. (The 8" floppies didn't hold a lot either).  Given that the MicroSD card doesn't do a lot of leveling in the long run the swap space would be better suited to an external hard drive on USB or even an actual RAM drive.  Now that would be an interesting product.  Recycled PC RAM sticks turned into USB RAM drives.

So at the moment I'm pretty impressed with fpcupdeluxe.  Expecially with it's cross platform capabilities.  When it finally finishes on WIN-7 we'll see what it's created.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: DonAlfredo on July 16, 2020, 07:54:30 am
@jcdammeyer
The fpcupdeluxe RPi binaries you are using, are build on Windows. As are all other binaries !
I have many RPi running 24/7 that run servers, daemons and GUI apps, all cross-compiled from Windows.
However, when debugging is needed, I have a very fast headless ODROID (arm64) with a local install of FPC and Lazarus. With vncserver and vncclient, I am debugging remotely on the same Windows PC.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 16, 2020, 08:13:20 am
@DonAlfredo
It never did complete on WIN-7.  Black window that never went away.  Now both the Pi and the Beagle also had a black screen for a while.  I just left them.  Eventually they recovered. 
I also found that because I'd inadvertently used the the root terminal that the fpcupdeluxe lazarus was on the root desktop and when I logged into root instead I could install the component and run the application all under 2.0.10.

On the Beagle I  created a much larger swap file.  Cleaned out the old folders that had root ownership and now I'm trying again.

I'm interested in learning more about what you do with windows and the cross compile. 
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: DonAlfredo on July 16, 2020, 09:02:16 am
I do not have a Win7 anymore. If I have one available will try to test. Might be interesting.

About installing.
You followed the right path. Always start by using the official installers for FPC and Lazarus. These should work, if maintained properly.
For special things like easy crossing or testing trunk or multi-installs or as a last resort or just for fun, you could use fpcupdeluxe.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 16, 2020, 09:36:36 am
I do not have a Win7 anymore. If I have one available will try to test. Might be interesting.

About installing.
You followed the right path. Always start by using the official installers for FPC and Lazarus. These should work, if maintained properly.
For special things like easy crossing or testing trunk or multi-installs or as a last resort or just for fun, you could use fpcupdeluxe.

I finally bit the bullet and bought an HP ZBook with WIN-10.  At the moment I haven't seen a single thing that makes it any better than WIN-7. 

Anyway, the Beagle is still busy compiling.  I've never quite understood why 1 GHz singlecore processor running a lean version of Linux is so much slower than a WIN-XP PC with one core and about the same amount of memory.   The work I did in the first decade of this millennium on that WIN-XP system (including a lot of Delphi) felt then and now more comfortable that Linux on the Beagle.

It's probably because I don't know something.  And since I don't know what I don't know it's really hard to figure out.

What I am impressed with is the FPCUPdeluxe.  The ability to grab a version of FPC and Lazarus and build them with minimal problems is outstandingly impressive! Oh what the heck. a few more !!!!!

I come from an era where my compiler writing professor told us that eventually memory would be so large that to do good error detection etc."add another pass".  He had us doing things like that to show how we could continue to compile even when a blatant coding error would cause most compilers to choke.

We worked on an Ahmdal 470 and wrote our assignments in FLACC.  (Algol=68)  We had a budget for computer time and the FLACC compiler was expensive.  What would take 0.1 seconds with Algol-W might take a second with the FLACC.  But, if it generated 32 error messages we learned very quickly to fix all 32 because all 32 were accurate.  If you only fixed the first few like you might with other compilers you'd discover very quickly that another 1 second of computer time burned up your assignment budget very quickly.  I've never seen another compiler that does that as well as the FLACC.

Here are the links.  My professor was Chris Thompson.
https://en.wikipedia.org/wiki/FLACC (https://en.wikipedia.org/wiki/FLACC) 
https://en.wikipedia.org/wiki/ALGOL_68 (https://en.wikipedia.org/wiki/ALGOL_68)

I think it's why I like Delphi and Lazarus.

Edit:  This link is priceless and well worth the read:
http://www.softwarepreservation.org/projects/ALGOL/book/Thomson-FLACC%20thesis.pdf (http://www.softwarepreservation.org/projects/ALGOL/book/Thomson-FLACC%20thesis.pdf)
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: DonAlfredo on July 16, 2020, 10:00:48 am
Quote
I finally bit the bullet and bought an HP ZBook with WIN-10
Good decision. Win10 is very good. And now install VirtualBox !!  :D

The thesis poses an interesting programmer starting point: "cafetaria" programming.
For me, 100% true when I was a student and even today !

Remember, fpcupdeluxe is just a tool around FPC and Lazarus.
The real magic starts with these two. So many systems supported. Amazing.

Ps.
Long time ago, I started with 1 second mainframe Pascal compiling and executing time per month. That was all we could afford as a student.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: avra on July 16, 2020, 10:14:28 am
Do we just use the fpcupdeluxe-arm-linux link or what needs to be done to install this on a pi (or BBB)?
It will work, but it's much better to use fpcupdeluxe-armv6hf-linux on 32bit OS and fpcupdeluxe-aarch64-linux on 64bit OS.

It's poor little single core is usage bar is pinned at 100%.  May take some time...
If I remember well, since last few years you need around 2GB RAM for Lazarus compilation of big IDE with lots of additional components. When lacking physical RAM - swap helped but sloooweed down a loooooot.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 17, 2020, 02:48:25 am
It's poor little single core is usage bar is pinned at 100%.  May take some time...
If I remember well, since last few years you need around 2GB RAM for Lazarus compilation of big IDE with lots of additional components. When lacking physical RAM - swap helped but sloooweed down a loooooot.

I found the Beagle quite slow after installing the 2GB swap drive.  I tried disabling the swap since it wasn't there before I installed the new Lazarus and found that now it won't compile the project at all.  Perhaps I did something to a swap drive that was there before.  Although plugging in a different stretch SD and doing a sudo swapon -s didn't show one.

What's the general concensus for a swap drive?  Having it on an SD card will kill it in no time so it should be in RAM which will also speed things up.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 17, 2020, 02:55:57 am
Quote
I finally bit the bullet and bought an HP ZBook with WIN-10

The thesis poses an interesting programmer starting point: "cafetaria" programming.
For me, 100% true when I was a student and even today !

Long time ago, I started with 1 second mainframe Pascal compiling and executing time per month. That was all we could afford as a student.
This is an interesting article. 
https://community.idera.com/developer-tools/b/blog/posts/c-builder-a-delphi-developer-perspective?utm_source=Eloqua&utm_medium=email&utm_content=Article-cpp200716-delphiperspective (https://community.idera.com/developer-tools/b/blog/posts/c-builder-a-delphi-developer-perspective?utm_source=Eloqua&utm_medium=email&utm_content=Article-cpp200716-delphiperspective)
I also have RAD Studio for work-work projects.  The Delphi compiler is still so much faster than Lazarus.  A program 10x the size compiles and is running in 4 seconds.  A much smaller Lazarus program takes 14 seconds.

I did look at the cross compiler features on the windows system. 
Obviously Target OS is Linux
Family is ARM
What processor for Pi3 and which one for Beagle?   Or don't tell me but point me in the direction to find out.  On the Pi and BBB they are listed as default so that didn't really help looking on those Lazarus installations.  The BBB is so painfully slow that I'd rather write the app on the PC and then cross compile for the BBB but perhaps, because of some differences, test and debug on the Pi.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: DonAlfredo on July 17, 2020, 07:38:32 am
Quote
What processor for Pi3 and which one for Beagle?
Rpi 3-4 have an ARMV8. Beagle has ARMV7. For Lazarus you may choose aarch64 to compile for ARMV8.

I definitely would like to advice you to look more closely into cross-compiling. Its one of the main super-features of FPC and Lazarus. I myself use strictly layered software design to be able to use cross-compiling. Using USB or I2C as interface, the only debugging on the ARM-system needed is to check this interface. All the rest (main program/business logic [debugging]) can be done on a big and fast Windows or Linux systems.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 17, 2020, 08:06:26 am
I definitely would like to advice you to look more closely into cross-compiling.

Thanks.  Much of the work I do with Delphi still revolves around the USB port and talking to dedicated hardware like 9S12X or dsPIC.  Or to CANUSB dongles.  Very big on Controller Area Network.  So often the debugging has to be done on the machine where the hardware lives.

Cross compiling for the RPi brings up an interesting question and one I'll have to try to see what happens.   I have a drop down list that is populated with the list of serial ports.  Once you select a port the OPEN/CLOSE buttons are made visible and the OPEN enabled.  With Windows select the first, second or third and the list retracts, that entry shows up and buttons are enabled. 

On the Pi and Beagle the list drops down.  Click on the 2nd, 3rd or 4th and the list retracts and the entry selected is shown along with the buttons made visible.  But not the first.  After the list retracts you still have to click on the text in the list box before the buttons are made visible. 

Since this happens on both the Beagle and the Pi my guess is it's a Linux Library issue and likely not an ARM issue.  So I imagine cross compiling for the Pi will result in the same problem.

Now I'm not looking for a solution here.  This is the wrong subject heading to deal with this problem.  But if the cross compiler creates the same issue as the one on the Pi while compiling for the PC does not then maybe it is of interest for installation?

Anyway, cross compiling and testing via USB to CAN dongle can be done on both systems and in fact I'm doing that on the PC.  Just so much faster.  But once I start using the Pi HAT with MCP2515 for CAN or the internal CAN on the BBB I'm screwed.  Pretty well have to debug on site.  But 99% of what I'm doing can be done with the USB dongle.

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 17, 2020, 08:43:39 am
So I set up to cross compile using the aarch64 on the PC.  OS was set to Linux, Processor was default.  I turned debug off so the file wouldn't be huge.

And here's a screen grab of the error.

Do I have to install using fpcupdeluxe with target ARM onto the PC too?  That would make sense.  Of course that hasn't worked on a PC for me yet.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: DonAlfredo on July 17, 2020, 09:40:53 am
Now you are in the fpcupdeluxe hotspot.  :D
Do not touch your current install. It works.
Use fpcupdeluxe to make a new install of FPC stable and Lazarus stable. Both these releases are very good. Choose an install location of your choice. After successful install, use fpcupdeluxe again to install the aarch64-linux crosscompiler. After success you are ready to go crossing.
I hope these instructions will work for you.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: DonAlfredo on July 17, 2020, 09:44:49 am
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/issues/257#issuecomment-652435292
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: avra on July 17, 2020, 12:36:59 pm
Anyway, cross compiling and testing via USB to CAN dongle can be done on both systems and in fact I'm doing that on the PC.  Just so much faster.  But once I start using the Pi HAT with MCP2515 for CAN or the internal CAN on the BBB I'm screwed.  Pretty well have to debug on site.
Well, most of the time you don't have to debug on site if you change your architecture a bit. Here is one example: having a fleet of Balena enabled ARM boards connected to CAN 2.0B via CAN shield and using SocketCAN, with WiFi or 4G shields for communication. CAN messages go through custom J1939 filter and then they are forwarded to a custom TCP/IP server. That TCP/IP server can be on ARM board it self, or on your PC - having the same or different logic just for debugging. On such setup GDB remote debugging also works, and WireShark SocketCAN and J1939 disectors can also be used when needed. Either on board, or on development pc after tunneling and forwarding SocketCAN messages. Alternative for CAN<>ETH interfacing can be usage of socketcand daemon.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on July 17, 2020, 09:49:08 pm
Thanks for your comments.  Definitely something to consider.  Maybe this weekend I can find the time to install one of the cross platforms on the new WIN-10 laptop.

Meanwhile I'll get back to the application that started all this.
Thanks again everyone.  Very enlightening and helpful.
John
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Mi-Ki on February 19, 2021, 11:23:48 am
Hi.
How to install Lazarus on Raspberry - Raspbian Buster?

sudo apt-get install fpc
sudo apt-get install lazarus
That's not good.
Do not install packaging


Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on April 28, 2021, 07:33:08 am
Hi.
How to install Lazarus on Raspberry - Raspbian Buster?

sudo apt-get install fpc
sudo apt-get install lazarus
That's not good.
Do not install packaging

I'm pretty sure that I use the sudo apt install lazarus and it did everything installing whatever version it found.

Going back through my old postings I realize that it's not a very complete description of how to install the version of your choice. In the next little while I'll be installing it onto a PC X86 based LinuxCNC system.   I'll use the https://github.com/LongDirtyAnimAlf/fpcupdeluxe

process and document the details.

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on May 01, 2021, 10:34:20 am
sudo apt-get install fpc
sudo apt-get install lazarus
Do not install packaging

I am not sure what you mean by "packaging" but please remember that the software you get with those commands is determined by Debian, not by the FPC/Lazarus developers.  The Debian package managers like to break things in smaller lumps, IDE, LCL, GTK2, Qt5 etc.  It could be that what you are missing is in another package.

I get my FPC from SourceForge and build a Lazarus from source, again from SourceForge. That way, I get the system the developers intended.

Davo

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Gustavo 'Gus' Carreno on May 01, 2021, 05:50:20 pm
Hey all,

Has anyone come around and suggested using fpcupdeluxe (https://github.com/LongDirtyAnimAlf/fpcupdeluxe)?

I know I've been beating this dead horse quite a lot lately, but MAN does it solve ALL the issues in AT LEAST 2 button clicks :)

And YES, button clicks, since it's a GUI app and not a command line app :P

Cheers,
Gus

EDIT: Jezzz I'm blind as a friggin bat: fpcupdeluxe (https://github.com/LongDirtyAnimAlf/fpcupdeluxe) mentioned not two answers above mine!!!
ARGHHHHH, SORRY peeps !!!
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on May 01, 2021, 06:36:17 pm
Hey all,

Has anyone come around and suggested using fpcupdeluxe (https://github.com/LongDirtyAnimAlf/fpcupdeluxe)?

I know I've been beating this dead horse quite a lot lately, but MAN does it solve ALL the issues in AT LEAST 2 button clicks :)

And YES, button clicks, since it's a GUI app and not a command line app :P

Cheers,
Gus

EDIT: Jezzz I'm blind as a friggin bat: fpcupdeluxe (https://github.com/LongDirtyAnimAlf/fpcupdeluxe) mentioned not two answers above mine!!!
ARGHHHHH, SORRY peeps !!!

I finally got around to running this on LinuxCNC:
sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev

I then also ran a
sudo apt install git

and then git clone https://github.com/LongDirtyAnimAlf/fpcupdeluxe.git

And now I'm stuck.  I seem to be missing from the read me file exactly what the next step is to actually run the graphical fpcupdeluze so I can choose which version I want to build. 

Suggestions?

Thanks
John

Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: lucamar on May 01, 2021, 06:50:21 pm
and then git clone https://github.com/LongDirtyAnimAlf/fpcupdeluxe.git

[...]

Suggestions?

Instead of cloning the source repository, which you would then need to compile, download the proper binary from https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/1.8.2r (https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/1.8.2r) and then just run it.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on May 01, 2021, 07:22:08 pm
and then git clone https://github.com/LongDirtyAnimAlf/fpcupdeluxe.git

[...]

Suggestions?

Instead of cloning the source repository, which you would then need to compile, download the proper binary from https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/1.8.2r (https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/1.8.2r) and then just run it.

And that brings me back to a question I posted on the LinuxCNC group that as yet has not been answered when I posted the above link in the question.  For LinuxCNC running Debian which version do I download.  It was easy for the Pi or the Beagle.  The LinuxCNC is running on a PC with AMD 64 and so I downloaded this one.
fpcupdeluxe-aarch64-linux

But I can't figure out how to execute.  I've done the chdmod +x but still it complains it's not the executable format.

For windows it's easy.  It's an .exe and you run it.  It installs and creates the desktop icon.  Last year I did something that I didn't document for both the Beagle and the Pi3.  But for the life of me I can't remember what else to do.  Much like learning to speak/write a language when your only source is a dictionary is impossible.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Gustavo 'Gus' Carreno on May 01, 2021, 08:38:27 pm
Hey jcdammeyer,

and then git clone https://github.com/LongDirtyAnimAlf/fpcupdeluxe.git

Errmmm, really sorry to say, but you don't get the source, you get the compiled binary for your system on the release page:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases

And then you run THAT one.

So for example on a RasPi 3, RasPi4 on Raspbian:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-arm-linux

For RasPi4 on a 64b Linux:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-aarch64-linux

Then you set the executable bit:
Code: Bash  [Select][+][-]
  1. $ chmod +x fpcupdeluxe-[CPU]-[OS]

And you run that.

Why are you struggling with the source???
You just threw me on a spin here ;)

No need for source since you have pre-compiled binaries for like 30+ platforms

Cheers,
Gus

EDIT Looks like I was answering when you posted that you already did what I'm saying here.
I'm very off my game today, really sorry !!!
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Gustavo 'Gus' Carreno on May 01, 2021, 08:54:02 pm
Hey jcdammeyer,

And that brings me back to a question I posted on the LinuxCNC group that as yet has not been answered when I posted the above link in the question.  For LinuxCNC running Debian which version do I download.  It was easy for the Pi or the Beagle.  The LinuxCNC is running on a PC with AMD 64 and so I downloaded this one.
fpcupdeluxe-aarch64-linux

But I can't figure out how to execute.  I've done the chdmod +x but still it complains it's not the executable format.

To be absolutely sure that you have the right [CPU]-[OS] combination could you please do this:
Code: Bash  [Select][+][-]
  1. $ file /bin/bash
AND compare to this:
Code: Bash  [Select][+][-]
  1. $ file fpcupdeluxe

The results should be the same in terms of the bitness of your system.

On my RasPi3 running Raspbian:
Code: Bash  [Select][+][-]
  1. $ file /bin/bash
  2. /bin/bash: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=b1e8e19f3b7b388468f2914bfb2ae8ac6b9f0478, stripped
  3. $ file fpcupdeluxe-arm
  4. fpcupdeluxe-arm-linux: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.0.0, stripped

If they don't match, you do not have the correct binary for your system.

Cheers,
Gus
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Gustavo 'Gus' Carreno on May 01, 2021, 09:06:53 pm
Hey jcdammeyer,

I'm really SORRY, but I just noticed this after re-reding your post for the nth time:
The LinuxCNC is running on a PC with AMD 64 and so I downloaded this one.
fpcupdeluxe-aarch64-linux

That's the binary for an ARM 64b running Linux 64b, e.g. RasPi4 with 64b Linux!!! It is NOT, I repeat NOT for a x86_64(amd64 PC) running Linux.
For that you need fpcupdeluxe-x86_64-linux:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-x86_64-linux

Cheers,
Gus
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on May 01, 2021, 10:01:47 pm
Hey jcdammeyer,

I'm really SORRY, but I just noticed this after re-reding your post for the nth time:
The LinuxCNC is running on a PC with AMD 64 and so I downloaded this one.
fpcupdeluxe-aarch64-linux

That's the binary for an ARM 64b running Linux 64b, e.g. RasPi4 with 64b Linux!!! It is NOT, I repeat NOT for a x86_64(amd64 PC) running Linux.
For that you need fpcupdeluxe-x86_64-linux:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-x86_64-linux

Cheers,
Gus
Thank you.
Now I get it!  I've downloaded it.  Was able to set it as an executable this time.  And it's now busy building stable fpc and 2.0.10 which matches what I've got on the Beagle and the Pi and the PC.

Then I can get back to the component TGraphicalControl issues I'm having.  I'll post to this thread exactly what I've done, step by step and why so the thread finishes nicely.
Thanks again
John
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Gustavo 'Gus' Carreno on May 01, 2021, 11:47:44 pm
Hey John,

Thank you.

[snip]

Thanks again

You're more than welcome. Glad I could help!!

And I'm really sorry I didn't caught the wrong binary earlier, that's on me!!!

Hope you can now resume your testing in peace :)

Cheers,
Gus
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on May 02, 2021, 12:43:14 am
Hey John,


You're more than welcome. Glad I could help!!
Hope you can now resume your testing in peace :)

Cheers,
Gus

Got back from shopping and it was all done and installed with an icon on the desktop.  First thing I'll do is make up a short document describing exactly what I did.  And since I have a Pi4 kicking around which I don't think has the fpcupdeluxe installed yet I'll verify the procedure in a simple step by step for that too.

This is the thread where I'm describing the issues with the component ported from Delphi.  Works great on Lazarus Windows but turns out the issue isn't Pi or Beagle specific but Linux specific.
https://forum.lazarus.freepascal.org/index.php/topic,54329.msg403858.html#msg403858

The posting from April 28th shows how dragging the component moves the rectangle behind it but doesn't drag the segments.  Under Windows Lazarus and Windows Delphi this is not an issue. 

The problem is with changing a component with Delphi is just a matter of recompiling the component.  With Lazarus the IDE has to be rebuilt.  Not a big issue on the PC, probably won't be under the Debian LinuxCNC PC.  But painfully slow on a Beagle or Pi.  Hence the reason for this thread installing fpcupdeluxe on the Debian LinuxCNC.

I have yet to figure out how to assign the parent of a component so I can create and test it separately from the IDE.  But that's for a different thread.  Just rambling here.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: Gustavo 'Gus' Carreno on May 02, 2021, 12:57:01 am
Hey John,

Got back from shopping and it was all done and installed with an icon on the desktop. 

I'm very glad that you're another satisfied customer ;)

First thing I'll do is make up a short document describing exactly what I did.  And since I have a Pi4 kicking around which I don't think has the fpcupdeluxe installed yet I'll verify the procedure in a simple step by step for that too.

Do not forget what I mentioned in this post above (https://forum.lazarus.freepascal.org/index.php/topic,46438.msg404296.html#msg404296).

AAAHHHH nevermind, I'll just repeat it :)
Quote
So for example on a RasPi 3, RasPi4 on Raspbian:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-arm-linux

For RasPi4 on a 64b Linux:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-aarch64-linux

The usual make it executable applies and off you go to the races :)

Cheers,
Gus
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on May 02, 2021, 01:46:23 am
Hey John,


AAAHHHH nevermind, I'll just repeat it :)
Quote
So for example on a RasPi 3, RasPi4 on Raspbian:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-arm-linux

For RasPi4 on a 64b Linux:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-aarch64-linux

The usual make it executable applies and off you go to the races :)

Cheers,
Gus

But what about this from the web site?
Code: [Select]
sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev
Isn't it required too for debugging or is that all automatically also done by the install and run of fpcupdeluxe?

John
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on May 02, 2021, 02:18:53 am

But what about this from the web site?
Code: [Select]
sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev
Isn't it required too for debugging or is that all automatically also done by the install and run of fpcupdeluxe?


You need that list of packages installed, if you are gong to make Qt5 app, add libqt5pas-dev to the list. Some will probably be installed before you got started, I dont know if fpcupdeluxe resolves dependencies.  It will do no harm to run that command, if the things listed are already installed, they won't be installed again nor will their config be messed with.

(If fpcupdeluxe has a problem, it is that it makes things too easy. You don't get to find out whats needed to build an app and you then don't know what to do if you need to do something a bit different, or are working on a system thats a bit different. Pretty soon, Alf will be the only person in our community that knows how to do these things  :)  I used fpcupdeluxe to install a Pico setup and it worked perfectly, but I don't know what it did.)

Davo
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on May 02, 2021, 02:48:29 am
(If fpcupdeluxe has a problem, it is that it makes things too easy. You don't get to find out whats needed to build an app and you then don't know what to do if you need to do something a bit different, or are working on a system thats a bit different. Pretty soon, Alf will be the only person in our community that knows how to do these things  :)  I used fpcupdeluxe to install a Pico setup and it worked perfectly, but I don't know what it did.)

Davo
I saw that PICO button on the bottom of the form.  A friend offered me the PICO.  I just sent him a screen shot since I've been trying to get him to move over to Lazarus from Delphi.   Likely won't happen for his work-work but since he has a PICO it might just give him a shove.

And I'd suggest that what fpcupdeluxe does is a good thing not a bad thing.  I'd guess 99% of the people haven't got a clue how things are installed anyway.   They just follow by wrote what they are told to do at the command line level.    If we had more people developing things like fpcupdeluxe for Linux systems with a programming environment like Lazarus we might see the tipping point reached where command line applications are considered the "lazy" or "how to appear more intelligent than anyone else" way.

Yes.  For example you could do the command line version of a G-Code generator for milling holes by writing a script that prints onto the command line and then when you want something different just place it there and use the line editor to change say the XY start location before hitting enter.  Tedious and error prone.

Or do it in Lazarus or Delphi like the attached photo.    The more of these easy to use tools that are out there the more people will start to wonder why they are given tools that do it the hard way.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on May 05, 2021, 01:11:16 am
Hey John,


AAAHHHH nevermind, I'll just repeat it :)
Quote
So for example on a RasPi 3, RasPi4 on Raspbian:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-arm-linux

For RasPi4 on a 64b Linux:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2r/fpcupdeluxe-aarch64-linux

The usual make it executable applies and off you go to the races :)

Cheers,
Gus

But what about this from the web site?
Code: [Select]
sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev
Isn't it required too for debugging or is that all automatically also done by the install and run of fpcupdeluxe?

John

My RPi3 crashed and destroyed the partition so I've installed a new version on both it and also  on the Pi4 since the Debian version with linuxcnc kept dying with the fpcupdeluxe install.
Code: [Select]
[ 52%] Compiled package utils-json2pas
The installer encountered the following error:
External command "/home/pi/fpcupdeluxe/fpc/bin/arm-linux/pyacc h2pas/h2pas.y h2pas/h2pas.pas" failed with exit code 256. Console output:
TP Yacc Version 4.1a [April 2000], Copyright (c) 1990-2000 Albert Graef
FATAL: cannot open file /usr/lib/fpc/lexyacc/yyparse.cod
make[1]: *** [Makefile:2632: utils_all] Error 2
make: *** [Makefile:2837: build-stamp.arm-linux] Error 2

fpcupdeluxe: ERROR: FPCNativeInstaller (BuildModuleCustom: FPC): Error running /usr/bin/make for FPC failed with exit code 512
. Details:


ERROR: Fpcupdeluxe fatal error !
Sequencer (FPC): Failure running fpcupdeluxe: error executing sequence FPC
Sequencer (DefaultSimple): Failure running fpcupdeluxe: error executing sequence DefaultSimple

Anyway.  On the new OS
pi@raspberrypi:~/projects $ uname -a
Linux raspberrypi 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux

Can I use the
fpcupdeluxe-aarch64-linux
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: DonAlfredo on May 05, 2021, 08:17:25 am
Quote
Can I use the
fpcupdeluxe-aarch64-linux
No. Your uname output shows that your are using a 32bit OS (armv7l).
Quote
FATAL: cannot open file /usr/lib/fpc/lexyacc/yyparse.cod
This is an error that I have been hunting for a long time. Lots of tricks are used by fpcupdeluxe to prevent this error. But sometimes to no avail. Best extra trick: run fpcupdeluxe again. It should run as expected the second time.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: jcdammeyer on May 05, 2021, 08:50:40 am
Quote
FATAL: cannot open file /usr/lib/fpc/lexyacc/yyparse.cod
This is an error that I have been hunting for a long time. Lots of tricks are used by fpcupdeluxe to prevent this error. But sometimes to no avail. Best extra trick: run fpcupdeluxe again. It should run as expected the second time.

Thanks.  That helps.  Because the LinuxCNC version is designed to work with Ethernet to the MESA 7i92H I/O card it appears to have some trouble with my hardwired Ethernet.  The WiFi on the Pi4 connects but I'm not sure it's super reliable where the Pi4 is sitting.  Quite possible that some of the issues are network.  I've created the new SD card without the LinuxCNC part so it shouldn't have any trouble but I really did want it installed on the Pi4 LinuxCNC unit for compiling G-Code generation applications.

The up side is that the fpcupdeluxe with hardwired internet installed correctly onto the Pi3 and I then installed the modified lpk and I'm now where I wanted to be over 6 months ago.  The results are here.  Not sure if it's a psClear or psSolid issue or incorrectly passing a SET as a parameter but at least we're on track with a trouble report.

https://forum.lazarus.freepascal.org/index.php?topic=54329.new;topicseen#new (https://forum.lazarus.freepascal.org/index.php?topic=54329.new;topicseen#new)

A true implementation of Write Once, Compile anywhere with the original code starting out as Delphi RAD Studio 10.3.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: geraldholdsworth on August 22, 2021, 06:30:56 pm
Thank you Otto for providing these Debs. They worked a treat on my RPi2, even though I already had Lazarus installed using the 'Official route' - it just overrode it.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: PasTimeProgrammer on October 21, 2021, 09:36:06 pm
Though the sophisticated ways to make lazarus run in the most recent version on Raspberry Pi are appreciated, there is also a simple way to use the 2.0.0-package available. Unfortunately the hints I found on the net were a little bit "hidden" ... Please find a description of the process which I have tested successfully with three different Raspian Buster installations:

If lazarus is already installed you should remove it again (it seems that it does not succeed otherwise)
   sudo apt remove lazarus               
   rm /home/pi/.lazarus -r
            
Make sure other libs are uptodate
   sudo apt update
   sudo apt upgrade

Now (re-)install the package as follows
   sudo apt install lazarus
After this is done change to the following directory
   cd /usr/lib/lazarus/2.0.0/components
And start "make" as superuser from there
   sudo make
Wait for the compilation to finish and start lazarus. The recompilation of the IDE should work now. Still no absolute guarantee but might be of use for one or the other ;-))
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: af0815 on October 22, 2021, 09:45:31 am
start make as superuser makes the thing complicated later.

Try it, open your Lazarus now (as normal pi-user) and recompile clean from Lazarus itself. Does it work and is Lazarus useable ? Then add apackage with OPN and recompile, does it work. If yes - congratulation.
Title: Re: Tutorial: Install Lazarus to Raspberry Pi
Post by: dbannon on October 22, 2021, 11:08:02 am
Yes, I definitely agree with af0815, do not run that last step.

Firstly, lazarus has some clever code that fixes things up when you try and rebuild the IDE and the variously libraries/components as a user but they exist in root space. In practice, it makes a complete copy in your home directory. So, at very best, that root build makes yet more unnecessary files up in root space, at worst, it could confuse Lazarus.

Second, it should not be necessary, running compiles as root is always undesirable. Just what problem are you trying to solve here ?

(and, as usual, I ask, why not build Lazarus from source ? Simple and you end up with all of Lazarus, any version, in user space right from the start.)

Davo
TinyPortal © 2005-2018