[SOLVED] Need 32-bit library for to download files from internet? lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Hartmut · 2021-12-24 10:29 I'm on Linux Ubuntu 18.04 64-bit with FPC 3.0.4. I want to download a file from the internet with the following console program: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$mode objfpc}{$H+} uses fphttpclient,openssl; procedure download(url,filespec: ansistring);   var Client: TFPHttpClient;   begin   InitSSLInterface;   Client:=TFPHttpClient.Create(nil);   try      try         Client.AllowRedirect:=true; {allow redirections}       Client.Get(url, filespec);      except         on E: EHttpClient do  writeln(E.Message)         else raise;      end;   finally      Client.Free;      writeln('Done');   end;   end; const URL = 'https://example.com/example.mp4';      Filespec = '/hg/tmp/xx.mp4'; begindownload(URL,Filespec);end. When I compile this program with 64-bit, it works fine. When I cross- compile it with 32-bit then I get a runtime exception "EInOutError: Could not initialize OpenSSL library". I'm a beginnter to this stuff. I guess, that my program needs a library, which exists for 64-bit, but not for 32-bit. Can this be? If yes, how can I find out the name of this library and how can I "install" it as 32-bit? Thanks in advance. Happy Christmas and peace to everybody. ---------------------------------------------------------------------- PascalDragon · 2021-12-24 11:52 Quote from: Hartmut on December 24, 2021, 11:29:47 amWhen I compile this program with 64-bit, it works fine. When I cross-compile it with 32-bit then I get a runtime exception "EInOutError: Could not initialize OpenSSL library". I'm a beginnter to this stuff. I guess, that my program needs a library, which exists for 64-bit, but not for 32-bit. Can this be? If yes, how can I find out the name of this library and how can I "install" it as 32-bit? Yes, and the library in question is the SSL library. You probably need to do something like sudo apt-get install libssl-dev:i686 or so (I don't know the name for sure, cause I don't use Ubuntu, but it should point you in the right direction). ---------------------------------------------------------------------- Hartmut · 2021-12-24 12:58 Thank you very much PascalDragon for that suggestion. From what I think to know is that 32-bit libraries are installed by adding ":386", so I tried:     sudo apt-get install libssl-dev:386 and     sudo apt-get install libssl:386 but both I got error message "package cannot be found". I had a look with package manager "Muon" what is currently installed (see screenshot) and from what i guess there seams to be "libssl1.1 (386)" for 32-bit currently installed? But I get this exception from my 32-bit program... Is there somebody who knows more about what I must install and how? Thanks. ---------------------------------------------------------------------- lainz · 2021-12-24 13:03 32 bit is not being distributed anymore in Ubuntu, only 64 bit stuff. ---------------------------------------------------------------------- Hartmut · 2021-12-24 13:16 Thank you lainz for that information. That means I cannot download the needed library from the normal source. But if I would find (in this forum) someone who has a (not too old) 32-bit Ubuntu system or has the requested files from former times on his 64-bit Ubuntu, would it work to "copy" the neccessary files from this system to mine? Is there someone, who has this files and would send them to me? ---------------------------------------------------------------------- MarkMLl · 2021-12-24 14:28 Quote from: PascalDragon on December 24, 2021, 12:52:56 pmYes, and the library in question is the SSL library. You probably need to do something like sudo apt-get install libssl-dev:i686 or so (I don't know the name for sure, cause I don't use Ubuntu, but it should point you in the right direction). In the case of Debian you can, in extremis, look in http://deb.debian.org/debian/pool/main/o/openssl/ for the .deb file. I'd expect there to be an equivalent repository layout for any derivative including Ubuntu, but note that there might be multi-arch prerequisites. MarkMLl ---------------------------------------------------------------------- Hartmut · 2021-12-24 14:55 Thank you very much MarkMLl for that link. There are about 300 files. I'm a bloody beginner for that stuff.  - Which of those files do I need for my purpose?  - In which folder must I put them (I have Ubuntu 18.04 64-bit)  - I thought that libraries on my system have extension .so but your files have .deb or .udeb - will this work?? ---------------------------------------------------------------------- MarkMLl · 2021-12-24 15:26 Quote from: Hartmut on December 24, 2021, 03:55:01 pmThank you very much MarkMLl for that link. There are about 300 files. I'm a bloody beginner for that stuff.  - Which of those files do I need for my purpose?  - In which folder must I put them (I have Ubuntu 18.04 64-bit)  - I thought that libraries on my system have extension .so but your files have .deb or .udeb - will this work?? DON'T start there, look for the equivalent repository in Ubuntu to satisfy your QuoteBut if I would find (in this forum) someone who has a (not too old) 32-bit Ubuntu system However as I have said: there might be prerequisites which cannot easily be satisfied on a current 64-bit Ubuntu system. Apropos file types: Debian derivatives generally look for packages with the extension .apt and these point to a .deb in the repository's pool. They also specify prerequisites etc. Once you have a .deb you can install it manually using dpkg to give you a .so (and various other stuff), but there's a lot of scope for getting things wrong: if you're not familiar with working at this level and Ubuntu is preventing you from doing what you want it might be time to switch distreaux. MarkMLl ---------------------------------------------------------------------- Hartmut · 2021-12-25 13:06 Quote from: MarkMLl on December 24, 2021, 04:26:51 pm... but there's a lot of scope for getting things wrong: if you're not familiar with working at this level and Ubuntu is preventing you from doing what you want it might be time to switch distreaux. I think I'm too much a bloody beginner for that stuff to continue. I will either switch to 64-bit or to FPC 3.2.0, which has a new Unit 'opensslsockets', which eliminates the need of the external missing library. Thanks to all who helped me. ---------------------------------------------------------------------- PascalDragon · 2021-12-25 14:40 Quote from: lainz on December 24, 2021, 02:03:28 pm32 bit is not being distributed anymore in Ubuntu, only 64 bit stuff. Was that already the case with 18.04? I thought that only came later? (but then again I'm an Arch user ) Quote from: Hartmut on December 25, 2021, 02:06:20 pmI will either switch to 64-bit or to FPC 3.2.0, which has a new Unit 'opensslsockets', which eliminates the need of the external missing library. Newsflash: the OpenSSLSockets units requires the OpenSSL library (aka the same one you're trying to install right now). ---------------------------------------------------------------------- Hartmut · 2021-12-25 15:37 Quote from: PascalDragon on December 25, 2021, 03:40:01 pmNewsflash: the OpenSSLSockets units requires the OpenSSL library (aka the same one you're trying to install right now). Hmm. My demo (see my 1st post) definitely runs, when compiled as 32-bit with FPC 3.2.0 if I add Unit 'opensslsockets' (which does not exist in FPC 3.0.4). Without this unit I have in 3.2.0 the same situation as in FPC 3.0.4: 64-bit runs and 32-bit gives this exception. If you are right and Unit 'opensslsockets' does need the external OpenSSL library, then there must be instead another 32-bit library missing on my system. How can I find out which? ---------------------------------------------------------------------- tetrastes · 2021-12-25 16:52 Reading openssl.pas from fpc 3.0.4 sources we see that it supports libssl up to 1.0.6 version, while the one from fpc 3.2.0 - up to 1.1 version. From your screenshot of Muon I see that for 32-bit you have only libssl1.1, while for 64-bit you have libsll1.1 and libssl1.0.0. Sorry for replying for closed branch, but I think this will be helpful. (And don't be lazy to read sources  ) ---------------------------------------------------------------------- Hartmut · 2021-12-25 17:20 Thank you very much tetrastes for your reply. Now I understand what's happening and why. And that the solution would be to install libssl in version 1.0.6 (or a little older) 32-bit. But I have no idea where to get this file(s) from and where to put them in, because Muon does not offer this. If this is too complicated (for me) than I'll give up at this point and solve the problem as described in reply #8. ---------------------------------------------------------------------- tetrastes · 2021-12-25 19:29 As there is 64-bit libssl1.0.0, I would expect that there is the same 32-bit version in repo also. Have you tried sudo apt-get install libssl1.0.0:386 ? ---------------------------------------------------------------------- MarkMLl · 2021-12-25 19:47 There's various possibilities in http://security.ubuntu.com/ubuntu/pool/main/o/openssl/ which might be useful. The first thing is always to find the package's "true name", but that can still lead to a maze of dependencies all different. MarkMLl ---------------------------------------------------------------------- tetrastes · 2021-12-25 20:18 I think that this command installs packages corresponding to the distro with all dependencies, am I not right? ---------------------------------------------------------------------- MarkMLl · 2021-12-25 21:17 Yes, but OP stated that for his Ubuntu release there wasn't a 32-bit version of the library he needed formally packaged i.e. as a .apt (accessible by apt-get etc.). I'm inclined to accept that he's done his homework (if not, it's his problem :-) When one starts looking at pool storage one sees the underlying .deb packages, and in particular their true names, which might extrapolate to .apts... but at that point one has to be careful about dependencies. BTDT, I assure you :-) MarkMLl ---------------------------------------------------------------------- Hartmut · 2021-12-26 10:03 Hello tetrastes and MarkMLl, I tried    sudo apt-get install libssl1.0.0:386 and got error message "package libssl1.0.0:386 cannot be found". I tried other versions, which I found in the source of unit 'openssl', with the same result. I guess that, as lainz said, 32-bit is not longer supported by Ubuntu. Again I had a look at the link from MarkMLl. There are 12 possibilities which all start with "libssl1.0.0" and all end with "i386.deb". I don't know how to proceed if there is not someone who can tell me that. And of course I don't want to damage something on my system. ---------------------------------------------------------------------- MarkMLl · 2021-12-26 10:26 Quote from: Hartmut on December 26, 2021, 11:03:57 amAgain I had a look at the link from MarkMLl. There are 12 possibilities which all start with "libssl1.0.0" and all end with "i386.deb". I don't know how to proceed if there is not someone who can tell me that. And of course I don't want to damage something on my system. As I've said: I'm not an Ubuntu user, I've pointed you at the central repository which is where one starts looking if using a Debian derivative and I'm not prepared to give more specific advice since I'm not in a position to fix things if they break. Are you SURE that Ubuntu no longer has a multiarch facility? Debian certainly does and I think Ubuntu used to... Google for that specific word. If Ubuntu really has stopped providing 32-bit SSL libraries and they don't have multiarch then either build for 64-bit or use a different distro. MarkMLl ---------------------------------------------------------------------- dbannon · 2021-12-26 11:58 Quote from: Hartmut on December 26, 2021, 11:03:57 am    sudo apt-get install libssl1.0.0:386 and got error message "package libssl1.0.0:386 cannot be found". I tried other versions, which I found in the source of unit 'openssl', with the same result. I guess that, as lainz said, 32-bit is not longer supported by Ubuntu. I suspect it needs an 'i' in the '386' - Code: Pascal  [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- get install libssl1.0.0:i386 I cannot test for libssl1.0.0:i386 on my u20.04 but I can find libssl1.1:i386.  While Ubuntu no longer makes a 32bit distro, they "seem" to still have the 32bit libraries available, perhaps for compatibility purposes.  Davo ---------------------------------------------------------------------- Hartmut · 2021-12-26 16:57 You are so right dbannon, the 'i' was missing! With it your command worked and I could install the wanted 32-bit library. Now I can download files in 64- and 32-bit FPC programs. Thank you very much! This is a great forum.