Difference between revisions of "Build current FPC and Lazarus for Raspbian/zh CN"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "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 exp...")
 
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
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.6 which includes FPC 3.0.4, most recent at the time of writing. Adjust accordingly.
+
{{Lazarus Documentation}}
 +
==为树莓派构建最新的 FPC Lazarus ==
  
Requirements:
+
Raspbian Buster (基于Debian 10 Buster),在存储库中有开用 FPC 和 Lazarus,但是它们也同样受害于"设计决策",不允许有一个好的体验,即,使用来自 FPC/Lazarus 官方.deb的源文件软件包来平滑地重新构建的IDE也是可能的,VS 官方 Debian/Raspbian 软件包的残废体验。有人希望 Raspbian 有官方版本的 FPC/Lazarus 软件包,就像有 Intel 版本 Debian/Ubuntu 一样,也经常更新;不像这样情况(至少现在是这样)。
  
* 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
+
这个页面展示了为 Raspbian 构建自己的 FPC,FPC 源文件软件包和Lazarus软件包的步骤。示例展示了构建 Lazarus 2.0.6 和其包含的 FPC 3.0.4 的步骤。在构建最新的版本时,相应的调整。
* Latest Raspbian Buster fully updated
 
  
Steps:
+
要求:
  
# Install subversion: <code>sudo apt install subversion</code>
+
* 树莓派 4 版本 B, 4 GB (更少的内存将需要swap),使用合适的冷却器 (作者使用双层铝外壳作为散热器)来避免因过热而阻碍性能。
# Get bootstrap [https://sourceforge.net/projects/freepascal/files/Linux/3.0.2/fpc-3.0.2.arm-linux-eabihf-raspberry.tar/download FPC compiler]. The latest compiler is compiled with the previous version of itself.
+
* 最新的 Raspbian Buster 完全的更新过。
# Extract compiler. This will create a <code>fpc-3.0.2.arm-linux</code> directory. (NOTE: this folder must be on a linux FS [like Documents folder] as FAT doesn't allow the next step to work).
+
 
# In this directory, as pi user, run <code>./install.sh</code>
+
步骤:
# At the four prompts, answer <code>Enter, n, n, n</code>: this is, accept suggested directory <code>/home/pi/fpc-3.0.2</code>, no Textmode IDE, no documentation, no demos. Ignore <code>tar</code> warnings. Note the additional files written to <code>/home/pi</code>: <code>.fpc.cfg</code>, <code>.config/fppkg.cfg</code>, <code>.fppkg/config/default</code>. When the build is done, to delete this temporary bootstrap compiler these files and the <code>/home/pi/fpc-3.0.2</code> install directory need to be deleted.
+
 
# Temporarily add FPC install directory to PATH: <code>export PATH=$PATH:$HOME/fpc-3.0.2/bin</code>. If you have to reboot for any reason before completing the FPC build, you have to do this step again.
+
# 安装 Subversion: <code>sudo apt install subversion</code>
# Test if all ok: <code>fpc abcd</code>. This invokes the just installed compiler trying to compile a non-existent file (abcd). A multiline message will be shown including the compiler version.
+
# 获取bootstrap [https://sourceforge.net/projects/freepascal/files/Linux/3.0.2/fpc-3.0.2.arm-linux-eabihf-raspberry.tar/download FPC 编译器]。最新版本的编译器是使用其先前版本的编译器来编译的。
# Non-step note: the following steps are mostly based on [https://wiki.lazarus.freepascal.org/How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository#Creating_the_deb_files_yourself this]
+
# 提取编译器。这将创建一个<code>fpc-3.0.2.arm-linux</code>目录。(注意:这个文件夹必需存在于一个 linux 文件系统上 [像文档文件夹] ,像 FAT 之类不允许接下来步骤的工作)
# Install development libraries: <code>sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev</code>
+
# 在这个目录中,pi 用户,运行<code>./install.sh</code>
 +
# 在四个提示处,回答<code>Enter, n, n, n</code>: 这是,接受建议的目录<code>/home/pi/fpc-3.0.2</code>,没有文本模式IDE,没有文档,没有示例。忽略<code>tar</code>警告。注意额外文件将被写入到<code>/home/pi</code>: <code>.fpc.cfg</code>, <code>.config/fppkg.cfg</code>, <code>.fppkg/config/default</code>中。当构建完成后,删除临时的bootstrap编译器,这些文件和 <code>/home/pi/fpc-3.0.2</code>安装目录需要被删除。
 +
#临时添加FPC安装目录到PATH: <code>export PATH=$PATH:$HOME/fpc-3.0.2/bin</code>。如果你在完成FPC构建之前由于任何原因必须重新启动,那么你必需再次执行此步骤。
 +
