Compiling under Debian lazarus / 32-Linux ---------------------------------------------------------------------- andresayang · 2023-04-13 12:20 Hello, I'm using Debian 12 (testing), and I notice that If I compile under Debian 12 (or 11), binaries are not running under Debian 9 and 10. Is there any way to make binaries built on Debian 12 compatible with Debian 9 and 10 ? Thanks ---------------------------------------------------------------------- MarkMLl · 2023-04-13 12:40 Short answer: no. I raised this a few months ago and was sent away with a flea in my ear. MarkMLl ---------------------------------------------------------------------- andresayang · 2023-04-13 12:47 Mark, Thanks for answer. So I'll use Virtual machine with Debian 9 ... Cheers Do you know from where is coming this binary incompatibility ? (Well I need it for something else) ---------------------------------------------------------------------- Fred vS · 2023-04-13 12:52 To complete what Mark said, the main problem is the new libc.so library of Debian 12 that is not compatible with older release.T That libc.so library is needed at linking after compilation of your program. If you want make your program compatible with previous Debian release, compile it on a Debian version with a older libc.so. ---------------------------------------------------------------------- Чебурашка · 2023-04-13 12:52 Quote from: andresayang on April 13, 2023, 02:20:45 pmHello, I'm using Debian 12 (testing), and I notice that If I compile under Debian 12 (or 11), binaries are not running under Debian 9 and 10. Is there any way to make binaries built on Debian 12 compatible with Debian 9 and 10 ? Thanks One possibility is: 1. in your debian 12 computer create a folder say /opt/debian9 2. in your debian 12 computer create a debian 9 files tree in /opt/debian9 using debootstrap 3. in your debian 12 computer chroot into /opt/debian9 4. from within the chroot, install fpc for debian9 5. from within the chroot, compile the code using the compiler of debian9 6. from within the chroot, exit chroot 7. in your debian 12 computer, copy the resulting executable in your debian 9 machine and enjoy. ---------------------------------------------------------------------- andresayang · 2023-04-13 12:53 Quote from: Fred vS on April 13, 2023, 02:52:12 pmTo complete what Mark said, the main problem is the new libc.so library of Debian 12 that is not compatible with older release. If you want that you program is compatible with previous Debian release, compile it on a Debian version with a older libc.so. Thanks for info. Cheers @Чебурашка: thanks, I'll try ! ---------------------------------------------------------------------- Чебурашка · 2023-04-13 12:59 Quote from: Чебурашка on April 13, 2023, 02:52:40 pmQuote from: andresayang on April 13, 2023, 02:20:45 pmHello, I'm using Debian 12 (testing), and I notice that If I compile under Debian 12 (or 11), binaries are not running under Debian 9 and 10. Is there any way to make binaries built on Debian 12 compatible with Debian 9 and 10 ? Thanks One possibility is: 1. in your debian 12 computer create a folder say /opt/debian9 2. in your debian 12 computer create a debian 9 files tree in /opt/debian9 using debootstrap 3. in your debian 12 computer chroot into /opt/debian9 4. from within the chroot, install fpc for debian9 5. from within the chroot, compile the code using the compiler of debian9 6. from within the chroot, exit chroot 7. in your debian 12 computer, copy the resulting executable in your debian 9 machine and enjoy. This is something I need to cope with frequently, in my case I had to compile also on debian 6.0.10.  :'( Please be prepared... if you go back a lot of versions of the compier, you might have features of your code that weren't present (in my case the generics). ---------------------------------------------------------------------- Fred vS · 2023-04-13 13:05 Note that if you compile your code on a virtual machine with Debian 9 installed, the resulting executable, linked with the old libc.so, will be compatible with all newer Debian versions ( 10, 11, 12, ...) because libc.so is backward compatible (in theory  ). ---------------------------------------------------------------------- MarkMLl · 2023-04-13 13:12 Quote from: Fred vS on April 13, 2023, 02:52:12 pmTo complete what Mark said, the main problem is the new libc.so library of Debian 12 that is not compatible with older release. My response has just vanished (known rare forum issue) so I'm retyping while my memory's fresh. I've seen similar things on e.g. SPARC SunOS/Solaris, which turned out to be fixable via a minimally-documented compiler option. I'm unhappy about the situation, and even more unhappy about the developers' response that since I was running "Testing" it wasn't their problem if FPC was broken on it. It's dented my confidence in the project, and is one of the reasons why I'm spending much less time in the forum than I used to. I'd suggest that a Docker container would be more appropriate that a VM here: I'm able to run Debian as old as i386 "Lenny" (v5?) hosted on x86_64 "Bookworm" (v12) without significant issues. MarkMLl ---------------------------------------------------------------------- MarkMLl · 2023-04-13 13:17 Quote from: Чебурашка on April 13, 2023, 02:59:47 pmThis is something I need to cope with frequently, in my case I had to compile also on debian 6.0.10.  :'( Please be prepared... if you go back a lot of versions of the compier, you might have features of your code that wheren't present (in my case the generics). Yes, and it would be really nice if the documentation of a specific feature indicated when it had been introduced. Much as I loathe the syntax, I had cause to look at the low-level Python interface files a few months ago and they really were a model of what should be in system documentation. MarkMLl ---------------------------------------------------------------------- Fred vS · 2023-04-13 13:24 Quote from: Чебурашка on April 13, 2023, 02:59:47 pmThis is something I need to cope with frequently, in my case I had to compile also on debian 6.0.10.  :'( Please be prepared... if you go back a lot of versions of the compier, you might have features of your code that wheren't present (in my case the generics). Is it possible to install fpc 3.2.2. on Debian 6 and is it working (I never try this) ? ---------------------------------------------------------------------- Чебурашка · 2023-04-13 13:29 Quote from: Fred vS on April 13, 2023, 03:24:29 pmIs it possible to install fpc 3.2.2. on Debian 6 and is it working (I never try this) ? Maybe it is, I never tried so bold ventures. If I had to try I would use fpcupdeluxe for sure. ---------------------------------------------------------------------- MarkMLl · 2023-04-13 13:51 Quote from: Fred vS on April 13, 2023, 03:24:29 pmIs it possible to install fpc 3.2.2. on Debian 6 and is it working (I never try this) ? "Not knowing, can't say"... I can say however that I've got I've got 3.0.2 (with Lazarus 1.6.4) on "Lenny" (v5) plus a copies of 3.0.4 and 3.2.0  which I presumably wouldn't have left there if they were totally broken. So there's certainly a good chance that FPC 3.2.2 would work on v6, but not necessarily the matching version of Lazarus (because of widget set dependencies). MarkMLl ---------------------------------------------------------------------- TRon · 2023-04-13 14:25 Quote from: andresayang on April 13, 2023, 02:47:19 pmDo you know from where is coming this binary incompatibility ? (Well I need it for something else) Question asked at MarkMLI but see this thread. ---------------------------------------------------------------------- MarkMLl · 2023-04-13 15:10 Quote from: TRon on April 13, 2023, 04:25:41 pmQuote from: andresayang on April 13, 2023, 02:47:19 pmDo you know from where is coming this binary incompatibility ? (Well I need it for something else) Question asked at MarkMLI but see this thread. This thread: https://forum.lazarus.freepascal.org/index.php/topic,61001.0.html in which I see you were involved. Succinctly: QuoteI think the important thing is that if the host computer is Debian "Bookworm" x86_64, it's not possible to progress from 3.0 to 3.2. This build did work on older systems. ... Nobody is saying you need to fix 3.0.4. You need to find what in 3.2.x is being broken by the latest Debian. At which point I decided I had better things to do with my life. MarkMLl ---------------------------------------------------------------------- TRon · 2023-04-15 12:05 @MarkMLI: Thank you for mentioning that thread as I wanted to link to that one as well. Yeah, I feel your pain although I do understand. The issue mentioned here by TS is more a PITA than I want to admit. ---------------------------------------------------------------------- MarkMLl · 2023-04-15 13:15 I can assure you that after the length of time I've been using Pascal, Delphi and FPC/Lazarus that this is painful. It reminds me of the minor character in the Gormenghast Trilogy who suddenly realised that his life's work had been based on an invalid assumption. I'm not one to promote VMs and containers without good reason, but I think this is a good reason. I've been "playing" with Docker over the last couple of weeks and have got it to the point where I can even talk to some (but not necessarily all) USB-connected device programmers. MarkMLl ---------------------------------------------------------------------- Чебурашка · 2023-05-17 19:05 Quote from: andresayang on April 13, 2023, 02:20:45 pmHello, I'm using Debian 12 (testing), and I notice that If I compile under Debian 12 (or 11), binaries are not running under Debian 9 and 10. Is there any way to make binaries built on Debian 12 compatible with Debian 9 and 10 ? Thanks Still interested? Try give a look at https://forum.lazarus.freepascal.org/index.php/topic,63288.0.html ---------------------------------------------------------------------- ASBzone · 2023-05-17 23:54 Quote from: MarkMLl on April 13, 2023, 03:12:47 pmI'm unhappy about the situation, and even more unhappy about the developers' response that since I was running "Testing" it wasn't their problem if FPC was broken on it. It's dented my confidence in the project, and is one of the reasons why I'm spending much less time in the forum than I used to. Hey, Mark.  It seems that you understand this to be an FPC problem. If so, why? ---------------------------------------------------------------------- Чебурашка · 2023-05-18 06:43 Quote from: MarkMLl on April 13, 2023, 03:51:24 pmQuote from: Fred vS on April 13, 2023, 03:24:29 pmIs it possible to install fpc 3.2.2. on Debian 6 and is it working (I never try this) ? "Not knowing, can't say"... I can say however that I've got I've got 3.0.2 (with Lazarus 1.6.4) on "Lenny" (v5) plus a copies of 3.0.4 and 3.2.0  which I presumably wouldn't have left there if they were totally broken. So there's certainly a good chance that FPC 3.2.2 would work on v6, but not necessarily the matching version of Lazarus (because of widget set dependencies). MarkMLl Few bits more about the topic of installing recent fpc compilers on older debians from my recent experience: Goal: install fpc stable (3.2.2 at this time?) 1. debian 9 includes 3.0.0 by default and 3.0.4 as backport (see debain backports for information). Due to the presence of 3.0.4, using fpcupdeluxe, I was able to compile fcp 3.2.2 on debian 9.11, as 3.2.2 requires fpc at least 3.0.4 to be compiled (so just by pure chance I could do it) 2. debian 6 includes older compiler so I was not able to install 3.2.2 Due to the fact that I needed to run a program developed under deb 11 un these two older debs, I followed another path as explained here: https://forum.lazarus.freepascal.org/index.php/topic,63288.0.html For now I can say that everithing is working, but I am still monitoring the situation. The point is that I found nobody that can tell the ELF formats between deb 11, 9, 6 are interchangeable. In general it is known that the answer is no, but I found no info about a change during the transitions between 6 and 9 and after from 9 to 11. This morining while driving to work I was thinking about the possibility of stopping not before linking, but before assembling, so that also assembly is done on the specific machine. In this way the problem is moved to the assembly language compatibility. Stay tuned... ---------------------------------------------------------------------- TRon · 2023-05-18 07:43 Quote from: Чебурашка on May 18, 2023, 08:43:57 am2. debian 6 includes older compiler so I was not able to install 3.2.2 Which version would that be ? You should be able to download the pp 2.2.2 (the oldest version I was able to find there) executable (or newer) for your distro here. Then download the FPC sources in order to checkout the next version, taking into account that newer compilers build with previous dot release, compile them and work your way up. You might get into issues with binutils (from your distro, being too old) somewhere along the line though. ---------------------------------------------------------------------- TRon · 2023-05-19 10:27 It is even simpler than initially expected. 1. Download the 3.2.2 version of the compiler archive for linux (for 64 bit: https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/ fpc-3.2.2.x86_64-linux.tar/download or for 32 bit:  https://sourceforg e.net/projects/freepascal/files/Linux/3.2.2/fpc-3.2.2.i386- linux.tar/download) 2. Extract the archive 3. run the install script. I ran it using default options for everything and installing in user home dir. 4. optionally create an alias: alias fpc=/home/user/fpc-3.2.2/bin/fpc