I have Lazarus 1.8.4 on Ubuntu 18.04 64 bit. Compiling a 64 bit GUI program or a 32 bit console program works. But compiling a 32 bit GUI program leeds to:
project1.lpr(20,1) Warning: "crti.o" not found, this will probably cause a linking failure
project1.lpr(20,1) Warning: "crtn.o" not found, this will probably cause a linking failure
project1.lpr(20,1) Error: Error while linking
I get this errors even if I create a new empty project via Menu Project / New Project / Application (see attached project).
I searched for this error in goggle and this forum and got a couple of matches, but the only solution I understand was to add a -Fl option to fpc.cfg.
But which path must I add?I searched my HD for this 2 files and found:
date time size path and file
---------------------------------
16.04.18 22:14 1216 /usr/lib/x86_64-linux-gnu/crti.o
16.04.18 22:14 648 /usr/lib/x86_64-linux-gnu/crtn.o
16.04.18 22:14 1084 /usr/lib32/crti.o
16.04.18 22:14 440 /usr/lib32/crtn.o
16.04.18 22:14 836 /usr/libx32/crti.o
16.04.18 22:14 440 /usr/libx32/crtn.o
I suppose from the name that the 1st path is 64 bit. From comparing /usr/lib32/ and /usr/libx32/ I suppose the last is 64 bit so I added "/usr/lib32/" in Lazarus to my Compiler Options / Path / Libraries (-Fl). Then I got:
Compile Project, CPU: i386, Target: /home/hg6/utis/project1: Exit code 256, Errors: 1
Linking /home/hg6/utis/project1
/usr/bin/ld: warning: /home/hg6/utis/link.res contains output sections; did you forget -T?
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so wird bei der Suche nach -lgdk-x11-2.0 übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.a wird bei der Suche nach -lgdk-x11-2.0 übersprungen
/usr/bin/ld: -lgdk-x11-2.0 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libX11.so wird bei der Suche nach -lX11 übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libX11.a wird bei der Suche nach -lX11 übersprungen
/usr/bin/ld: -lX11 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so wird bei der Suche nach -lgdk_pixbuf-2.0 übersprungen
/usr/bin/ld: -lgdk_pixbuf-2.0 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so wird bei der Suche nach -lgtk-x11-2.0 übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.a wird bei der Suche nach -lgtk-x11-2.0 übersprungen
/usr/bin/ld: -lgtk-x11-2.0 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgobject-2.0.so wird bei der Suche nach -lgobject-2.0 übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgobject-2.0.a wird bei der Suche nach -lgobject-2.0 übersprungen
/usr/bin/ld: -lgobject-2.0 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libglib-2.0.so wird bei der Suche nach -lglib-2.0 übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libglib-2.0.a wird bei der Suche nach -lglib-2.0 übersprungen
/usr/bin/ld: -lglib-2.0 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgthread-2.0.so wird bei der Suche nach -lgthread-2.0 übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgthread-2.0.a wird bei der Suche nach -lgthread-2.0 übersprungen
/usr/bin/ld: -lgthread-2.0 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgmodule-2.0.so wird bei der Suche nach -lgmodule-2.0 übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libgmodule-2.0.a wird bei der Suche nach -lgmodule-2.0 übersprungen
/usr/bin/ld: -lgmodule-2.0 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libpango-1.0.so wird bei der Suche nach -lpango-1.0 übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libpango-1.0.a wird bei der Suche nach -lpango-1.0 übersprungen
/usr/bin/ld: -lpango-1.0 kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libcairo.so wird bei der Suche nach -lcairo übersprungen
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libcairo.a wird bei der Suche nach -lcairo übersprungen
/usr/bin/ld: -lcairo kann nicht gefunden werden
/usr/bin/ld: inkompatibles //usr/lib/x86_64-linux-gnu/libatk-1.0.so wird bei der Suche nach -latk-1.0 übersprungen
/usr/bin/ld: -latk-1.0 kann nicht gefunden werden
project1.lpr(20,1) Error: Error while linking
Although I switched Lazarus to English, most messages are in German. Translated they mean:
incompatible xxx is skipped while searching for yyy
yyy cannot be found
I found my fpc.cfg (see attached) in /etc/. All places with "-Fl" are:
# path to the gcclib
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/7/32 <- path exists
#endif
#ifdef cpux86_64
-Fl/usr/lib/gcc/x86_64-linux-gnu/7 <- path exists
#endif
# searchpath for libraries
#-Fl/usr/lib/fpc/$fpcversion/lib
#-Fl/lib;/usr/lib
-Fl/usr/lib/fpc/$fpcversion/lib/$FPCTARGET <- path does NOT exist
I hoped to repair my fpc.cfg via Tool fpcmkcfg. In /etc/ I entered
sudo fpcmkcfg -d basepath=/usr/lib/fpc/\$fpcversion -o ./fpc.cfg
but this changed only 1 line with -FM option (see attached file) and I get the same error messages as before.
I'm a total beginner to Linux and to cross compiling. Any help is welcome.
Thanks a lot in advance.Here is how I installed Lazarus (according to
https://forum.lazarus.freepascal.org/index.php/topic,41524.0.html):
1) Uninstalled Lazarus, fpc-src, fpc
2) Installed fpc_3.0.4-3_amd64.deb using Gdebi
3) Installed fpc-src_3.0.4-2_amd64.deb using Gdebi
4) Restarted the computer
5) Disconnect the internet connection
6) Installed lazarus-project_1.8.4-0_amd64.deb using Gdebi
12) Did version locking on fpc and fpc-src using Muon Package Manager (having KDE-Plasma desktop)
Before this installation I tried different other installations, but then enabling of cross-compiling was not possible.
Here is how I enabled cross-compiling (according to
https://forum.lazarus.freepascal.org/index.php/topic,42364.0.html):
1. You need to install libc6-dev-i386 package
2. Use a text editor type: #!/bin/bash <newline> as --32 $@ and save it as /usr/bin/i386-linux-as
3. Use a text editor type: #!/bin/bash <newline> ld -A elf32-i386 $@ and save it as /usr/bin/i386-linux-ld
4. sudo chmod +x /usr/bin/i386-linux-as
5. sudo chmod +x /usr/bin/i386-linux-ld
6. cd /usr/share/fpcsrc/3.0.4
7. sudo make clean all CPU_TARGET=i386
8. sudo make crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=/usr
9. sudo ln -sf /usr/lib/fpc/3.0.4/ppcross386 /usr/bin/ppc386