Delphi Indy idHTTP causes Mac app to quit

297 views Asked by At

Dropping an idHTTP component on a Delphi 10.4.1 MacOS project and having it Get() a file causes the app to quit.

I'm not talking about an unhandled exception. MacOS 10.15.6 kills the app with this complaint in the crash report:

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.

Here is the code. Get() must be passed an actual file. (If the Get() results in a 404, then the proper exception is raised.)

procedure TForm1.FormCreate(Sender: TObject);
var
  Stream: TMemoryStream;

begin
  Stream := TMemoryStream.Create;

  IdHTTP1.Get('https://www.bookup.com/cowupdates/build113.txt', Stream);

  // app crashes on Mac
1

There are 1 answers

1
Remy Lebeau On BEST ANSWER

The error message is self-explanatory. Indy is trying to load the unversioned libcrypto.dylib file (for OpenSSL), and apparently your OSX system does not like that.

To avoid that, you can call IdOpenSSLSetCanLoadSymLinks(False) at program startup. See Changes for how OpenSSL is loaded on *Nix platforms on Indy's website for more details. Then, just make sure there is a version of OpenSSL 1.0.2 or earlier installed on the system, or at least in your app's folder.

There is currently an open pull request to add OpenSSL 1.1.x support to Indy, but I don't know if it supports OSX. You could try it and see.