[CLOSED] Build app with all dependent library lazarus / 32-Linux ---------------------------------------------------------------------- incendio · 2024-06-20 02:22 Hi guys, I thought Lazarus build app with all dependent library, but I was wrong. My app didn't run on Ubuntu Server 20 because of missing glib library. There is an article in this forum to address this issue, but it is to advance for me and this Ubuntu Server is a live server, so I am afraid  to mess around if not sure it will work. If there an option in Lazarus 2.2.6 Linux to build app with all dependent library? ---------------------------------------------------------------------- MarkMLl · 2024-06-20 06:00 How on Earth can Lazarus build something related to glib from scratch? It's a completely different project and has to be installed with elevated privilege. Also the recent thread was specifically about an /unexpected/ version of glib. As I said in that discussion, the issue is that the link stage resolves all symlinks, so if the underlying .so is named differently (through being a different version) you'll have problems. I also gave a list of suggested solutions, which I suggest you read. MarkMLl ---------------------------------------------------------------------- incendio · 2024-06-20 06:17 First, I don't know how big is glib, my knowledge of Linux is limited. Also, it was depend on other library, forgot to wrote the library mentioned in the error message. Is this glib related with gui? Perhaps I can create non gui app to deal with this dependency. ---------------------------------------------------------------------- MarkMLl · 2024-06-20 06:41 Quote from: incendio on June 20, 2024, 08:17:00 amIs this glib related with gui? Perhaps I can create non gui app to deal with this dependency. It is the fundamental library required by just about everything. Look, I can't say I'm happy with the way things are, but it's been put to my by the developers that the mantra is "Write once, compile anywhere". Not "Compile once, run anywhere". You CANNOT rely on something which is compiled on system A being runnable on system B, unless you distribute it as some sort of containerised or VM image. I went into more detail in the other thread, and plenty has been written elsewhere on Linux administration. MarkMLl ---------------------------------------------------------------------- robert rozee · 2024-06-20 09:32 hi incendio,     assuming the problem you are encountering relates to the console error message /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found the simplest solution is to install Lazarus/FPC using the FPCUpdeluxe application found here: https://github.com/LongDirtyAnimAlf/fpcupdeluxe with the appropriate settings selected in FPCUpdeluxe to enable symbol name/version translation. i have not done this myself (i use other methods), but have every confidence that it should work. with Lazarus/FPC appropriately installed using FPCUpdeluxe, generated executable files will then run on older Linux distros without this issue. it would perhaps be helpful if someone could post a walk- through on how to do the installation. TRon? (oops, my mistake, DonAlfredo is the FPCUpdeluxe author) a simplified background: the GLIBC authors intended that every call to a GLIBC function should specify both a function name and a version number, with the two separated with an "@" symbol. for example, "dlopen@GLIBC_2.2.5" specifies the function dlopen that was first introduced with GLIBC_2.2.5 (version 2.2.5 of GLIBC). this scheme allowed for new versions of a function to be added over time without breaking backward compatibility; when new versions of a function were deployed, old version(s) would always be kept available within GLIBC. the GLIBC developers have assured me that once a function/version combination is introduced it will never be removed for the life of the target system (for us this is linux on i386 or AMD64). the fundamental problem arose when the Lazarus authors decided it would be a good idea to leave out the version numbers from all their source code. this 'kinda worked', in that when an executable was created the linker (which is neither a part of GLIBC nor FPC) would automatically append version numbers to GLIBC function names, using the latest it could find on the computer that was building said executable. as far as i have been able to determine, the linker's choice to always use the latest rather than the oldest version seems to be arbitrary. in the case of dlopen there are at least two version of the function: dlopen@GLIBC_2.2.5 dlopen@GLIBC_2.34 when the Lazarus libraries that use dlopen were written, only the 2.2.5 version existed. but then in recent years a newer version of dlopen, 2.34, has been added to GLIBC. the Lazarus libraries know nothing of the 2.34 version, but nonetheless end up being linked to it. purely by good fortune, the 2.34 version of dlopen is functionally compatible with the 2.2.5 version. the same applies to dozens of other functions in GLIBC, and there is no guarantee going forward that an incompatible version of some existing function will never be introduced; if this happens, Lazarus will break. cheers, rob   :-) ---------------------------------------------------------------------- DonAlfredo · 2024-06-20 09:56 As a sidenote. I have disabled the possibility/feature of fpcupdeluxe to allow versioned linking against glibc. It was a compiler hack. And not a very elegant one. Also, I heard a rumor that one of the core developers of FPC is trying to implement a similar feature. So, I hope this rumor will become true. However, when cross-compiling towards Linux, a lot of libraries (versions) are available online. Just pick a suitable (old) one and you should be good to go on any (newer) Linux system. https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/crosslibs _all ---------------------------------------------------------------------- dbannon · 2024-06-20 10:17 incendio, I regularly release my application, tomboy-ng and it runs on all sorts of systems ! My approach is that I keep a Ubuntu 20.04 virtual machine handy and the final build prior to a release is always done on it. The resulting binaries will run, eg, on anything from ubuntu 16.04 through to Ubuntu 24.04 The issue is that some time in 2021, changes were made in glibc such that binaries built on the new version would not run on older systems. U20.04 was the last LTS Ubuntu to be able to make a binary that will run on U20.04 or earlier. Your "Ubuntu Server 20" is, I take it, U20.04 ?  Probably time you updated it but thats another issue. If you had built your binary there, it would be all good ! Install Virtual Box on your workstation, make a 25G VM and install U20.04, bring it up to date and use it only for release builds. Has other quality benefits too. Davo ---------------------------------------------------------------------- incendio · 2024-06-21 03:03 Hi guys, Before I try all your suggestions, I created an VM of Ubuntu server 22.04 and tried to run my app, and got another error of lib dependency. On Ubuntu 20.04, error on glib, on Ubuntu 22.04 error on libgdk-x11-2.0.so.0. Even on the latest ubuntu server, this app couldn't run. Just to make sure, do you know if gui App can run on Ubuntu Server? ---------------------------------------------------------------------- TRon · 2024-06-21 03:32 Quote from: incendio on June 21, 2024, 05:03:29 amOn Ubuntu 20.04, error on glib, on Ubuntu 22.04 error on libgdk-x11-2.0.so.0. Even on the latest ubuntu server, this app couldn't run. See tip about deploying applications and dependencies Quoteust to make sure, do you know if gui App can run on Ubuntu Server? Does ubuntu server come with x installed ? edit: added link to wikipedia article x to make sure as TS stated to have limited Linux knowledge. ---------------------------------------------------------------------- Thaddy · 2024-06-21 04:45 Quote from: TRon on June 21, 2024, 05:32:26 amDoes ubuntu server come with x installed ? No, but it can of course be installed manually. Servers generally do not have GUI software installed, although X has also other purposes. The good news - and bad news for the sysop -is that if you install fpc from the default repository, X will be installed as a dependency. On Ubuntu 22 or higher it will be fpc 3.2.2 along with a whole host of other dependencies. Sysop's don't like that. For that reason it is also important  to ask the sysop/sysadmin if it is allowed to run GUI software on the server directly instead of on a controlling client. The answer is often NO. As a side note: Ubuntu does not always play nice and defaults to Wayland as Window manager which has some problems - paint issues - with some software, not only software written in Freepascal.(e.g. Geany has the same problems as Handoko multiple times described) ---------------------------------------------------------------------- incendio · 2024-06-21 04:58 I am pretty sure that this Ubuntu Server doesn't come with X installed, and won't be installed either. The server is a firebird database server. My app is a small utility to backup and restore database for dummies users. I came up with an idea, please suggest me if this is do able. Instead of doing some troublesome to make my app runs on Ubuntu, I will make my app runs on Windows and do a remote backup/restore via Windows to Ubuntu Server. Is this possible? ---------------------------------------------------------------------- Thaddy · 2024-06-21 05:04 If you read my reply carefully you would know: Write client software to control the server through another computer. The server part does not need a GUI, just the client. It should be quite easy to instruct the firebird database on the server to do a back-up through a client on a different computer. This is usually how it is done anyway. It is the core architecture of servers. I am not that familiar with Firebird, but it should be one very simple SQL statement to create a back-up. For software that performs such operations from a client I usually issue task specific certificates so only people/machines that have the appropiate certificate can actually perform the back-up. It is also a good idea to choose a different port from the default. ---------------------------------------------------------------------- TRon · 2024-06-21 05:15 Quote from: incendio on June 21, 2024, 06:58:15 amI am pretty sure that this Ubuntu Server doesn't come with X installed, and won't be installed either. That is fair enough but without X (or any other graphics layer) how do you expect a Lazarus GUI program compiled against GTK to be able to run /on that server/ ? QuoteI came up with an idea, please suggest me if this is do able. Ofc that is do-able but without a graphical shell you can't run a GUI app /on/ the server itself. It would be the same as you would try and run any other GUI application (such as for example gimp or VLC) If we would translate that somewhat to Windows terminology: if you run MS-DOS would you expect that be to be able to run f.e. irfanview or FireFox. The answer is the same: no, because you are missing a fundamental part to be able to run and display GUI applications in MS- DOS (and I am not referring to graphics in the sense of games there  ). QuoteInstead of doing some troublesome to make my app runs on Ubuntu, I will make my app runs on Windows and do a remote backup/restore via Windows to Ubuntu Server. Is this possible? Yes, but the same is possible for Linux. It seems to me that you misunderstood the problem(s) and suggested approaches to solve them ? ---------------------------------------------------------------------- Thaddy · 2024-06-21 05:18 Quote from: TRon on June 21, 2024, 07:15:53 amQuoteInstead of doing some troublesome to make my app runs on Ubuntu, I will make my app runs on Windows and do a remote backup/restore via Windows to Ubuntu Server. Is this possible? Yes, but the same is possible for Linux. It seems to me that you misunderstood the problem(s) and suggested approaches to solve them ? That is exactly my advice too. Yes that is not only possible, but how it is done anyway. About my port remark: I don't know if Firebird can listen to multiple ports, but you can setup a reverse proxy on the server. The idea is to have a strict separation of administrative tasks from end-user tasks. ---------------------------------------------------------------------- TRon · 2024-06-21 05:58 Quote from: Thaddy on June 21, 2024, 06:45:15 amNo, It was kinda meant as rhetorical question for TS  But you are right in that I forgot that you can install it manually (later). @incendio Just like Thaddy (I presume) I hardly know anything about firebird servers but I am aware of this article from Michaël Van Canneyt and which, after a little research, makes me believe that you have 2 options to make backups (gbak and nback) and neither of them seem to allow for a remote backup. Basically you would automate the backup as described in the article and then you could choose to use FTP protocol or something similar to download the backup. A similar approach can be taken for restoring a backup (but in reverse order, first upload local stored backup to the server and auto restore the database on the server). If you have f.e. a httpserver running on that same server you could opt for a html page with backup /restore option for your database. There are a plethora of approaches possible depending on what is (already) running on your server (or that you are allowed to run). ---------------------------------------------------------------------- MarkMLl · 2024-06-21 06:51 Quote from: incendio on June 21, 2024, 06:58:15 amI am pretty sure that this Ubuntu Server doesn't come with X installed, and won't be installed either. The server is a firebird database server. My app is a small utility to backup and restore database for dummies users. I came up with an idea, please suggest me if this is do able. Instead of doing some troublesome to make my app runs on Ubuntu, I will make my app runs on Windows and do a remote backup/restore via Windows to Ubuntu Server. Is this possible? We need a reality check here. Have you used Lazarus to write a GUI app, than are expecting it to run on a server that has no GUI support installed? If so then you can probably run it by SSHing in and tunneling the X11 UI... provided of course that the server is running X11 rather than Wayland, and subjecto to any other libc issues. Otherwise you'll need to put it in a (Docker) container, or a VM. MarkMLl ---------------------------------------------------------------------- incendio · 2024-06-21 06:54 Basically, my knowledge on Linux is only how to install firebird in Ubuntu. After you guys mentioned about X, I just realized that my gui app won't run in this server. I will try to modify my app so it will do remote backup and restore. Flamerobin database manager on windows can do this, so I hope, Lazarus can do that also. Thank you for all your help and hints. ---------------------------------------------------------------------- MarkMLl · 2024-06-21 07:16 I strongly suggest using FPC- not Lazarus/LCL- to write a simple "Hello, World!" and checking that you can run it on that server. If not then you need to take on board the issues that Robert/Don have mentioned about glib etc. If a trivial program will work, then redo your backup program without a GUI. Later, there's ways that you can run a program either with or without a GUI. However I've not really explored what happens if you try moving a "GUI-optional" program to a system without X11... and Wayland remains a quagmire. MarkMLl ---------------------------------------------------------------------- cdbc · 2024-06-21 07:55 Hi If I may offer a suggestion... If you're rewriting... Then why not do it in FPC(as Mark suggests) and engage the help of the library from Warfley, namely 'LazTextForms' to realize the TUI, because the db-controls can easily be created/used in code. That way, it should run on anything 'Firebird'-server will run on... The lib from Warfley is available here: https://github.com/Warfley/LazTextForms Regards Benny ---------------------------------------------------------------------- incendio · 2024-06-21 10:10 Hi guys, I managed to rewrite my app, it runs on client side on Windows and do backup & restore remotely without problem. About FPC, never use it, is there a beginner guide how to use it? ---------------------------------------------------------------------- cdbc · 2024-06-21 13:22 Hi QuoteAbout FPC, never use it, is there a beginner guide how to use it?Hehehe... You use it all the time ...behind Lazarus, it compiles all of laz' 'shenanigans' and you can happily use lazarus' code-editor to write console programs. It's actually a brilliant tool for that(too). Try this: 1) create a new project in laz 2) instead of 'Application', choose 'Program' f.ex. 3) lazarus now creates a managed(by lazarus) program skeleton i.e.: lpr +     support-files... 4) to see what's happening when you run your code in the debugger, you can     click on Menu -> View -> Debug Windows -> Console In/Output 5) Have fun & happy coding  Regards Benny ---------------------------------------------------------------------- TRon · 2024-06-21 13:27 Quote from: incendio on June 21, 2024, 12:10:58 pmAbout FPC, never use it, is there a beginner guide how to use it? Plausible deniability ? ---------------------------------------------------------------------- incendio · 2024-06-21 13:36 Quote from: cdbc on June 21, 2024, 03:22:10 pmHi QuoteAbout FPC, never use it, is there a beginner guide how to use it?Hehehe... You use it all the time ...behind Lazarus, it compiles all of laz' 'shenanigans' and you can happily use lazarus' code-editor to write console programs. It's actually a brilliant tool for that(too). Try this: 1) create a new project in laz 2) instead of 'Application', choose 'Program' f.ex. 3) lazarus now creates a managed(by lazarus) program skeleton i.e.: lpr +     support-files... 4) to see what's happening when you run your code in the debugger, you can     click on Menu -> View -> Debug Windows -> Console In/Output 5) Have fun & happy coding  Regards Benny Nice, thanks for the hints, will try it ASAP 👍 ---------------------------------------------------------------------- MarkMLl · 2024-06-21 15:18 Quote from: incendio on June 21, 2024, 03:36:16 pmNice, thanks for the hints, will try it ASAP 👍 Detail: main unit is .lpr, other units are .pas files as usual. You'll have a .lpi ("Lazarus Project Information") file containing project paths and options, and .lps ("Lazarus Project State") which is usually temporary stuff you don't need to store in a version control system. You might have a .lpg if you've got the Lazarus Project Groups stuff installed. That's about it. Debugging etc. pretty much as usual, but the IDE's console handling (View -> Debug Windows -> Console In/Output) is fairly rudimentary and if you have a long-running program you might prefer to start it from a normal shell and then tell the IDE to attach a debugger to it (YMMV on different OSes etc.). MarkMLl ---------------------------------------------------------------------- Thaddy · 2024-06-21 15:39 Mark, a server does not even need a shell...Not to bash you. All it really needs is a network stack. ---------------------------------------------------------------------- MarkMLl · 2024-06-21 15:40 Thaddy, stop being such an effing idiot. He's starting it from something, particularly during debugging on his development system. MarkMLl ---------------------------------------------------------------------- Thaddy · 2024-06-21 16:08 he already concluded that he had the answer...