Lazarus, Linux, Indy 10 and OpenSSL error

Veröffentlicht von

Using the IdHTTP component to access https websites, returned an error: “Could not load SSL library2”.

On Linux, I tried to use Lazarus with the Indy 10 components. I wanted to use the “IdHttp” component to access and download something from the internet. The code is quite simple:

html:= IdHTTP1.Get('https://ekiwi.de');

Howewer I got an error, that the SSL library could not be found.

EIOSSLCouldNotLoadSSLLibrary
Could not load SSL library.
In file 'IdSSLOpenSSL.PAS'

Searching the internet, the problem is, that the library is either missing or installed in the wrong version. Indy 10 still needs the version 1.0.2.

For Windows, it should be enough to place the DLLs in the program folder. You can find binary releases here.

On Linux, I compiled the version, with the following set of commands:

wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
tar -xf openssl-1.0.2u.tar.gz
cd openssl-1.0.2u
./config shared
make

After that, I copied the library files over to the program folder.

cp *.so /path/to/copy/to

However is is not enough for Linux, as the program does not look there by default.

So I needed to point the Indy components to the correct folder:

IdOpenSSLSetLibPath(path);

The complete example code:

unit IdSSLOpenSSLHeaders

procedure TForm1.Button1Click(Sender: TObject);
var html, path:string;
begin
  path:= ExtractFilePath(Application.ExeName);
  ShowMessage(path);
  IdOpenSSLSetLibPath(path);

  html:= IdHTTP1.Get('https://ekiwi.de');
  Memo1.Text:= html;
end; 

After that the download worked.

Ein Kommentar

  1. Hey Andy, danke für den Tipp. Ich konnte einen Downloader unter Lazarus Linux OS zum Laufen bringen. Die Wahrheit ist, dass bei der Suche im Internet niemand das Ziel gefunden hat. Ich habe zuerst den erstellten Link mit den Namen libcrypto.so und libssl.so eingefügt und es hat nicht funktioniert, aber dann habe ich auch die Bibliothek kopiert, die c/link anzeigt: libcrypto.so.1.0.0 und libssl.so. 1.0.0 und dort habe ich aufgehört, Fehler zu werfen. Natürlich habe ich eine YouTube-URL eingegeben, um zu sehen, ob ein Video heruntergeladen werden kann, und natürlich hat das bei YouTube nicht funktioniert. Ja, ich weiß … der echte ist in einer langen Kette im Code der Seite versteckt. Aber das ist von nun an zu untersuchen.
    Original (Español):
    Hey andy, gracias por el tip. Pude hacer funcionar un downloader en Lazarus Linux OS. La verdad es que buscando en internet no habia quien diera en el blanco, . Puse primero el link que creó con el nombre de libcrypto.so y libssl.so y no funciono, pero entonces tambien copie la libreria que señalaba c/link : libcrypto.so.1.0.0 y libssl.so.1.0.0 y ahi ya dejo de tirar error. Claro puse un url de youtube a ver si bajaba un video y por supuesto con youtube eso no funcionó. Si ya sé… el real esta escondido en una larga cadena dentro del codigo de la pagina. Pero eso es para investigar de aqui en mas.

Kommentar hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert