Difference between revisions of "Build current FPC and Lazarus for Raspberry Pi OS"
(First edits) |
(Almost done!) |
||
Line 17: | Line 17: | ||
# <code>mkdir ~/pascal</code> | # <code>mkdir ~/pascal</code> | ||
# <code>cd ~/pascal</code> | # <code>cd ~/pascal</code> | ||
− | # <code>svn | + | # <code>svn checkout <nowiki>https://github.com/fpc/FPCSource/tags/release_3_2_2</nowiki> fpc</code>, you have to be online for this and the next step to work. |
− | # <code> | + | # <code>git clone <nowiki>https://gitlab.com/freepascal.org/lazarus/lazarus</nowiki></code> |
− | # <code>cd lazarus/tools/install</code> | + | # <code>cd lazarus</code> |
+ | # <code>git checkout lazarus_2_2_0</code> | ||
+ | # <code>cd tools/install</code> | ||
# Edit <code>create_fpc_deb.sh</code>, look for line with the following content: <code>arm) ppcbin=arm; FPCArch=arm;;</code>, (currently line 109). Copy and paste this line below itself, so it will appear twice. Edit this copy to read like this: <code>armhf) ppcbin=arm; FPCArch=arm;;</code>. Now save the changes and exit. | # Edit <code>create_fpc_deb.sh</code>, look for line with the following content: <code>arm) ppcbin=arm; FPCArch=arm;;</code>, (currently line 109). Copy and paste this line below itself, so it will appear twice. Edit this copy to read like this: <code>armhf) ppcbin=arm; FPCArch=arm;;</code>. Now save the changes and exit. | ||
− | # Run the script: <code>./create_fpc_deb.sh fpc ~/pascal/fpc/</code>. This will compile the latest compiler | + | # Run the script: <code>./create_fpc_deb.sh fpc ~/pascal/fpc/</code>. This will compile the latest compiler using the compiler included with Bullseye. It takes about 11 minutes. A <code>.deb</code> file will be created: <code>fpc-laz_3.2.2-yymmdd_armhf.deb</code>; the exact name will be shown at the end of the compilation. |
− | + | # Uninstall Free Pascal compiler: <code>sudo apt purge fp-compiler && sudo apt --purge autoremove</code> | |
− | # Uninstall | + | # Install the just created FPC Debian package: <code>sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.2.2-yymmdd_armhf.deb</code>. Check if it works: <code>fpc abcd</code> should show the newly installed FPC compiler. |
− | # Install the just created FPC Debian package: <code>sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3. | ||
# <code>cd ~/pascal/lazarus/tools/install</code> | # <code>cd ~/pascal/lazarus/tools/install</code> | ||
− | # <code>./create_fpc_deb.sh fpc-src ~/pascal/fpc/</code>. This builds the FPC source package in about 3 minutes: <code>fpc-src_3. | + | # <code>./create_fpc_deb.sh fpc-src ~/pascal/fpc/</code>. This builds the FPC source package in about 3 minutes: <code>fpc-src_3.2.2-yymmdd_armhf.deb</code>. |
# Edit <code>create_lazarus_deb.sh</code>, look for line with the following content: <code>echo "$Arch is not supported."</code>, (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), replace <code>sparc</code> with <code>armhf</code>, and <code>ppcsparc</code> with <code>ppcarm</code>. Look for the first <code>fi</code> 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 another <code>if</code> to a nested <code>if</code>, with its corresponding <code>fi</code>. Now save and exit. | # Edit <code>create_lazarus_deb.sh</code>, look for line with the following content: <code>echo "$Arch is not supported."</code>, (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), replace <code>sparc</code> with <code>armhf</code>, and <code>ppcsparc</code> with <code>ppcarm</code>. Look for the first <code>fi</code> 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 another <code>if</code> to a nested <code>if</code>, with its corresponding <code>fi</code>. Now save and exit. | ||
− | # <code>./create_lazarus_deb.sh</code>. This will build the Lazarus IDE Debian package <code>lazarus-project_2.0 | + | # <code>./create_lazarus_deb.sh</code>. This will build the Lazarus IDE Debian package <code>lazarus-project_2.2.0-0_armhf.deb</code>. It will take about 15 minutes. |
− | # Install the FPC source and Lazarus packages: <code>sudo dpkg -i fpc-src_3. | + | # Install the FPC source and Lazarus packages: <code>sudo dpkg -i fpc-src_3.2.2-yymmdd_armhf.deb lazarus-project_2.2.0-0_armhf.deb</code> |
# Save <code>*.deb</code> to another location, to reinstall later if needed or to share with friends: remember this is free software. | # Save <code>*.deb</code> to another location, to reinstall later if needed or to share with friends: remember this is free software. | ||
# <code>cd</code>, <code>rm -rf ~/pascal ~/tmp</code> | # <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 | + | You can now finally enjoy your fully working, fully up to date Lazarus. Find it in the Programming section of the Raspberry menu. Now try to install a package, for example <code>lazreport</code>; it will work! |
Want to help the FPC/Lazarus community? Host the resulting <code>.deb</code> packages somewhere on the Internet and drop a note on the forum to let everyone know; rinse and repeat for every release. | Want to help the FPC/Lazarus community? Host the resulting <code>.deb</code> packages somewhere on the Internet and drop a note on the forum to let everyone know; rinse and repeat for every release. | ||
DISCLAIMER: these are UNOFFICIAL packages created from modified official sources. DO NOT ASK FOR SUPPORT ANYWHERE, neither on the forums or with the author of this article; use at your own risk. | DISCLAIMER: these are UNOFFICIAL packages created from modified official sources. DO NOT ASK FOR SUPPORT ANYWHERE, neither on the forums or with the author of this article; use at your own risk. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Install]] | [[Category:Install]] | ||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:Raspberry Pi]] | [[Category:Raspberry Pi]] |
Revision as of 07:57, 30 January 2022
│
English (en) │
Raspberry Pi OS Bullseye (based on Debian 11 Bullseye) 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/Raspberry Pi OS packages. One wishes there were official FPC/Lazarus packages for Raspberry Pi OS 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 Raspberry Pi OS. Example shows steps for Lazarus 2.2.0 which includes FPC 3.2.2, most recent at the time of writing. Adjust accordingly.
Requirements:
- Raspberry Pi 4 Model B, 4 GB (less memory models would require swap), with appropriate cooling (author uses aluminum case that doubles as heatsink) to avoid throttling due to excessive heat. Raspberry Pi 400 works too.
- Latest Raspberry Pi Bullseye fully updated
Steps:
- Install subversion:
sudo apt install subversion
- Install Free Pascal compiler:
sudo apt install fp-compiler
- 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 checkout https://github.com/fpc/FPCSource/tags/release_3_2_2 fpc
, you have to be online for this and the next step to work.git clone https://gitlab.com/freepascal.org/lazarus/lazarus
cd lazarus
git checkout lazarus_2_2_0
cd 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;;
. Now save the changes and exit. - Run the script:
./create_fpc_deb.sh fpc ~/pascal/fpc/
. This will compile the latest compiler using the compiler included with Bullseye. It takes about 11 minutes. A.deb
file will be created:fpc-laz_3.2.2-yymmdd_armhf.deb
; the exact name will be shown at the end of the compilation. - Uninstall Free Pascal compiler:
sudo apt purge fp-compiler && sudo apt --purge autoremove
- Install the just created FPC Debian package:
sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.2.2-yymmdd_armhf.deb
. Check if 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 3 minutes:fpc-src_3.2.2-yymmdd_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
. Now save and exit. ./create_lazarus_deb.sh
. This will build the Lazarus IDE Debian packagelazarus-project_2.2.0-0_armhf.deb
. It will take about 15 minutes.- Install the FPC source and Lazarus packages:
sudo dpkg -i fpc-src_3.2.2-yymmdd_armhf.deb lazarus-project_2.2.0-0_armhf.deb
- Save
*.deb
to another location, to reinstall later if needed or to share with friends: 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. Now try to install a package, for example lazreport
; it will work!
Want to help the FPC/Lazarus community? Host the resulting .deb
packages somewhere on the Internet and drop a note on the forum to let everyone know; rinse and repeat for every release.
DISCLAIMER: these are UNOFFICIAL packages created from modified official sources. DO NOT ASK FOR SUPPORT ANYWHERE, neither on the forums or with the author of this article; use at your own risk.