Installing Lazarus on Raspberry PI OS lazarus / 1-Linux ---------------------------------------------------------------------- RHollerich · 2020-08-27 16:25 Has any one had any luck getting the latest Lazarus source to compile on the newest Buster Raspberry PI OS for a PC (not the hardware)? If so, can you point me to the info to accomplish it? I downloaded fpc-3.2.0-x86_64-linux.tar, as well as the source tar, and lazarus-2.0.10-2.tar.gz. I have FPC installed and working, but any time I try to compile Lazarus, I keep getting all kinds of "skipping incompatible ..." errors. Note: I used the same Lazarus source tar and the fpc-3.2.0.arm-linux.tar file to install Free Pascal and compile Lazarus on the hardware without problems. But using the same process on the PC OS version isn't working.  Thanks for any help you can provide. ---------------------------------------------------------------------- af0815 · 2020-08-27 20:11 is fpcupdeluxe running in this enviroment ? It looks like a special Version of x86-64 buster, not more. look for the kernel running. ---------------------------------------------------------------------- lucamar · 2020-08-28 01:12 Most probably you need a cross-compiler to ARM. It's a little old and uses i386 as the starting compiler but see "Setup Cross Compile For ARM" for general instructions on how to do it. ---------------------------------------------------------------------- Rainbow6 · 2020-08-28 03:59 Try fpcupdeluxe - https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/ Download the versions fpcupdeluxe-arm-linux or fpcupdeluxe-armv6hf- linux - one of these should work. You don’t need to download a FPC package - fpcupdeluxe will fetch a bootstrap compiler and is compiling FPC and Lazarus from source - you can even select which SVN version you want to have. Maybe you have to install some libs or tools (like SVN) using apt - but no FPC or Lazarus packages. HTH ---------------------------------------------------------------------- TRon · 2020-08-28 04:21 Quote from: Rainbow6 on August 28, 2020, 05:59:04 amDownload the versions fpcupdeluxe-arm-linux or fpcupdeluxe-armv6hf-linux - one of these should work. Just a small question. How does that work on a x86 machine/Operating system ? TS never mentioned wanting to setup a cross-compiler, just a compiler. And yes, TS does write conflicting statements there. ---------------------------------------------------------------------- RHollerich · 2020-08-28 05:00 Thanks for the suggestions. I was able to get the latest FPC and Lazarus installed using fpcupdeluxe, but it did not turn out easy using it either. For those that mentioned I should use the "arm" versions, I rquested help installing on a PC running the latest Raspberry PI OS Desktop version which uses the PC processor, not the Arm processor used by the PI hardware. Using the command "uname -m", the PI OS on the PC said it was using "x86-64". Hence my attempt to install the x86-64 version of FPC which succeeded, but failed when compiling with Lazarus. Using the x86-64 version of fpcupdeluxe on a clean PC install of the Raspberry PI OS Desktop also failed with errors about missing files, even after installing all the dependencies needed by fpcupdeluxe. So, just to see what happened, I downloaded "fpcupdeluxe-i386-linux" and, lo and behold, it ran just fine and installed both FPC and Lazarus without any problems. So, either the Raspberry PI OS on my PC is reporting the wrong processor type, or the i386 version of fpcupdeluxe also works for the x86_64 processor. Maybe if I get the time, I will try manually installing the i386 Linux of FPC on my Pi Desktop and see if it compiles Lazarus. ---------------------------------------------------------------------- TRon · 2020-08-28 05:40 Quote from: RHollerich on August 28, 2020, 07:00:43 amUsing the command "uname -m", the PI OS on the PC said it was using "x86-64". Hence my attempt to install the x86-64 version of FPC which succeeded, but failed when compiling with Lazarus. "failed' is too little information. QuoteUsing the x86-64 version of fpcupdeluxe on a clean PC install of the Raspberry PI OS Desktop also failed with errors about missing files, even after installing all the dependencies needed by fpcupdeluxe. Again, too little information. QuoteSo, either the Raspberry PI OS on my PC is reporting the wrong processor type, or the i386 version of fpcupdeluxe also works for the x86_64 processor. It works for both. That is: 32-bit compiled programs are able run on on a 64-bit OS (not the other way around), provided that you have a 32-bit subsystem installed on your 64 bit OS. QuoteMaybe if I get the time, I will try manually installing the i386 Linux of FPC on my Pi Desktop and see if it compiles Lazarus. As said, as long as you have the 32-bit subsystem installed/setup correctly and have all the dependencies in place then that will work. ---------------------------------------------------------------------- Thaddy · 2020-08-28 05:57 How much memory has your Pi? You need a bigger swap file if it is only 1 GB. Make it at least 1 GB. After that you can build FPC 3.2.0 as well as Lazarus on the Rasberry Pi. I do that almost every day. A Raspberry Pi with 4 or 8GB does not need a larger swap file. ---------------------------------------------------------------------- rvk · 2020-08-28 07:21 Quote from: RHollerich on August 28, 2020, 07:00:43 amSo, either the Raspberry PI OS on my PC is reporting the wrong processor type, or the i386 version of fpcupdeluxe also works for the x86_64 processor. On https://www.raspberrypi.org/downloads/raspberry-pi-os/ you only see the 32 bit. Or are you using an experimental version? There is a 64 bit test version at https://www.raspberrypi.org/forums/viewtopic.php?t=275370 Rats... it's this one: https://www.raspberrypi.org/downloads/raspberry-pi-desktop/ Not sure if that one is 64 bit. Trying now. Which image did you use? I know FPC can fail to compile on Debian Intel 32 bit. Something about the binutils which you'll need another version for. ---------------------------------------------------------------------- PascalDragon · 2020-08-28 07:27 Quote from: Thaddy on August 28, 2020, 07:57:37 amHow much memory has your Pi? You need a bigger swap file if it is only 1 GB. Make it at least 1 GB. After that you can build FPC 3.2.0 as well as Lazarus on the Rasberry Pi. I do that almost every day. A Raspberry Pi with 4 or 8GB does not need a larger swap file. You did read the part where RHollerich said that they're using a x86-variant of the Raspberry Pi OS on x86 hardware? @RHollerich: as TRon said, it's not enough to say that it failed. What exactly failed? What where the errors? It could simply be that packages were missing if you managed to get x86_64 FPC running, but not Lazarus. ---------------------------------------------------------------------- rvk · 2020-08-28 07:55 I installed the Raspberry Pi OS for PC and it indeed states x86_64. The iso name is 2020-02-12-rpd-x86-buster.iso. (which could mean x86_32 and x86_64) But according to this the kernel matches the CPU (x86_64 in my case in Virtualbox) but the programs should be 32bit. https://www.raspberrypi.org/forums/viewtopic.php?t=220884#p1355424 QuoteKernel loaded will match the CPU either x86-32 or x86-64... ..though it is 32bit userland... So you can indeed try to install the 32 bit version of FPC and Lazarus and see if that works better. Edit: And indeed... using dpkg-query -l I see a lot of i386 packages installed. ---------------------------------------------------------------------- MarkMLl · 2020-08-28 09:09 Quote from: rvk on August 28, 2020, 09:55:51 amQuoteKernel loaded will match the CPU either x86-32 or x86-64... ..though it is 32bit userland... Ouch. So it's exactly the sort of split-architecture hack that the Debian SPARC port used, which the developers spent an enormous amount of effort on trying to get expunged. From the application POV, I'd expect it to be exactly equivalent to a standard Debian x86_64 (AMD64) with the multiarch package installed, which also implies 32-bit binutils etc. MarkMLl ---------------------------------------------------------------------- rvk · 2020-08-28 09:12 Quote from: MarkMLl on August 28, 2020, 11:09:53 amFrom the application POV, I'd expect it to be exactly equivalent to a standard Debian x86_64 (AMD64) with the multiarch package installed, which also implies 32-bit binutils etc. Code: [Select]pi@raspberry:~ $ uname -a Linux raspberry 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux pi@raspberry:~ $ dpkg-query -l | grep binutils ii  binutils                              2.31.1-16                         i386         GNU assembler, linker and binary utilities ii  binutils-common:i386                  2.31.1-16                         i386         Common files for the GNU assembler, linker and binary utilities ii  binutils-i686-linux-gnu               2.31.1-16                         i386         GNU binary utilities, for i686-linux-gnu target ii  libbinutils:i386                      2.31.1-16                         i386         GNU binary utilities (private shared library) The problem with binutils version 2.31 is that it doesn't compile FPC on 32 bit (always a Segmentation fault). https://bugs.freepascal.org/view.php?id=34475#c112412 So if you want FPC on Debian Buster 32 bit, you'll need to upgrade or downgrade binutils, which is a complete HELL. And you can't compile 64 bit on RPI OS Desktop for PC because build- essentials is installed for i386. And you can't add amd64 version because only one can be installed at the same time (I think). Code: [Select]pi@raspberry:~ $ dpkg-query -l | grep build-ess ii  build-essential                       12.6                              i386         Informational list of build-essential packages So the only way to install FPC/Lazarus on such machine would be the precompiled/prebuild ones. ---------------------------------------------------------------------- Thaddy · 2020-08-28 09:40 Quote from: rvk on August 28, 2020, 11:12:45 amThe problem with binutils version 2.31 is that it doesn't compile FPC on 32 bit (always a Segmentation fault). https://bugs.freepascal.org/view.php?id=34475#c112412 So the only way to install FPC/Lazarus on such machine would be the precompiled/prebuild ones. So why can I compile everything daily? I find that highly unlikely, since my Raspbian ld version is 2.31.1 and have no problems at all.... The only thing that is a bit different from standard Buster is that I added backports to the APT configuration. Maybe ld 231.1 comes from backports. ---------------------------------------------------------------------- rvk · 2020-08-28 09:49 Quote from: Thaddy on August 28, 2020, 11:40:40 amQuote from: rvk on August 28, 2020, 11:12:45 amThe problem with binutils version 2.31 is that it doesn't compile FPC on 32 bit (always a Segmentation fault). https://bugs.freepascal.org/view.php?id=34475#c112412 So the only way to install FPC/Lazarus on such machine would be the precompiled/prebuild ones. So why can I compile everything daily? The only thing that is a bit different from standard Buster is that I added backports to the APT configuration. I find that highly unlikely, since my Raspbian ld version is 2.31.1 and have no problems at all.... Sorry... Binutils 2.31 on 32 bit on Intel processors (i386/i686). Every Debian version I tried on i686/i386 (Debian itself and Buster) doesn't compile FPC. (You are probably using arm on Raspberry Pi itself, but this topic is about "Buster Raspberry PI OS for a PC") Quote from: RHollerich on August 27, 2020, 06:25:45 pmHas any one had any luck getting the latest Lazarus source to compile on the newest Buster Raspberry PI OS for a PC (not the hardware)? ---------------------------------------------------------------------- Thaddy · 2020-08-28 09:53 I also use Debian in a WSL2 config - only fpc331- . No problems at all. ---------------------------------------------------------------------- rvk · 2020-08-28 09:56 Quote from: Thaddy on August 28, 2020, 11:53:41 amI also use Debian in a WSL2 config - only fpc331- . No problems at all. 32 bit / i386 version? Is your binutils version i386? dpkg-query -l | grep binutils The Debian in the Microsoft Store for WSL is x86_64 (or are you on Windows 32 bit yourself ) Code: [Select]rik@XPS8500:~$ uname -a Linux XPS8500 4.4.0-18362-Microsoft #836-Microsoft Mon May 05 16:04:00 PST 2020 x86_64 GNU/Linux rik@XPS8500:~$ dpkg-query -l | grep binutils ii  binutils                      2.31.1-16                    amd64      GNU assembler, linker and binary utilities ii  binutils-common:amd64         2.31.1-16                    amd64      Common files for the GNU assembler, linker and binary utilities ii  binutils-x86-64-linux-gnu     2.31.1-16                    amd64      GNU binary utilities, for x86-64-linux-gnu target ii  libbinutils:amd64             2.31.1-16                    amd64      GNU binary utilities (private shared library) Like I said... only the i386 version of binutils 3.31.x gives trouble compiling FPC. ---------------------------------------------------------------------- MarkMLl · 2020-08-28 10:14 Quote from: Thaddy on August 28, 2020, 11:40:40 amI find that highly unlikely, since my Raspbian ld version is 2.31.1 and have no problems at all.... Are 2.31 and 2.31.1-something the same, or does that latter have the bug fixed? MarkMLl ---------------------------------------------------------------------- Thaddy · 2020-08-28 10:19 2.31.1 is indeed a bugfix release but rvk has 2.3.1. @rvk multi-arch works. But indeed I do not use 32 bit i386 anymore since a very long time. Will try with a VM ---------------------------------------------------------------------- rvk · 2020-08-28 10:38 Quote from: MarkMLl on August 28, 2020, 12:14:30 pmAre 2.31 and 2.31.1-something the same, or does that latter have the bug fixed? Debian Buster has binutils 2.31.1-16 as standard for all architectures. See https://packages.debian.org/buster/binutils And the bintuils 2.31.1-16 for i386 has the problem. https://bugs.freepascal.org/view.php?id=34475#c112412 Which isn't fixed because it's only the 2.31.x version on i386 which gives problems https://bugs.freepascal.org/view.php?id=34475#c119027 Newer version for bullseye and sid (2.35-2) will probably be fine (but I haven't tested that). ---------------------------------------------------------------------- Thaddy · 2020-08-28 10:47 In that case try adding backports to your APT config. It may pull a more recent version from testing. (IMO it is always a good idea to add backports anyway) ---------------------------------------------------------------------- rvk · 2020-08-28 11:11 Unfortunately no binutils in backport or sloppy. https://packages.debian.org/search?suite=buster- backports&keywords=binutils And going to bullseye would probably mean that a lot of dependencies would be installed (giving the dependency hell). Upgrading to full bullseye would then be easier (but probably not going to work with the raspberry pi os for PC). Release of bullseye stable would fix everything anyway, probably ---------------------------------------------------------------------- MarkMLl · 2020-08-28 12:52 If you're running on a PC I'd suggest investigating Docker: it's quite useful for this sort of thing. I've got an x86_64 system behind my desk, and I've set up various 64- and 32-bit containers with Debian going back as far as Lenny. MarkMLl ---------------------------------------------------------------------- rvk · 2020-08-28 12:58 I myself, use Virtualbox with Debian 64 bit for that. I never use Debian 32 bit anymore (even my servers run 64 bit now). But the original question from TS (RHollerich) was about Raspberry PI OS for PC so I investigated that because I remembered problems with Buster on i386 in Virtualbox in the past. Can you run Lazarus from Docker? (TS wanted to compile Lazarus) ---------------------------------------------------------------------- TRon · 2020-08-28 14:31 Quote from: rvk on August 28, 2020, 09:21:07 amRats... it's this one: https://www.raspberrypi.org/downloads/raspberry-pi-desktop/ Not sure if that one is 64 bit. Trying now. Thank you for testing and sharing your findings. Quote from: rvk on August 28, 2020, 09:55:51 amI installed the Raspberry Pi OS for PC and it indeed states x86_64. The iso name is 2020-02-12-rpd-x86-buster.iso. (which could mean x86_32 and x86_64) But according to this the kernel matches the CPU (x86_64 in my case in Virtualbox) but the programs should be 32bit. https://www.raspberrypi.org/forums/viewtopic.php?t=220884#p1355424 QuoteKernel loaded will match the CPU either x86-32 or x86-64... ..though it is 32bit userland...That is plain confusing (to me). Thanks for having figured that out, as I failed to try get that same information (without the need to install). ---------------------------------------------------------------------- RHollerich · 2020-08-28 15:45 For those that asked, I don't remember the exact error messages, but they all started with "Skipping incompatible" files of one sort or another. rvk is correct in that I am using the PC version of the Raspberry Pi Desktop found here https://www.raspberrypi.org/downloads/raspberry-pi- desktop/ I did try it and using the i386 version of fpc did work to compile the lazarus source without a problem. For anyone that is having the same problems as I did and want to know how I installed fpc-3.2-0 and Lazarus 2.0.10 on both types of hardware, here are my quick and simple notes that I saved for next time I need to do this. There may be better ways to do this, but this worked for me and was very simple to do. download    for Pi hardware       fpc-3.2.0.arm-linux.tar    For Pi Desktop (PC version)       fpc-3.2.0.i386-linux       note: do not use the x86_64 version    for both systems       fpc-3.2.0.source.tar.gz       lazarus-2.0.10-2.tar.gz ***** Free Pascal compiler install *******    un-compress both fpc compiler and source tar files into a directory. run install.sh from fpc directory and answer questions. add path to /home/pi/.profile (hidden file)    PATH="$HOME/[path to fpc folder]/bin:$PATH" *********** restart pc to update path ***************** **Lazarus install for PI hardware only - increase swapfile size.     edit /etc/dphys-swapfile with root and change "CONF_SWAPSIZE=100" to "CONF_SWAPSIZE=1024" un-compress lazarus tar file into a directory. install dependencies     sudo apt-get update     sudo apt-get install build-essential     sudo apt-get install gdb libx11-dev libgtk2.0-dev from lazarus folder    make clean    make bigide if using fcpupdeluxe to install fpc and lazarus, use fpcupdeluxe-i386-linux, not the x86-64 version ---------------------------------------------------------------------- MarkMLl · 2020-08-28 18:50 Quote from: rvk on August 28, 2020, 02:58:12 pmI myself, use Virtualbox with Debian 64 bit for that. I never use Debian 32 bit anymore (even my servers run 64 bit now). [You've obviously not tried compiling any of the more obscure Mozilla stuff recently :-/ QuoteCan you run Lazarus from Docker? (TS wanted to compile Lazarus) Yes, otherwise I'd not have suggested it. If you don't mind. Although in my case I usually cheat, by setting up an SSH server in the context of a Docker container at which point the Lazarus IDE (and much else) behaves exactly as though one were working between networked machines. MarkMLl ---------------------------------------------------------------------- rvk · 2020-08-28 19:47 Quote from: MarkMLl on August 28, 2020, 08:50:05 pmQuoteCan you run Lazarus from Docker? (TS wanted to compile Lazarus) Yes, otherwise I'd not have suggested it. Actually, I meant to ask this for docker under Windows (because you mentioned on a PC, not specifically under Linux). Of course I know docker under Linux van access the GUI of Linux. But I didn't think this was possible under Windows. ---------------------------------------------------------------------- MarkMLl · 2020-08-28 20:10 What are these Windows of which you speak? Good point, but all of my other comments in this thread have been specifically related to Debian and derivatives. MarkMLl