Difference between revisions of "Build current FPC and Lazarus for Raspbian"
m |
m |
||
Line 32: | Line 32: | ||
# <code>./create_lazarus_deb.sh append-revision</code>. You are almost there; this will build the Lazarus IDE Debian package. It will take the longest time: 17 minutes, the last 7 with CPU throttling. In this example it results in a Debian package called <code>lazarus-project_2.0.4.61759-0_armhf.deb</code>. | # <code>./create_lazarus_deb.sh append-revision</code>. You are almost there; this will build the Lazarus IDE Debian package. It will take the longest time: 17 minutes, the last 7 with CPU throttling. In this example it results in a Debian package called <code>lazarus-project_2.0.4.61759-0_armhf.deb</code>. | ||
# Install the FPC source and Lazarus packages: <code>sudo dpkg -i fpc-src_3.0.4-190826_armhf.deb lazarus-project_2.0.4.61759-0_armhf.deb</code> | # Install the FPC source and Lazarus packages: <code>sudo dpkg -i fpc-src_3.0.4-190826_armhf.deb lazarus-project_2.0.4.61759-0_armhf.deb</code> | ||
+ | # Save <code>*.deb</code> to another location, to reinstall later if needed or to share with everyone: remember this is free software. | ||
+ | # <code>cd</code>, <code>rm -rf ~/pascal ~/tmp</code> | ||
+ | |||
+ | You can now finally enjoy your fully working, fully up to date Lazarus. Find it in the Programming section of the Raspberry menu. A message titled "Error in EditorMacroScript" will be shown on first run; this also appears in the Raspbian/Debian Lazarus, reason still unknown to the original author of this page. Now try to install a package, for example lazreport; it will work! |
Revision as of 07:12, 27 August 2019
Raspbian Buster (based on Debian 10 Buster) has FPC and Lazarus available in the repositories, but they suffer from the same "design decisions" that don't allow for a nice experience, namely the smooth IDE rebuilding capability based on source packages that is possible with FPC/Lazarus official .deb packages vs the crippled experience with the official Debian/Raspbian packages. One wishes there were official FPC/Lazarus packages for Raspbian as there are for Intel Debian/Ubuntu, which are also frequently updated; not being that the case (at least for now), this page shows the steps for building your own FPC, FPC-source and Lazarus packages for Raspbian. Example shows steps for Lazarus 2.0.4 which includes FPC 3.0.4, most recent at the time of writing. Adjust accordingly.
Requirements:
- Raspberry Pi 4 Model B, 4 GB (less memory models would require swap)
- Latest Raspbian Buster fully updated
Steps:
- Install subversion:
sudo apt install subversion
- Get bootstrap FPC compiler. The latest compiler is compiled with the previous version of itself.
- Extract compiler. This will create a
fpc-3.0.2.arm-linux
directory. - In this directory, as pi user, run
./install.sh
- At the four prompts, answer
Enter, n, n, n
: this is, accept suggested directory/home/pi/fpc-3.0.2
, no Textmode IDE, no documentation, no demos. Ignoretar
warnings. Note the additional files written to/home/pi
:.fpc.cfg
,.config/fppkg.cfg
,.fppkg/config/default
. When the build is done, to delete this temporary bootstrap compiler these files and the/home/pi/fpc-3.0.2
install directory need to be deleted. - Temporarily add FPC install directory to PATH:
export PATH=$PATH:$HOME/fpc-3.0.2/bin
. If you have to reboot for any reason before completing the FPC build, you have to do this step again. - Test if all ok:
fpc abcd
. This invokes the just installed compiler trying to compile a non-existent file (abcd). A multiline message will be shown including the compiler version. - Non-step note: the following steps are mostly based on this
- Install development libraries:
sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev
mkdir ~/pascal
cd ~/pascal
svn co https://svn.freepascal.org/svn/fpc/tags/release_3_0_4 fpc
, you have to be online for this and the next step to work.svn co https://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_4 lazarus
cd lazarus/tools/install
- Edit
create_fpc_deb.sh
, look for line with the following content:arm) ppcbin=arm; FPCArch=arm;;
, (currently line 109). Copy and paste this line below itself, so it will appear twice. Edit this copy to read like this:armhf) ppcbin=arm; FPCArch=arm;;
./create_fpc_deb.sh fpc ~/pascal/fpc/
. This will compile the latest compiler with the bootstrap compiler. It takes about 13 minutes; after the first 10 minutes the CPU starts throttling. A.deb
file will be created, in this example it ended up beingfpc-laz_3.0.4-190826_armhf.deb
; the exact name will be show at the end of the compilation.- You have completed the FPC build. Reboot the Pi to get rid of the temporary PATH.
- Uninstall the bootstrap FPC:
rm -rf ~/.fpc.cfg ~/.config/fppkg.cfg ~/.fppkg ~/fpc-3.0.2 ~/tmp
. Check what you just did:fpc abcd
should say command is not found. - Install the just created FPC Debian package:
sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.0.4-190826_armhf.deb
. Check it works:fpc abcd
should show the newly installed FPC compiler. cd ~/pascal/lazarus/tools/install
./create_fpc_deb.sh fpc-src ~/pascal/fpc/
. This builds the FPC source package in about 4 minutes. In this example it resulted in a package namedfpc-src_3.0.4-190826_armhf.deb
.- Edit
create_lazarus_deb.sh
, look for line with the following content:echo "$Arch is not supported."
, (currently line 86). Copy the 3 lines above it and paste them just below themselves: at this time it is copy lines 83 to 85 and paste them between lines 85 and 86. In the just pasted lines (lines 86-88), replacesparc
witharmhf
, andppcsparc
withppcarm
. Look for the firstfi
just below; copy and paste it below itself (copy line 91 below itself, so line 91 and 92 read the same). For you coders out there, you are adding anotherif
to a nestedif
, with its correspondingfi
. ./create_lazarus_deb.sh append-revision
. You are almost there; this will build the Lazarus IDE Debian package. It will take the longest time: 17 minutes, the last 7 with CPU throttling. In this example it results in a Debian package calledlazarus-project_2.0.4.61759-0_armhf.deb
.- Install the FPC source and Lazarus packages:
sudo dpkg -i fpc-src_3.0.4-190826_armhf.deb lazarus-project_2.0.4.61759-0_armhf.deb
- Save
*.deb
to another location, to reinstall later if needed or to share with everyone: remember this is free software. cd
,rm -rf ~/pascal ~/tmp
You can now finally enjoy your fully working, fully up to date Lazarus. Find it in the Programming section of the Raspberry menu. A message titled "Error in EditorMacroScript" will be shown on first run; this also appears in the Raspbian/Debian Lazarus, reason still unknown to the original author of this page. Now try to install a package, for example lazreport; it will work!