Recent

Author Topic: [SOLVED] Need 32-bit library for to download files from internet?  (Read 12888 times)

Hartmut

  • Hero Member
  • *****
  • Posts: 1103
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][+][-]
  1. {$mode objfpc}{$H+}
  2.  
  3. uses fphttpclient,openssl;
  4.  
  5. procedure download(url,filespec: ansistring);
  6.    var Client: TFPHttpClient;
  7.    begin
  8.    InitSSLInterface;
  9.    Client:=TFPHttpClient.Create(nil);
  10.    try
  11.       try
  12.          Client.AllowRedirect:=true; {allow redirections}
  13.          Client.Get(url, filespec);
  14.       except
  15.          on E: EHttpClient do  writeln(E.Message)
  16.          else raise;
  17.       end;
  18.    finally
  19.       Client.Free;
  20.       writeln('Done');
  21.    end;
  22.    end;
  23.  
  24. const URL = 'https://example.com/example.mp4';
  25.       Filespec = '/hg/tmp/xx.mp4';
  26.  
  27. begin
  28. download(URL,Filespec);
  29. 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.
« Last Edit: December 26, 2021, 05:58:36 pm by Hartmut »

PascalDragon

  • Hero Member
  • *****
  • Posts: 6355
  • Compiler Developer
Re: Need 32-bit library for to download files from internet?
« Reply #1 on: December 24, 2021, 12:52:56 pm »
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?

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

  • Hero Member
  • *****
  • Posts: 1103
Re: Need 32-bit library for to download files from internet?
« Reply #2 on: December 24, 2021, 01:58:39 pm »
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

  • Hero Member
  • *****
  • Posts: 4741
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Need 32-bit library for to download files from internet?
« Reply #3 on: December 24, 2021, 02:03:28 pm »
32 bit is not being distributed anymore in Ubuntu, only 64 bit stuff.

Hartmut

  • Hero Member
  • *****
  • Posts: 1103
Re: Need 32-bit library for to download files from internet?
« Reply #4 on: December 24, 2021, 02:16:18 pm »
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

  • Hero Member
  • *****
  • Posts: 8551
Re: Need 32-bit library for to download files from internet?
« Reply #5 on: December 24, 2021, 03:28:58 pm »
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).

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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Hartmut

  • Hero Member
  • *****
  • Posts: 1103
Re: Need 32-bit library for to download files from internet?
« Reply #6 on: December 24, 2021, 03:55:01 pm »
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

  • Hero Member
  • *****
  • Posts: 8551
Re: Need 32-bit library for to download files from internet?
« Reply #7 on: December 24, 2021, 04:26:51 pm »
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??

DON'T start there, look for the equivalent repository in Ubuntu to satisfy your

Quote
But 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Hartmut

  • Hero Member
  • *****
  • Posts: 1103
Re: Need 32-bit library for to download files from internet?
« Reply #8 on: December 25, 2021, 02:06:20 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

  • Hero Member
  • *****
  • Posts: 6355
  • Compiler Developer
Re: Need 32-bit library for to download files from internet?
« Reply #9 on: December 25, 2021, 03:40:01 pm »
32 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 :P )

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.

Newsflash: the OpenSSLSockets units requires the OpenSSL library (aka the same one you're trying to install right now).

Hartmut

  • Hero Member
  • *****
  • Posts: 1103
Re: [CLOSED] Need 32-bit library for to download files from internet?
« Reply #10 on: December 25, 2021, 04:37:57 pm »
Newsflash: 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

  • Hero Member
  • *****
  • Posts: 755
Re: [CLOSED] Need 32-bit library for to download files from internet?
« Reply #11 on: December 25, 2021, 05:52:34 pm »
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

  • Hero Member
  • *****
  • Posts: 1103
Re: [CLOSED] Need 32-bit library for to download files from internet?
« Reply #12 on: December 25, 2021, 06:20:50 pm »
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

  • Hero Member
  • *****
  • Posts: 755
Re: [CLOSED] Need 32-bit library for to download files from internet?
« Reply #13 on: December 25, 2021, 08:29:02 pm »
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 ?
« Last Edit: December 25, 2021, 08:36:03 pm by tetrastes »

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: [CLOSED] Need 32-bit library for to download files from internet?
« Reply #14 on: December 25, 2021, 08:47:09 pm »
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018