Search code examples
macosopensslindylazarus

Lazarus using Indy + OpenSSL on OS X results in EIdOSSLCouldNotLoadSSLLibrary


I am currently using:

  • OS X Yosemite 10.10.5
  • newest Indy (10.6.2.0, download 2016 March 13 - Indy10_5346.zip)
  • Lazarus 1.4.4
  • newest openssl

OpenSSL is more specificly:

  • openssl-1.0.2g accordingly to home brew cmd line interface
  • placed in /usr/local/Cellar/openssl/1.0.2/lib/
  • lib files in above directory are: libcrypto.10.dylib, libcrypto.1.0.0.dylib, libcrypto.dylib, libcrypto.a, libssl.1.0.0.dylib, libssl.dylib, libssl.a

...

I am passing above pah to Indy using idOpenSSLSetLibPath() befoe using Indy.

but I am getting getting error: EIdOSSLCouldNotLoadSSLLibrary at:

TIdSSLIOHandlerSocketOpenSSL.Init() -> TIdSSLContext.Create()
...
LoadOpenSSLLibrary() -> IdSSLOpenSSLHeaders.Load()
...
Load()
...
hIDCrypto := LoadSSLCryptoLibrary() -> Result := HModule(HackLoad(...))
...
Result := LoadLibrary(HackLoadFileName(ALibName,ALibVersions[I])); // always zero :(

Comments

  • "GIdOpenSSLPath + SSLCLIB_DLL_name are correct (file extension set correctly by Indy when using "HackLoadFileName" in "LoadLibrary" call)

  • Indy tries to iterate/load over following names: libcrypto, libcrypto.1.0.0, libcrypto.10, libcrypto.1.0.1, libcrypto.1.0.2

...

Side question #1:

  • why does homebrew ship openssl 1.0.2g in a file called libcrypto.1.0.0.dylib - is it to maximize compability?

...

Thoughts on possible cause #1:

Could all this be an issue of Lazarus compiles 32bit for OS X? And OpenSSL is 64bit?


Solution

  • Install openssl like this in command line: brew install openssl --universal

    This ensure the library works both for 32 and 64 bit apps.

    You may need to uninstall first using: brew uninstall openssl