Dear all,
for several weeks I am searching an answer for a question which seems to be so simple that I cannot believe that the information is not out there in the net. Probably I am using the wrong search terms.
Okay: I am developing Windows software with lazarus/Freepascal for several years and now I have a program that should also be used with Linux. For Windows I create one exe file, which runs on Windows XP, 7, 8, 10 - no matter if 32 bit or 64 bit. The only dll my program needs (a driver for an USB device) is in the program directory.
I successfully modified the source code using compiler directives [{$IFDEF WINDOWS}, {$IFDEF UNIX}] and the program runs successfully on Linux (Debian 10, 32 bit). If I copy the executable file to another Linux system (Ubuntu 20, 64 Bit), it does not start. Using ldd I determined that the program has a load of dependencies to "/lib/i386-linux-gnu/*" and I assume these external dependecies are the reason why the program start fails. The error message is "error while loading shared libraries: libgdk-x11-2.0.so.0: cannot open shared object file: No such file or directory".
Question 1: Are there compiler settings to integrate all the libraries into the executable file like on Windows? I am aware of the fact that even the Windows executable has external dependencies but they are compatible for each Windows version since XP.
Question 2: The reason for the error message mentioned above might be, that on Linux 32 bit the library is located in ...
/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
... whereas the library on Linux 64 bit is located in ...
/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
But I have not hard coded the path to the library, so why isn't it found, although it's the same name and version?
Question 3: How can I build a portable app with Lazarus/Freepacal? I habe read the page "Deploying Your Application" several times, but I cannot figure out how this would help me (I do not want to creat official available packages). AppImage sounds like a cool thing, but I have not found any helpful information how to do this with a Lazarus/Freepascal executable ...
Thank you and greetings from Vienna,
Christian