Forum > Networking and Web Programming

Could not initialize OpenSSL library - MacOS ARM


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.

Methinks the app is looking for libraries, are the correct ones installed on your system?!?
Regards Benny

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.

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.


[0] Message Index

Go to full version