# 测试是否一切正常: <code>fpc abcd</code>。这将援引刚刚安装的编译器来尝试编译一个不存在的文件(abcd)。这将显示一条包含编译器版本的多行消息。
 +
# 非步骤注释:下面步骤主要基于 [https://wiki.lazarus.freepascal.org/How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository#Creating_the_deb_files_yourself 这个]
 +
# 安装开发库: <code>sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev</code>
 
# <code>mkdir ~/pascal</code>
 
# <code>mkdir ~/pascal</code>
 
# <code>cd ~/pascal</code>
 
# <code>cd ~/pascal</code>
# <code>svn co <nowiki>https://svn.freepascal.org/svn/fpc/tags/release_3_0_4</nowiki> fpc</code>, you have to be online for this and the next step to work.
+
# <code>svn co <nowiki>https://svn.freepascal.org/svn/fpc/tags/release_3_0_4</nowiki> fpc</code>,你必须联网才能完成这项工作和接下来的工作。
 
# <code>svn co <nowiki>https://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_6</nowiki> lazarus</code>
 
# <code>svn co <nowiki>https://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_6</nowiki> lazarus</code>
 
# <code>cd lazarus/tools/install</code>
 
# <code>cd lazarus/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.
+
# 编辑<code>create_fpc_deb.sh</code>,查找包含下面内容的行: <code>arm)    ppcbin=arm;  FPCArch=arm;;</code>, (当前行109). 在其下面复制和粘贴这行,因此它将出现两次。编辑复制的行如下: <code>armhf)  ppcbin=arm;  FPCArch=arm;;</code>. 现在保存更改和退出。
# Run the script: <code>./create_fpc_deb.sh fpc ~/pascal/fpc/</code>. This will compile the latest compiler with the bootstrap compiler. It takes about 11 minutes. A <code>.deb</code> file will be created: <code>fpc-laz_3.0.4-yymmdd_armhf.deb</code>; the exact name will be shown at the end of the compilation. Rename the file with (NOTE: do not type the brackets): mv [file name shown at end of compilation] <code>fpc-laz_3.0.4_armhf.deb</code>
+
# 运行脚本: <code>./create_fpc_deb.sh fpc ~/pascal/fpc/</code>。这将使用 bootstrap 编译器编译最新的编译器源文件。它将花费大约11分钟时间。将创建一个<code>.deb</code>文件:<code>fpc-laz_3.0.4-yymmdd_armhf.deb</code>;在编译结束时将显示准确的名称。重新命名文件,使用(注意:不要输入括号): mv [在编译结束时显示的文件名称] <code>fpc-laz_3.0.4_armhf.deb</code>
# You have completed the FPC build. Reboot the Pi to get rid of the temporary PATH.
+
# 你已经完成FPC构建。重启树莓派来摆脱临时路径。
# Uninstall the bootstrap FPC: <code>rm -rf ~/.fpc.cfg ~/.config/fppkg.cfg ~/.fppkg ~/fpc-3.0.2 ~/tmp</code>. Check what you just did: <code>fpc abcd</code> should say command is not found.
+
# 卸载 bootstrap FPC: <code>rm -rf ~/.fpc.cfg ~/.config/fppkg.cfg ~/.fppkg ~/fpc-3.0.2 ~/tmp</code>。检查你刚刚做了什么: <code>fpc abcd</code>应该说找不到命令。
# Install the just created FPC Debian package: <code>sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.0.4_armhf.deb</code>. Check if it works: <code>fpc abcd</code> should show the newly installed FPC compiler.
+
# 安装刚刚创建的 FPC Debian 软件包: <code>sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.0.4_armhf.deb</code>。检查它是否工作: <code>fpc abcd</code> 应该显示新安装的FPC编译器。
 
