{"id":281,"date":"2018-10-22T21:24:48","date_gmt":"2018-10-22T20:24:48","guid":{"rendered":"https:\/\/www.nerdlingen.de\/?p=281"},"modified":"2018-10-22T22:25:56","modified_gmt":"2018-10-22T21:25:56","slug":"freepascal-lazarus-on-the-raspberrypi-zero","status":"publish","type":"post","link":"https:\/\/www.nerdlingen.de\/?p=281","title":{"rendered":"Freepascal &#038; Lazarus on the RaspberryPi Zero"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Start with the Seed-Compiler from <a href=\"https:\/\/www.freepascal.org\/down\/arm\/linux-netherlands.var\">freepascal.org<\/a>. The currently active Version is 3.0.4. You can compile a newer version using this one later on, but it&#8217;s not necessary (currently).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;official&#8221; guides to install FPC + Lazaurs on Linux (and therefore the Raspberry Pi) are in the Wiki, for <a href=\"http:\/\/wiki.freepascal.org\/Installing_Lazarus#Installing_Lazarus_under_Linux\">Linux<\/a> and the <a href=\"http:\/\/wiki.freepascal.org\/Lazarus_on_Raspberry_Pi\">Raspberry Pi<\/a>. However, as IDE and compiler ar getting bigger, a little extra settings are required.<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Download, Extract and install:<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget ftp:\/\/freepascal.stack.nl\/pub\/mirrors\/fpc\/dist\/3.0.4\/arm-linux\/fpc-3.0.4.arm-linux-eabihf-raspberry.tar\ntar -xf fpc-3.0.4.arm-linux-eabihf-raspberry.tar\nsudo .\/fpc-3.0.4.arm-linux\/install.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Afterwards, you should have FreePascal available as text-mode, command line compiler:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pi@raspberrypi:~\/Download\/fpc-3.0.4.arm-linux $ fpc\nFree Pascal Compiler version 3.0.4 [2017\/10\/11] for arm\nCopyright (c) 1993-2017 by Florian Klaempfl and others<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, download Lazarus. You might create a new directory for this, and you will probably need to install subversion, too:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install subversion\nsvn co http:\/\/svn.freepascal.org\/svn\/lazarus\/branches\/fixes_1_8 fixes_1_8_5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To compile Lazarus, a <del>few<\/del> lot of dependencies are required, on a fresh install of Raspbian it&#8217;s something like<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install build-essential libgtk2.0-dev libgdk-pixbuf2.0-dev<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This little line pulls > 200MB to the Pi, which might take a while. Before we can start to compile the lot, we need to increase available swap-space on the pi. Otherwise, linking Lazarus 1.8 will fail on the Pi Zero at least.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo su -c 'echo \"CONF_SWAPSIZE=1024\" > \/etc\/dphys-swapfile'\nsudo dphys-swapfile setup\nsudo dphys-swapfile swapon<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then, building Lazarus is as simple as that (however, it might take 1 hour to complete&#8230;.):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make all\nsudo make install<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes, &#8220;make bigide&#8221; is recommended. It will almost certainly not work, and compile a lot of packages that you probably don&#8217;t need. You can then install Lazarus by invoking &#8220;sudo make install&#8221;, or start it using &#8220;startlazarus&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But: as we used the binary distribution of the compiler, Lazarus will not be able to find the compiler sources; specifically, those of the runtime library. You can probably ignore this; it&#8217;s better, however, to get those sources:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget ftp:\/\/freepascal.stack.nl\/pub\/mirrors\/fpc\/dist\/3.0.4\/source\/fpc-3.0.4.source.tar.gz\ntar -xf fpc-3.0.4.source.tar.gz\ncd fpc-3.0.4\nsudo make fpc_sourceinstall<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You might want to delete the extracted directory before starting Lazarus, to prevent it from finding this directory while searching for the Freepascal sources. If it does not find the directory on it&#8217;s own, you can point it to &#8220;\/usr\/local\/share\/src\/fpc-3.0.4\/fpc&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"749\" src=\"https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero.jpg\" alt=\"\" class=\"wp-image-284\" srcset=\"https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero.jpg 1017w, https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero-300x221.jpg 300w, https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero-768x566.jpg 768w, https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero-100x74.jpg 100w, https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero-150x110.jpg 150w, https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero-200x147.jpg 200w, https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero-450x331.jpg 450w, https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero-600x442.jpg 600w, https:\/\/www.nerdlingen.de\/wp-content\/uploads\/Lazarus_1_8_5_PiZero-900x663.jpg 900w\" sizes=\"auto, (max-width: 1017px) 100vw, 1017px\" \/><figcaption>Version 1.8.5 of Lazarus running in XRDP with the Raspbian Pixel desktop on a Raspberry Pi zero.<\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Other variants:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">An older version of FPC and Lazarus is allways available in the standard packages of your system. Also, <a href=\"http:\/\/wiki.freepascal.org\/fpcupdeluxe\">fpxdeluxe<\/a> does a very goot job in pulling and installing FPC and Lazarus of any desired revision; however, the armhf6 Version required for the Raspberry Pi Zero (and A&#8230;) does not currently work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Start with the Seed-Compiler from freepascal.org. The currently active Version is 3.0.4. You can compile a newer version using this one later on, but it&#8217;s not necessary (currently). The &#8220;official&#8221; guides to install FPC + Lazaurs on Linux (and therefore &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.nerdlingen.de\/?p=281\"> <span class=\"screen-reader-text\">Freepascal &#038; Lazarus on the RaspberryPi Zero<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-281","post","type-post","status-publish","format-standard","hentry","category-english","category-software"],"_links":{"self":[{"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/posts\/281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=281"}],"version-history":[{"count":3,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions"}],"predecessor-version":[{"id":285,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions\/285"}],"wp:attachment":[{"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nerdlingen.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}