Greetings!
I am working on Kubuntu 13.10 (amd64) and currently trying to build a 32bit version of my fiddling with Lazarus. Here's what I have done so far:
Since Ubuntu does not allow parallel installation of fp-compiler-2.6.2 and fp-compiler-2.6.2:i386 (for whatever reason), I manually compiled an i386 version of fpc and installed it in /opt/fpc-i386. That seemed to work. At least I got no errors and I can call that ppc386 binary just fine.
Then I added these lines to my /etc/fpc.cfg:
#IFDEF CPUI386
-Fu/opt/fpc-i386/lib/fpc/2.6.2/units/i386-linux/
-Fu/opt/fpc-i386/lib/fpc/2.6.2/units/i386-linux/*
-Fu/opt/fpc-i386/lib/fpc/2.6.2/units/i386-linux/rtl
-Fl/opt/fpc-i386/lib/
-Fl/usr/libx32/
-FD/opt/fpc-i386/bin/
#ENDIF
I hope that's correct, I couldn't find any explicit instructions on that.
http://wiki.lazarus.freepascal.org/Cross_compiling just says you may have to edit the file but doesn't say in what way.
Now, when I try to build my project, I get this error message:
$ LC_ALL=C ~/lazarus/lazbuild --widgetset=qt --cpu=i386 --compiler=/opt/fpc-i386/lib/fpc/2.6.2/ppc386 foohelper.lpr
primary config path: /home/greyspammer/.lazarus
TCompiler.Compile WorkingDir="/home/greyspammer/devel/foo-helper/" CompilerFilename="/opt/fpc-i386/lib/fpc/2.6.2/ppc386" CompilerParams=" -MObjFPC -Scghi -O1 -Pi386 -g -gl -vewnhi -Filib/i386-linux -Fu../../lazarus/components/thtmlport/package/units/i386-linux -Fu../../lazarus/components/rxnew/lib/i386-linux -Fu../../lazarus/components/rx/lib/i386-linux -Fu../../lazarus/ideintf/units/i386-linux/qt -Fu../../lazarus/lcl/units/i386-linux/qt -Fu../../lazarus/lcl/units/i386-linux -Fu../../lazarus/components/lazutils/lib/i386-linux -Fu../../lazarus/packager/units/i386-linux -Fu. -FUlib/i386-linux/ -l -dLCL -dLCLqt foohelper.lpr"
[TCompiler.Compile] CmdLine="/opt/fpc-i386/lib/fpc/2.6.2/ppc386 -MObjFPC -Scghi -O1 -Pi386 -g -gl -vewnhi -Filib/i386-linux -Fu../../lazarus/components/thtmlport/package/units/i386-linux -Fu../../lazarus/components/rxnew/lib/i386-linux -Fu../../lazarus/components/rx/lib/i386-linux -Fu../../lazarus/ideintf/units/i386-linux/qt -Fu../../lazarus/lcl/units/i386-linux/qt -Fu../../lazarus/lcl/units/i386-linux -Fu../../lazarus/components/lazutils/lib/i386-linux -Fu../../lazarus/packager/units/i386-linux -Fu. -FUlib/i386-linux/ -l -dLCL -dLCLqt foohelper.lpr"
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.6.2 [2013/11/02] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling foohelper.lpr
foohelper.lpr(10,30) Hint: Unit "foodownloader" not used in foohelper
foohelper.lpr(10,52) Hint: Unit "downloadthread" not used in foohelper
foohelper.lpr(10,68) Hint: Unit "fooinstaller" not used in foohelper
Compiling resource lib/i386-linux/foohelper.or
Linking foohelper
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/crti.o when searching for /usr/lib/x86_64-linux-gnu/crti.o
/usr/bin/ld: cannot find /usr/lib/x86_64-linux-gnu/crti.o
foohelper.lpr(20,1) Error: Error while linking
foohelper.lpr(20,1) Fatal: There were 1 errors compiling module, stopping
ERROR: failed compiling of project /home/greyspammer/devel/foo-helper/foohelper.lpi
And, well, the compiler is both right and wrong. I understand that the x64 version of crti.o isn't of much use to it but there is a perfectly fine i386 version in /usr/libx32:
$ dpkg -S crti.o
libc6-dbg:amd64: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o
libc6-dev-i386: /usr/lib32/crti.o
libc6-dbg:i386: /usr/lib/debug/usr/lib/i386-linux-gnu/crti.o
libc6-dev:amd64: /usr/lib/x86_64-linux-gnu/crti.o
libc6-dev-x32: /usr/libx32/crti.o
It just does not use it. Despite the fact that I wrote the path in the fpc.cfg. Even if I call the compiler manually (copy & paste of the CmdLine above) and add "-Fl/usr/libx32", it still print the same error.
I assume I am doing something wrong but I cannot figure out what it is.