Recent

Author Topic: Could not initialize OpenSSL library - MacOS ARM  (Read 651 times)

richie765

  • Newbie
  • Posts: 5
Could not initialize OpenSSL library - MacOS ARM
« on: November 20, 2023, 01:39:45 pm »
Hi there,

I'm trying to compile my application for Mac with ARM CPU. Everything seems to work except ssl: "Could not initialize OpenSSL library". When I switch back to x86_64 and and recompile everything it works fine.

I've been searching for hours but can't find anything specific to this. I've got openssl installed with homebrew, not sure if that is relevant.

Any help is appreciated.

cdbc

  • Hero Member
  • *****
  • Posts: 1026
    • http://www.cdbc.dk
Re: Could not initialize OpenSSL library - MacOS ARM
« Reply #1 on: November 20, 2023, 02:45:56 pm »
Hi
Methinks the app is looking for libraries, are the correct ones installed on your system?!?
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

richie765

  • Newbie
  • Posts: 5
Re: Could not initialize OpenSSL library - MacOS ARM
« Reply #2 on: November 20, 2023, 03:16:57 pm »
I cannot say for sure becasue I can't find any information about which are the correct libraries for MacOS. I have openssl installed with Homebrew, and they are arm64 version.

Since it works for x86_64 but not for aarch64 and I could not find anything about the "correct" libraries (all I could find was for Windows), I am guessing those from homebrew aren't used at all and the SSL from MacOS itself is used.

Begs the question why it's not working with both architectures.

richie765

  • Newbie
  • Posts: 5
Re: Could not initialize OpenSSL library - MacOS ARM
« Reply #3 on: November 21, 2023, 04:59:05 pm »
After a long debugging session I solved the problem. Maybe this can help someone.

openssl.pas tries to load many versions of libcrypto and libssl. With target set to x86_64, it will find version 0.9.8 of the dylib. I searched my entire system but the module is nowhere installed, so I am guessing this is somewhere handled internally within MacOS.

For aarch64 this library cannot be loaded so I'm guessing Apple removed that functionality.

I was able to install openssl@1.1 with homebrew and copy the dylib files to /usr/local lib. A newer version will not work as openssl.pas only seaches up to 1.1.

Now for aarch64 it will correctly load version 1.1 of the library while with x86_64 this not used and the phantom 0.9.8 is still being loaded.

Anyway it seems to solve my problem for now.

 

TinyPortal © 2005-2018