[SOLVED] libraries-not-found-errors when cross-compiling 32 bit GUI application lazarus / 1-Linux ---------------------------------------------------------------------- Hartmut · 2018-10-19 17:56 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: Code: [Select]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: Code: [Select]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: Code: [Select]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: Code: [Select]# 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 Code: [Select]sudo fpcmkcfg -d basepath=/usr/lib/fpc/\$fpcversion -o ./fpc.cfgbut 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): Code: [Select]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 as --32 $@ and save it as /usr/bin/i386-linux-as 3. Use a text editor type: #!/bin/bash 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 ---------------------------------------------------------------------- Cyrax · 2018-10-19 18:33 You need to use -Xd -Fl/usr/lib32 options. Add them end at fpc.cfg file. Quote#IFDEF LINUX   #IFDEF CPU32     -Fl/usr/lib32     -Xd   #ENDIF #ENDIF And you need to install 32-bit versions of GTK2 and other libraries. Also you (may) need recompile them with these options : -mstackrealign -mincoming-stack-boundary=2 due to ABI changes in 32-bit libraries. 32-bit FPC doesn't adhere to this ABI change. 64-bit FPC does not have this problem, it produces compatible ABI. See this bug report for more info : https://bugs.freepascal.org/view.php?id=33425 ---------------------------------------------------------------------- Hartmut · 2018-10-19 19:21 Thank you very much for you reply. I added the 5 lines to the end of fpc.cfg file. Quote from: Cyrax on October 19, 2018, 08:33:11 pmAnd you need to install 32-bit versions of GTK2 and other libraries. How do I install this? I searched Synaptic Package Manager for "gtk2" and found ca. 90 matches which have something with gtk2 in it's name, but nothing named "gtk2" and nothing which looked like 32 bit. Sorry for my question, I'm an absolute beginner on Linux and nearly everything is new to me... Quote... due to ABI changes in 32-bit libraries. 32-bit FPC doesn't adhere to this ABI change... I never heared ABI before. Do you mean https://en.wikipedia.org/wiki/Application_binary_interface ? QuoteSee this bug report for more info : https://bugs.freepascal.org/view.php?id=33425 I read this report but understood nearly nothing. What do you want me to say? Thanks again for your help. Or is cross-compiling a GUI application to difficult for a Linux beginner? ---------------------------------------------------------------------- Cyrax · 2018-10-19 20:54 Quote from: Hartmut on October 19, 2018, 09:21:40 pmThank you very much for you reply. I added the 5 lines to the end of fpc.cfg file. Quote from: Cyrax on October 19, 2018, 08:33:11 pmAnd you need to install 32-bit versions of GTK2 and other libraries. How do I install this? I searched Synaptic Package Manager for "gtk2" and found ca. 90 matches which have something with gtk2 in it's name, but nothing named "gtk2" and nothing which looked like 32 bit. Sorry for my question, I'm an absolute beginner on Linux and nearly everything is new to me... You need to consult Ubuntu wiki for how to enable 32-bit repositories and install 32-bit libraries from them. And in this case, how to rebuild your own packages. QuoteQuote... due to ABI changes in 32-bit libraries. 32-bit FPC doesn't adhere to this ABI change... I never heared ABI before. Do you mean https://en.wikipedia.org/wiki/Application_binary_interface ? Yes. QuoteQuoteSee this bug report for more info : https://bugs.freepascal.org/view.php?id=33425 I read this report but understood nearly nothing. What do you want me to say? Thanks again for your help. Or is cross-compiling a GUI application to difficult for a Linux beginner? Well, take this as an learning experience!  I would recommend using Linux Containers (LXC or Docker) to experiment on this, so you don't screw up your main OS. ---------------------------------------------------------------------- Hartmut · 2018-10-19 21:17 Thanks for your answers. Will follow them tomorrow (sounds difficult for me). Good night... ---------------------------------------------------------------------- Hartmut · 2018-10-20 13:42 I spent a lot of time with google'ing for "Ubuntu wiki gtk2 enable 32-bit repositories install 32-bit libraries", "Ubuntu wiki GTK2 32-bit 64-bit", "Ubuntu GTK2 32-bit download" and variants of these. I got a lot of material which was really hard to understand for me as a beginner. But I still don't know, what is my next step: must I "only" find, download and install a 32 bit version of GTK2? If yes, where can I find it?or must I download the sources of GTK2 and compile a 32 bit version by my own and place the result into the right destination folder? ---------------------------------------------------------------------- WayneSherman · 2018-10-21 00:37 Quote from: Hartmut on October 19, 2018, 07:56:37 pmI 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: Code: [Select]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 Using Lazarus 1.8.4/FPC 3.0.4 (stable/stable) I just did a test on Xubuntu 18.04 64-bit.  Compiling both 32-bit and 64-bit GUI programs was successful.  Although it compiled successfully, the 32-bit program did not run on Ubuntu 18.04 64-bit using the default installed packages.  But when I copied the 32-bit GUI program to another Linux system it worked. I started from a minimal Xubuntu 18.04 64-bit install, using fpcupdeluxe with these steps: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i sudo apt install -y libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libxtst-dev libatk1.0-dev libghc-x11-dev freeglut3 freeglut3-devsudo apt install -y git subversion make build-essential gdb zip unzip unrar wget # Download "fpcupdeluxe-x86_64-linux" from# https://github.com/newpascal/fpcupdeluxe/releases/tag/1.6.2c# Give execute permission to fpcupdeluxe-x86_64-linux and run it.# Select FPC stable and Lazarus stable and click "Install/update FPC+Laz".# After that completes select CPU "i386" and OS "linux" and "Install cross- compiler"  (** Select "yes" when missing tools message box appears **) # Run Lazarus from the desktop link created by fpcupdeluxe.# Create a new GUI project, do a test build for the default 64-bit target and run to make sure it works.# In Project Options, under Config and Target, change the Target CPU family to "i386".# Do another Run | Build and it should successfully build a 32-bit executable.# (you have to run this from a 32-bit Linux OS, or from a 64-bit OS with the proper libraries installed) ---------------------------------------------------------------------- Hartmut · 2018-10-21 14:18 Thanks a lot for your detailed answer. I also need to run the 32 bit program on my 64 bit Ubuntu. If I only can cross-compile 32 bit, but cannot run it, this makes no sense in my case. Sorry, that I did not mention that in my 1st question. Quote from: WayneSherman on October 21, 2018, 02:37:13 am# Do another Run | Build and it should successfully build a 32-bit executable. # (you have to run this from a 32-bit Linux OS, or from a 64-bit OS with the proper libraries installed) Please, which are "the proper libraries installed" which I need to run a 32 bit GUI program? Thanks again for your help. ---------------------------------------------------------------------- WayneSherman · 2018-10-21 21:07 Quote from: Hartmut on October 21, 2018, 04:18:00 pmI also need to run the 32 bit program on my 64 bit Ubuntu. ... Please, which are "the proper libraries installed" which I need to run a 32 bit GUI program? Ubuntu is built to use Debian Multiarch which allows installation of packages for multiple CPU architectures on the same OS.  Ubuntu 18.04 64-bit should already be configured for Multiarch and i386, but to confirm: #confirm i386 is added as a Multiarch architecture dpkg --print-foreign-architectures # it should print "i386". # If i386 architecture is missing, it can be added like this: sudo dpkg --add-architecture i386 sudo apt update apt can be used to install packages for alternate architectures by putting a suffix on the package. For example:  sudo apt install package-name:i386 Now you need to 1) find the dependencies, 2) find the packages which contain them, and 3) install the i386 version of those packages: 1) Find the dependencies of your executable #Use ldd and/or readelf to list dependencies for an executable.  Before ldd will work with 32-bit executables, you have to install 32-bit libc: sudo apt install libc6:i386 readelf -d /path/to/executable | grep NEEDED or ldd /path/to/executable gives this list: linux-gate.so.1 (0xf7f48000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7f2f000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7f10000) libgdk-x11-2.0.so.0 => not found libX11.so.6 => not found libgdk_pixbuf-2.0.so.0 => not found libgtk-x11-2.0.so.0 => not found libgobject-2.0.so.0 => not found libglib-2.0.so.0 => not found libgthread-2.0.so.0 => not found libgmodule-2.0.so.0 => not found libpango-1.0.so.0 => not found libcairo.so.2 => not found libatk-1.0.so.0 => not found libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7d32000) /lib/ld-linux.so.2 (0xf7f4a000) 2) Find the packages which contain the dependent files Use dpkg -S filename to search for the packages that contain the missing files.  That gives us this list: libgtk2.0-0 libx11-6 libgdk-pixbuf2.0-0 libglib2.0-0 libpango-1.0-0 libcairo2 libatk1.0-0 3) Install the i386 version of the missing packages sudo apt install libgtk2.0-0:i386 libx11-6:i386 libgdk- pixbuf2.0-0:i386 libglib2.0-0:i386 libpango-1.0-0:i386 libcairo2:i386 libatk1.0-0:i386 Now you should be able to run your 32-bit Lazarus GUI program on 64-bit Ubuntu. ---------------------------------------------------------------------- Hartmut · 2018-10-22 20:20 Hello WayneSherman, thank you so much for your detailed and valuable help. I could run fpcupdeluxe for both steps without any problems and without any errors. You gave me exactly the informations which I needed as a beginner to be successful. You are a great teacher. Compiling 64-bit works. Cross-compiling 32-bit gives me this error: Code: [Select]Compile Project, CPU: i386, Target: project2: Exit code 256, Errors: 1 /opt/lazarus_184/cross/lib/i386-linux//libresolv.so.2: undefined reference to `__res_maybe_init@GLIBC_PRIVATE' /usr/lib/i386-linux-gnu//libgio-2.0.so.0: undefined reference to `g_build_filename_valist' project2.lpr(20,1) Error: Error while linking But I must stop for tonight, will conntinue tomorrow trying to understand/solve this error, if I can. Will report then my result. Thank you very much again. ---------------------------------------------------------------------- WayneSherman · 2018-10-22 21:42 Quote from: Hartmut on October 22, 2018, 10:20:34 pmCode: [Select]Compile Project, CPU: i386, Target: project2: Exit code 256, Errors: 1 /opt/lazarus_184/cross/lib/i386-linux//libresolv.so.2: undefined reference to `__res_maybe_init@GLIBC_PRIVATE' /usr/lib/i386-linux-gnu//libgio-2.0.so.0: undefined reference to `g_build_filename_valist' project2.lpr(20,1) Error: Error while linking fpcupdeluxe installs lazarus and fpc into a directory isolated from other Lazarus/FPC installations. The default install directory is in your users home folder: /home/[user]/fpcupdeluxe Did you change the default installation location when you ran fpcupdeluxe? When you run Lazarus (the one fpcupdeluxe installed), the environment has to be setup to run from the correct folders and use the correct config files. Are you running Lazarus using the desktop link which fpcupdeluxe creates? Or, alternately running Lazarus using the launch script created in your home folder (~/Lazarus_fpcupdeluxe)? ---------------------------------------------------------------------- WayneSherman · 2018-10-22 22:52 I just tested it again and I am now getting "undefined reference" errors also.  Apparently after installing the i386 libraries, some library files are causing the linking to fail. Uninstalling the i386 libraries allows a Lazarus 32-bit minimal application to build again: sudo apt purge libgtk2.0-0:i386 libx11-6:i386 libgdk-pixbuf2.0-0:i386 libglib2.0-0:i386 libpango-1.0-0:i386 libcairo2:i386 libatk1.0-0:i386 sudo apt autoremove hmm... ---------------------------------------------------------------------- Hartmut · 2018-10-23 13:42 Quote from: WayneSherman on October 22, 2018, 11:42:12 pmDid you change the default installation location when you ran fpcupdeluxe? Yes, I changed it to /opt/lazarus_184/ and took ownership by "sudo chown -R hg6:hg6 /opt/lazarus_184". Hope this was the correct way. QuoteWhen you run Lazarus (the one fpcupdeluxe installed), the environment has to be setup to run from the correct folders and use the correct config files. Are you running Lazarus using the desktop link which fpcupdeluxe creates? Or, alternately running Lazarus using the launch script created in your home folder (~/Lazarus_fpcupdeluxe)? Yes, as you requested in your helpful introductions how to use fpcupdeluxe. Quote from: WayneSherman on October 23, 2018, 12:52:39 amUninstalling the i386 libraries allows a Lazarus 32-bit minimal application to build again: sudo apt purge libgtk2.0-0:i386 libx11-6:i386 libgdk-pixbuf2.0-0:i386 libglib2.0-0:i386 libpango-1.0-0:i386 libcairo2:i386 libatk1.0-0:i386 sudo apt autoremove I did above uninstalls and got then: Code: [Select]Compile Project, CPU: i386, Target: project2: Exit code 256, Errors: 1 Free Pascal Compiler version 3.0.4-r1:37121 [2018/10/22] for i386 Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Linux for i386 Compiling project2.lpr Compiling unit2.pas unit2.pas(18,28) Parameter "Sender" not used unit2.pas(19,28) Parameter "Sender" not used Compiling resource /home/hg6/lazarus_experimente/lib/i386-linux/project2.or /opt/lazarus_184/cross/bin/i386-linux/i386-linux-ld: warning: link.res contains output sections; did you forget -T? Linking project2 /opt/lazarus_184/cross/lib/i386-linux//libresolv.so.2: undefined reference to `__res_maybe_init@GLIBC_PRIVATE' project2.lpr(20,1) Error: Error while linking project2.lpr(20,1) Verbose: There were 1 errors compiling module, stopping I found a "workaround" for this error: Code: [Select]/opt/lazarus_184/cross/lib/i386-linux//libresolv.so.2: undefined reference to `__res_maybe_init@GLIBC_PRIVATE' After a lot of google'ing and some experiments I renamed file /opt/lazarus_184/cross/lib/i386-linux/libresolv.so.2 so that it can't be found. After that this error does not occur any longer. Now I searched my harddisk for all files beginning with libresolv.so and got: Code: [Select]date     time     size  path + filename --------------------------------------- 16.04.18 22:14:20    17 /lib/i386-linux-gnu/libresolv.so.2 18.08.18 17:25:59    17 /lib/x86_64-linux-gnu/libresolv.so.2 16.04.18 22:14:20    17 /lib32/libresolv.so.2 16.04.18 22:14:20    17 /libx32/libresolv.so.2 15.04.16 01:00:32 87876 /opt/lazarus_184/cross/lib/i386-linux/libresolv.so.2 15.01.18 05:19:52    17 /snap/core/5328/lib/i386-linux- gnu/libresolv.so.2 15.01.18 04:51:26    17 /snap/core/5328/lib/x86_64-linux- gnu/libresolv.so.2 15.01.18 05:19:52    17 /snap/core/5548/lib/i386-linux- gnu/libresolv.so.2 15.01.18 04:51:26    17 /snap/core/5548/lib/x86_64-linux- gnu/libresolv.so.2 15.01.18 05:19:52    17 /snap/core/5662/lib/i386-linux- gnu/libresolv.so.2 15.01.18 04:51:26    17 /snap/core/5662/lib/x86_64-linux- gnu/libresolv.so.2 15.01.18 05:19:52    17 /snap/wine-platform-i386/20/lib/i386-linux- gnu/libresolv.so.2 15.01.18 05:19:52    17 /snap/wine-platform-i386/22/lib/i386-linux- gnu/libresolv.so.2 15.01.18 05:19:52    17 /snap/wine-platform-i386/23/lib/i386-linux- gnu/libresolv.so.2 16.04.18 22:14:20    34 /usr/lib/i386-linux-gnu/libresolv.so 16.04.18 22:14:20    36 /usr/lib/x86_64-linux-gnu/libresolv.so 16.04.18 22:14:20    21 /usr/lib32/libresolv.so 16.04.18 22:14:20    22 /usr/libx32/libresolv.so You see, the file in /opt/lazarus_184/ is very old. Can this be the root cause, that fpcupdeluxe installs a library which is to old? Unfortunately I did not find a solution/workaround for the 2nd error: Code: [Select]/usr/lib/i386-linux-gnu//libgio-2.0.so.0: undefined reference to `g_build_filename_valist' Renaming of "/usr/lib/i386-linux-gnu//libgio-2.0.so.0" did not help. I searched my harddisk for all files beginning with libgio-2.0.so and got: Code: [Select]date     time        size  path + filename --------------------------------------- 10.04.16 22:52:52 1,865020 /opt/lazarus_184/cross/lib/i386-linux/libgio-2.0.so.0 31.07.18 07:41:43       22 /snap/core/5328/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0 31.07.18 07:42:26 1,599368 /snap/core/5328/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0.4800.2 18.09.18 14:07:14       22 /snap/core/5548/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0 18.09.18 14:07:45 1,599368 /snap/core/5548/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0.4800.2 18.09.18 14:07:14       22 /snap/core/5662/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0 18.09.18 14:07:45 1,599368 /snap/core/5662/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0.4800.2 29.03.18 15:34:30       22 /snap/gnome-3-26-1604/59/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 31.10.17 15:39:55 1,674264 /snap/gnome-3-26-1604/59/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0.5400.1 09.07.18 15:48:30       22 /snap/gnome-3-26-1604/70/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 09.07.18 15:48:36 1,686776 /snap/gnome-3-26-1604/70/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0.5600.1 09.07.18 15:48:30       22 /snap/gnome-3-26-1604/74/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 09.07.18 15:48:36 1,686776 /snap/gnome-3-26-1604/74/usr/lib/x86_64-linux- gnu/libgio-2.0.so.0.5600.1 18.09.18 14:13:14       22 /snap/wine- platform-i386/20/usr/lib/i386-linux-gnu/libgio-2.0.so.0 18.09.18 14:14:17 1,865020 /snap/wine- platform-i386/20/usr/lib/i386-linux-gnu/libgio-2.0.so.0.4800.2 18.09.18 14:13:14       22 /snap/wine- platform-i386/22/usr/lib/i386-linux-gnu/libgio-2.0.so.0 18.09.18 14:14:17 1,865020 /snap/wine- platform-i386/22/usr/lib/i386-linux-gnu/libgio-2.0.so.0.4800.2 18.09.18 14:13:14       22 /snap/wine- platform-i386/23/usr/lib/i386-linux-gnu/libgio-2.0.so.0 18.09.18 14:14:17 1,865020 /snap/wine- platform-i386/23/usr/lib/i386-linux-gnu/libgio-2.0.so.0.4800.2 17.09.18 14:52:54       22 /usr/lib/i386-linux-gnu/libgio-2.0.so.0 17.09.18 14:52:54 1,984508 /usr/lib/i386-linux- gnu/libgio-2.0.so.0.5600.2 17.09.18 14:52:54       22 /usr/lib/x86_64-linux-gnu/libgio-2.0.so 17.09.18 14:52:54       22 /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 17.09.18 14:52:54 1,690808 /usr/lib/x86_64-linux- gnu/libgio-2.0.so.0.5600.2 You see, that the file in /opt/lazarus_184/ is very old too, but it seems not beeing used and renaming it did not help. Maybe we have here also a version conflict? What can I do? ---------------------------------------------------------------------- Thaddy · 2018-10-23 13:47 No. The core of your problem is that you try a cross-compile from libraries that are actually installed. I'd recommend using a separate fpc.cfg and a completely separate directory structure independent from the installed OS that contains the libraries you need for cross-compilation. In this case the age of the file does not really matter (although fpcdeluxe uses more very old files, they are tested) ---------------------------------------------------------------------- DonAlfredo · 2018-10-23 14:21 You can try this. You can point fpcupdeluxe towards your own system 32bit library. In your case: /lib32 You can also point fpcupdeluxe towards your own system 32bit binary utilities. If you want to do this. In setup+ , you can choose your os and cpu in "Custom tools location ..." And enter your location where to find the bins and the libs. After setting these locations, you can build the cross-compiler again. I hope this will work. I do not test this setup very often. And yes, the libs provided by fpcupdeluxe are old. Out of all distro's available out there (in 2016), I had to make a single choice ... ;-) ---------------------------------------------------------------------- WayneSherman · 2018-10-23 14:43 Quote from: DonAlfredo on October 23, 2018, 04:21:40 pmYou can try this. You can point fpcupdeluxe towards your own system 32bit library. In your case: /lib32 Note that newer Ubuntu versions (since 12.04?) using Multiarch use different paths for 64-bit and 32-bit libraries. See here: https://wiki.ubuntu.com/MultiarchSpec On Ubuntu 18.04 I have: 64-bit Libraries: /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu 32-bit Libraries: /lib/i386-linux-gnu /usr/lib/i386-linux-gnu ---------------------------------------------------------------------- WayneSherman · 2018-10-23 14:52 Quote from: DonAlfredo on October 23, 2018, 04:21:40 pmYou can try this ... After setting these locations, you can build the cross-compiler again. Is it necessary to rebuild the cross-compiler, or can fpc.cfg be modified to point to the systems 32-bit libraries? I have these library paths in my fpcupdeluxe fpc.cfg file: Code: [Select]# path to the gcclib #ifdef cpui386 -Fl/usr/lib/gcc/x86_64-linux-gnu/7 #endif # searchpath for libraries -Fl/home/user/fpcupdeluxe2/fpc/lib/$FPCTARGET # library search path -Fl/usr/lib/$FPCTARGET;/usr/lib/$FPCTARGET- gnu;/lib/$FPCTARGET;/lib/$FPCTARGET-gnu;/usr/lib/gcc/x86_64-linux- gnu/7.3.0 ---------------------------------------------------------------------- DonAlfredo · 2018-10-23 15:01 Your fpc.cfg does not look like anything that has been generated by fpcupdeluxe ! You have now touched the limits of what fpcupdeluxe can do for you. In order to work under all these different conditions, fpcupdeluxe generates and maintains its own fpc.cfg for its own FPC. Naturally, changing these settings by hand is allowed, but can or will disturb fpcupdeluxe. Again, fpcupdeluxe can help you. But not under all conditions. Please stick to the instructions I wrote earlier. Point towards the libs, wherever they are. Point towards the bins, wherever they are. Run again. ---------------------------------------------------------------------- WayneSherman · 2018-10-23 15:22 Quote from: DonAlfredo on October 23, 2018, 05:01:01 pmYour fpc.cfg does not look like anything that has been generated by fpcupdeluxe ! I think those lines were taken directly from an unedited fpc.cfg.  Please stand-by, testing again... ---------------------------------------------------------------------- WayneSherman · 2018-10-23 16:57 Quote from: DonAlfredo on October 23, 2018, 05:01:01 pmYour fpc.cfg does not look like anything that has been generated by fpcupdeluxe ! Just confirmed, those fpc.cfg lines were created by fpcupdeluxe. I tested again: Code: [Select]#tested on Xubuntu 18.04 64-bit (starting from a minimal OS install) #install fpcupdeluxe dependencies sudo apt install -y libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libxtst-dev libatk1.0-dev libghc-x11-dev freeglut3 freeglut3-dev sudo apt install -y git subversion make build-essential gdb zip unzip unrar wget #install dependencies for a 32-bit executable built with Lazarus sudo apt install libgtk2.0-0:i386 libx11-6:i386 libgdk- pixbuf2.0-0:i386 libglib2.0-0:i386 libpango-1.0-0:i386 libcairo2:i386 libatk1.0-0:i386 #use latest fpcupdeluxe to build Laz/fpc stable/stable and crosscompiler i386/linux https://github.com/newpascal/fpcupdeluxe/releases/tag/1.6.2e #Open Lazarus and perform a "Clean up and Build" of a minimal application (empty form) with i386 target CPU #Errors:   Compile Project, CPU: i386, Target: project1: Exit code 256, Errors: 1   /lib/i386-linux-gnu//libmount.so.1: undefined reference to `getrandom@GLIBC_2.25'   /usr/lib/i386-linux-gnu//libgio-2.0.so.0: undefined reference to `g_build_filename_valist'   /lib/i386-linux-gnu//libbsd.so.0: undefined reference to `__explicit_bzero_chk@GLIBC_2.25'   project1.lpr(20,1) Error: Error while linking Then I uninstall the 32-bit libraries: Code: [Select]sudo apt purge libgtk2.0-0:i386 libx11-6:i386 libgdk- pixbuf2.0-0:i386 libglib2.0-0:i386 libpango-1.0-0:i386 libcairo2:i386 libatk1.0-0:i386 sudo apt autoremove Now doing a "Clean up and build" succeeds. Unmodified fpc.cfg from fpcupdeluxe is attached. ---------------------------------------------------------------------- Hartmut · 2018-10-23 17:43 Thanks a lot to all for your answers and that you want to help me. But I have difficulties to understand what you mean, because I'm an absolute beginner on Linux and on cross-compiling. Quote from: Thaddy on October 23, 2018, 03:47:25 pmI'd recommend using a separate fpc.cfg and a completely separate directory structure independent from the installed OS that contains the libraries you need for cross-compilation. I thought I did this by using fpcupdeluxe to create a separate Lazarus installation with its own fpc.cfg and its own library folder /cross/lib/i386-linux/ What else must I do? Quote from: DonAlfredo on October 23, 2018, 04:21:40 pmIn setup+ , you can choose your os and cpu in "Custom tools location ..." And enter your location where to find the bins and the libs. In setup+ , I first set "Search options" to custom and then enter the lib-Path in "Libraries" and the bin-Path in "Tools"? But which lib-Path must I use? You recommended /lib32, but WayneSherman wrote that they are in /lib/i386-linux-gnu and /usr/lib/i386-linux-gnu. What must I use? And which bin-Path must I use? I don't know it. Please, how can I find this out? Sorry, that for me things are very difficult because everything is new and unknown for me. Thanks again for your help. ---------------------------------------------------------------------- DonAlfredo · 2018-10-23 17:51 @Hartmut There is a separate forum thread about fpcupdeluxe http://forum.lazarus.freepascal.org/index.php/topic,34645.0.html It is best if you post fpcupdeluxe related questions there ! To answer your question. Fpcupdeluxe is a tool to help you install FPC and Lazarus if (but not limited to): 1) other methods fail. 2) you need something special like easy cross-compiling. In your case: just use the standard settings and let fpcupdeluxe do its thing. In most cases, this will work. If not, post your question with details. ---------------------------------------------------------------------- benohb · 2018-10-23 22:47 I think ..you  can not  install package libgtk2.0-dev:i386 and libgtk2.0-dev In the same device It is the hell of a conflict between packages ---------------------------------------------------------------------- WayneSherman · 2018-10-23 23:15 Quote from: benohb on October 24, 2018, 12:47:24 amI think ..you  can not  install package libgtk2.0-dev:i386 and libgtk2.0-dev In the same device It is the hell of a conflict between packages As far as I know, libgtk2.0-dev:i386 is not being installed, the non dev version is: libgtk2.0-0:i386 The idea of multiarch is that different directories are used for different CPU architectures: libgtk2.0-dev (64-bit) library files (.so and .a) get installed into /usr/lib/x86_64-linux-gnu/ https://packages.ubuntu.com/bionic/amd64/libgtk2.0-dev/filelist libgtk2.0-0:i386 library files (.so) get installed into /usr/lib/i386-linux-gnu/ https://packages.ubuntu.com/bionic/i386/libgtk2.0-0/filelist ---------------------------------------------------------------------- Hartmut · 2018-11-02 17:52 Quote from: DonAlfredo on October 23, 2018, 07:51:54 pmThere is a separate forum thread about fpcupdeluxe http://forum.lazarus.freepascal.org/index.php/topic,34645.0.html It is best if you post fpcupdeluxe related questions there ! This topic was continued (as requested by DonAlfredo) in https://forum .lazarus.freepascal.org/index.php/topic,34645.msg300126.html#msg300126 and was solved in https://forum.lazarus.freepascal.org/index.php/topic ,34645.msg301060.html#msg301060 Now I can cross-compile and run 32-bit programs on a 64-bit Ubuntu 18.04 with Lazarus 1.8.4. Thanks a lot again to all who helped me.