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)