Recent

Author Topic: Tutorial: Install Lazarus to Raspberry Pi  (Read 45709 times)

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #60 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, 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, required for proper working of Lazarus.
3. increase your swap-space
4. download Lazarus 2.0.10 release source archive 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.
« Last Edit: July 13, 2020, 09:21:48 am by TRon »

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #61 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.

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #62 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 ;)

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #63 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).

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #64 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


rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #65 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.
« Last Edit: July 13, 2020, 11:00:49 am by rvk »

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #66 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 ;) )

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #67 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 ""

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #68 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"

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #69 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.


jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #70 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


jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #71 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?

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #72 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?

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #73 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.

jcdammeyer

  • Full Member
  • ***
  • Posts: 205
  • Embedded System Developer
    • Automation Artisans Inc.
Re: Tutorial: Install Lazarus to Raspberry Pi
« Reply #74 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.

« Last Edit: July 14, 2020, 12:05:12 am by jcdammeyer »

 

TinyPortal © 2005-2018