Setting up cross compiler from linux-64 to linux-32, lazarus / 1-Linux ---------------------------------------------------------------------- Prime · 2023-04-16 16:43 Hi all, Lazarus x64-linux, 2.2.6, fpc 3.2.2. and in case it's significant I have Abbrevia, CEF4Delphi, DCPcrypt, Indy10 and ZeosDBO installed from the online package manager. OS : OpenSUSE tumbleweed. Lazarus & FPC where installed from the official rpms on sourceforge rather than the ones supplied by suse. I've been following the following page https://wiki.freepascal.org/Cross_compiling and have successfully managed to build the fpc cross compiler which compiles and builds the test program : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program test;begin  writeln('DATE ',{$i %DATE%});  writeln('FPCTARGET ',{$i %FPCTARGET%});  writeln('FPCTARGETCPU ',{$i %FPCTARGETCPU%});  writeln('FPCTARGETOS ',{$i %FPCTARGETOS%});  writeln('FPCVERSION ',{$i %FPCVERSION%});end.  This produces the following output.... QuoteDATE 2023/04/16 FPCTARGET i386 FPCTARGETCPU i386 FPCTARGETOS Linux FPCVERSION 3.2.2 So I then fire up the lazarus-ide and load up my current project, head into project options->config and target and set the Target CPU family to i386 and click ok. The problem is that when I click Run->Build the build stops almost immediately with : QuoteHint: (11030) Start of reading config file /etc/fpc.cfg Hint: (11031) End of reading config file /etc/fpc.cfg Free Pascal Compiler version 3.2.2 [2023/04/16] for i386 Copyright (c) 1993-2021 by Florian Klaempfl and others (1002) Target OS: Linux for i386 (3104) Compiling fcllaz.pas /usr/lib64/lazarus/packager/registration/fcllaz.pas(11,3) Fatal: (10022) Can't find unit db used by fcllaz Fatal: (1018) Compilation aborted Error: /usr/bin/ppcross386 returned an error exitcode Any idea what the problem is? I also tried manually compiling the LCL with "configure build lazarus" setting target os & target cpu to linux & i386, but that fails in the same way. Cheers. Phill. ---------------------------------------------------------------------- PeterBB · 2023-04-16 20:00 As a pure guess.... Probably need to compile the RTL for 32bit and/or make sure the fpc.cfg is pointing to these 32 bit libraries. Maybe do a recursive grep for db.o in /usr/lib to see what you have got there? ---------------------------------------------------------------------- Prime · 2023-05-07 19:34 Right with the aid of : https://forum.lazarus.freepascal.org/index.php/topic,55324.15.html I've been able to progress a little further. I needed to add some  lines to fpc.cfg to tell the compiler where to find the gcc libs and where to find the units, if the target CPU was i386 : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i #ifdef cpui386-Fl/usr/lib/gcc/x86_64-linux- gnu/13/32-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*#endif  Now the problem I am having is with fpc finding various libraries, I've been installing the 32bit versions of the needed libraries, which are installed in /usr/lib. However fpc doesn't seem to be able to find them, the SuSE packages install the following (for example libgtk) : Code: [Select]lrwxrwxrwx 1 root root      27 Mar 20 01:11 libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.2400.33 -rwxr-xr-x 1 root root 5323004 Mar 20 01:11 libgtk-x11-2.0.so.0.2400.33 Note no libgtk-x11-2.0.so. If I manually add a link with ln -s libgtk-x11-2.0.so.0.2400.33 libgtk-x11-2.0.so The fpc finds it without problems. I'll also post on the SuSE forum and see if this is expected behavior, if so is there a way of looking for the lib*.so.0 files for linking, as this seems to be what SuSe is creating by default? Cheers. Phill. ---------------------------------------------------------------------- TRon · 2023-05-07 21:46 @Prime: Where exactly is (or should be) your 32 bit version of libgtk located ? ---------------------------------------------------------------------- Prime · 2023-05-07 21:50 Quote from: TRon on May 07, 2023, 11:46:39 pm@Prime: Where exactly is (or should be) your 32 bit version of libgtk located ? /usr/lib That's what I'm saying the SuSE RPM only installs /usr/lib/libgtk-x11-2.0.so.0.2400.33, which is the real library file and /usr/lib/libgtk-x11-2.0.so.0, which is a softlink to it. Cheers. Phill. ---------------------------------------------------------------------- TRon · 2023-05-07 21:52 Quote from: Prime on May 07, 2023, 11:50:33 pmThat's what I'm saying the SuSE RPM only installs /usr/lib/libgtk-x11-2.0.so.0.2400.33, which is the real library file and /usr/lib/libgtk-x11-2.0.so.0, which is a softlink to it. Well, on a 64 bit system that would be your 64 bit version of the library , not the 32 bit one. Does SuSe use multiarch ? edit: ah., ok. I just read that suse uses lib dir for 32 bit libs and lib64 dir for 64 bit versions. Confusing as hell for me  link that explained that for me: https://www.pilotlogic.com/sitejoom/i ndex.php/100-wiki/technical/multiarch/398-multiarch-on-linux.html ---------------------------------------------------------------------- Prime · 2023-05-07 22:01 Quote from: TRon on May 07, 2023, 11:52:12 pmQuote from: Prime on May 07, 2023, 11:50:33 pmThat's what I'm saying the SuSE RPM only installs /usr/lib/libgtk-x11-2.0.so.0.2400.33, which is the real library file and /usr/lib/libgtk-x11-2.0.so.0, which is a softlink to it. Well, on a 64 bit system that would be your 64 bit version of the library , not the 32 bit one. Does SuSe use multiarch ? edit: ah., ok. I just read that suse uses lib dir for 32 bit libs and lib64 dir for 64 bit versions. Confusing as hell for me  link that explained that for me: https://www.pilotlogic.com/sitejoom/i ndex.php/100-wiki/technical/multiarch/398-multiarch-on-linux.html Yep can deffo confirm that by looking at the file list in YaST, 32 bit libs are in /usr/lib, 64 bit in /usr/lib64. Cheers. Phill. ---------------------------------------------------------------------- TRon · 2023-05-07 22:09 @Prime: Normally (I do not know about SuSe but assume it is the same) you would install the dev package of/for the library. ---------------------------------------------------------------------- marcov · 2023-05-08 08:57 Quote from: Prime on May 07, 2023, 09:34:33 pm Note no libgtk-x11-2.0.so. If I manually add a link with ln -s libgtk-x11-2.0.so.0.2400.33 libgtk-x11-2.0.so The fpc finds it without problems. I'll also post on the SuSE forum and see if this is expected behavior, if so is there a way of looking for the lib*.so.0 files for linking, as this seems to be what SuSe is creating by default? I haven't used SUSE in a decade, but in the past installing the corresponding -dev or -devel package that contained the header files for the lib and the symlink fixed that.