# <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.0.4-yymmdd_armhf.deb</code>. Rename with: mv <code>fpc-src_3.0.4-yymmdd_armhf.deb</code> <code>fpc-src_3.0.4_armhf.deb</code>
+
# <code>./create_fpc_deb.sh fpc-src ~/pascal/fpc/</code>. 这个将在大约3分钟时间内构建源文件软件包: <code>fpc-src_3.0.4-yymmdd_armhf.deb</code>。重新命名: mv <code>fpc-src_3.0.4-yymmdd_armhf.deb</code> <code>fpc-src_3.0.4_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.
+
# 编辑<code>create_lazarus_deb.sh</code>,查找包含以下内容的行: <code>echo "$Arch is not supported."</code>, (当前行 86)。复制上面3行,并在它们下面粘贴:此时,是复制行 83 85 ,并在行 85 和86 之间粘贴。在刚刚粘贴的行(86-88)中,替换<code>sparc</code><code>armhf</code>,替换<code>ppcsparc</code><code>ppcarm</code>。查找下面第一个 <code>fi</code> ;在其下面复制和粘贴(在行 91 下面复制和粘贴行 91 ,因此行 91 92 是相同的)。在这里对你编码员来说,你正在添加另一个 <code>if</code> 到一个嵌套的 <code>if</code> 中,与其对应的<code>fi</code>。现在保存并退出。
# <code>./create_lazarus_deb.sh</code>. This will build the Lazarus IDE Debian package <code>lazarus-project_2.0.6-0_armhf.deb</code>. It will take about 15 minutes.
+
# <code>./create_lazarus_deb.sh</code>。这将构建Lazarus IDE Debian软件包 <code>lazarus-project_2.0.6-0_armhf.deb</code>。它将花费大约需要15分钟。
# Install the FPC source and Lazarus packages: <code>sudo dpkg -i fpc-src_3.0.4_armhf.deb lazarus-project_2.0.6-0_armhf.deb</code>
+
# 安装FPC源文件和Lazarus软件包: <code>sudo dpkg -i fpc-src_3.0.4_armhf.deb lazarus-project_2.0.6-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.
+
# 保存<code>*.deb</code>到另一个位置,如果以后需要可重新安装或与朋友共享:请记住这是自由软件。
 
# <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. A message titled "Error in EditorMacroScript" will be shown on first run; this also appears in the Raspbian Lazarus, reason still unknown to the original author of this page. Now try to install a package, for example <code>lazreport</code>; it will work!
+
你现在终于可以享受你完整地工作了,完全更新到最新的 Lazarus 。在树莓派菜单中编程部分找到它。在第一次运行它时将显示一条标题 "Error in EditorMacroScript"信息;这个错误信息也出现在 Raspbian Lazarus 中,这个页面的原作者还不知道是什么原因。现在尝试安装一个软件包,例如:<code>lazreport</code>;它将工作!
  
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.
+
想帮助FPC/Lazarus社区?在互联网上的某个地方托管生产的 <code>.deb</code>软件包,并在论坛上留言来让每个人都知道; 为每个发布版本都重做软件包。
  
 
[[Category:Install]]
 
[[Category:Install]]
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:Raspberry Pi]]
 
[[Category:Raspberry Pi]]
 +
 +
== 贡献者和更改 ==
 +
* 简体中文版本由 robsean 于 2020-04-08 创建。

Latest revision as of 02:24, 9 May 2020

English (en) 中文(中国大陆)‎ (zh_CN)

为树莓派构建最新的 FPC 和 Lazarus

Raspbian Buster (基于Debian 10 Buster),在存储库中有开用 FPC 和 Lazarus,但是它们也同样受害于"设计决策",不允许有一个好的体验,即,使用来自 FPC/Lazarus 官方.deb的源文件软件包来平滑地重新构建的IDE也是可能的,VS 官方 Debian/Raspbian 软件包的残废体验。有人希望 Raspbian 有官方版本的 FPC/Lazarus 软件包,就像有 Intel 版本 Debian/Ubuntu 一样,也经常更新;不像这样情况(至少现在是这样)。

这个页面展示了为 Raspbian 构建自己的 FPC,FPC 源文件软件包和Lazarus软件包的步骤。示例展示了构建 Lazarus 2.0.6 和其包含的 FPC 3.0.4 的步骤。在构建最新的版本时,相应的调整。

要求:

  • 树莓派 4 版本 B, 4 GB (更少的内存将需要swap),使用合适的冷却器 (作者使用双层铝外壳作为散热器)来避免因过热而阻碍性能。
  • 最新的 Raspbian Buster 完全的更新过。

