Forum > Linux

Setting up cross compiler from linux-64 to linux-32,

(1/2) > >>

Prime:
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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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....


--- Quote ---DATE 2023/04/16
FPCTARGET i386
FPCTARGETCPU i386
FPCTARGETOS Linux
FPCVERSION 3.2.2

--- End quote ---

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 :


--- Quote ---Hint: (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

--- End quote ---

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:
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:
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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---#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: ---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

--- End code ---

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:
@Prime:
Where exactly is (or should be) your 32 bit version of libgtk located ?

Prime:

--- 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 ?

--- End quote ---

/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.

Navigation

[0] Message Index

[#] Next page

Go to full version