步骤:

  1. 安装 Subversion: sudo apt install subversion
  2. 获取bootstrap FPC 编译器。最新版本的编译器是使用其先前版本的编译器来编译的。
  3. 提取编译器。这将创建一个fpc-3.0.2.arm-linux目录。(注意:这个文件夹必需存在于一个 linux 文件系统上 [像文档文件夹] ,像 FAT 之类不允许接下来步骤的工作)。
  4. 在这个目录中,以 pi 用户,运行./install.sh
  5. 在四个提示处,回答Enter, n, n, n: 这是,接受建议的目录/home/pi/fpc-3.0.2,没有文本模式IDE,没有文档,没有示例。忽略tar警告。注意额外文件将被写入到/home/pi: .fpc.cfg, .config/fppkg.cfg, .fppkg/config/default中。当构建完成后,删除临时的bootstrap编译器,这些文件和 /home/pi/fpc-3.0.2安装目录需要被删除。
  6. 临时添加FPC安装目录到PATH: export PATH=$PATH:$HOME/fpc-3.0.2/bin。如果你在完成FPC构建之前由于任何原因必须重新启动,那么你必需再次执行此步骤。
  7. 测试是否一切正常: fpc abcd。这将援引刚刚安装的编译器来尝试编译一个不存在的文件(abcd)。这将显示一条包含编译器版本的多行消息。
  8. 非步骤注释:下面步骤主要基于 这个
  9. 安装开发库: sudo apt install libgtk2.0-dev libgpm-dev libncurses-dev
  10. mkdir ~/pascal
  11. cd ~/pascal
  12. svn co https://svn.freepascal.org/svn/fpc/tags/release_3_0_4 fpc,你必须联网才能完成这项工作和接下来的工作。
  13. svn co https://svn.freepascal.org/svn/lazarus/tags/lazarus_2_0_6 lazarus
  14. cd lazarus/tools/install
  15. 编辑create_fpc_deb.sh,查找包含下面内容的行: arm) ppcbin=arm; FPCArch=arm;;, (当前行109). 在其下面复制和粘贴这行,因此它将出现两次。编辑复制的行如下: armhf) ppcbin=arm; FPCArch=arm;;. 现在保存更改和退出。
  16. 运行脚本: ./create_fpc_deb.sh fpc ~/pascal/fpc/。这将使用 bootstrap 编译器编译最新的编译器源文件。它将花费大约11分钟时间。将创建一个.deb文件:fpc-laz_3.0.4-yymmdd_armhf.deb;在编译结束时将显示准确的名称。重新命名文件,使用(注意:不要输入括号): mv [在编译结束时显示的文件名称] fpc-laz_3.0.4_armhf.deb
  17. 你已经完成FPC构建。重启树莓派来摆脱临时路径。
  18. 卸载 bootstrap FPC: rm -rf ~/.fpc.cfg ~/.config/fppkg.cfg ~/.fppkg ~/fpc-3.0.2 ~/tmp。检查你刚刚做了什么: fpc abcd应该说找不到命令。
  19. 安装刚刚创建的 FPC Debian 软件包: sudo dpkg -i ~/pascal/lazarus/tools/install/fpc-laz_3.0.4_armhf.deb。检查它是否工作: fpc abcd 应该显示新安装的FPC编译器。
  20. cd ~/pascal/lazarus/tools/install
  21. ./create_fpc_deb.sh fpc-src ~/pascal/fpc/. 这个将在大约3分钟时间内构建源文件软件包: fpc-src_3.0.4-yymmdd_armhf.deb。重新命名: mv fpc-src_3.0.4-yymmdd_armhf.deb fpc-src_3.0.4_armhf.deb
  22. 编辑create_lazarus_deb.sh,查找包含以下内容的行: echo "$Arch is not supported.", (当前行 86)。复制上面3行,并在它们下面粘贴:此时,是复制行 83 到 85 ,并在行 85 和86 之间粘贴。在刚刚粘贴的行(行 86-88)中,替换sparcarmhf,替换ppcsparcppcarm。查找下面第一个 fi ;在其下面复制和粘贴(在行 91 下面复制和粘贴行 91 ,因此行 91 和 92 是相同的)。在这里对你编码员来说,你正在添加另一个 if 到一个嵌套的 if 中,与其对应的fi。现在保存并退出。
  23. ./create_lazarus_deb.sh。这将构建Lazarus IDE Debian软件包 lazarus-project_2.0.6-0_armhf.deb。它将花费大约需要15分钟。
  24. 安装FPC源文件和Lazarus软件包: sudo dpkg -i fpc-src_3.0.4_armhf.deb lazarus-project_2.0.6-0_armhf.deb
  25. 保存*.deb到另一个位置,如果以后需要可重新安装或与朋友共享:请记住这是自由软件。
  26. cd, rm -rf ~/pascal ~/tmp

你现在终于可以享受你完整地工作了,完全更新到最新的 Lazarus 。在树莓派菜单中编程部分找到它。在第一次运行它时将显示一条标题 "Error in EditorMacroScript"信息;这个错误信息也出现在 Raspbian Lazarus 中,这个页面的原作者还不知道是什么原因。现在尝试安装一个软件包,例如:lazreport;它将工作!

想帮助FPC/Lazarus社区?在互联网上的某个地方托管生产的 .deb软件包,并在论坛上留言来让每个人都知道; 为每个发布版本都重做软件包。

贡献者和更改

  • 简体中文版本由 robsean 于 2020-04-08 创建。