How to build OpenSSL (libcrypto) and include it in a Xojo built app

There is another Thread about Xojo users having issues with libcrypto.
It boils down to the fact that Apple wants Developers to include their own build/version of libcrypto. And/or on the newst macOS (especially arm64 | when using the newst macOS SDK, such as Xojo 2021r1 does) to link against a specific version. But since one can’t know which libcrypto version(s) Apple provides with it’s (upcoming) OSes - better include the version you need yourself.

So the big question for many of us is… How to build OpenSSL (libcrypto) and include it in a Xojo built app?

If you’re interested - here is an example project: macOS: OpenSSL - Bring your Own

This example project shows how you can build your own OpenSSL Library from Source as a Universal .dylib (arm64 and x86_64), include it in a Xojo project - and finally use it in your application. It includes

  • HowTo.txt - which explains all the steps
  • Build.sh - A Shell Script you can use as a template to build the current versions of the OpenSSL Library yourself
  • Example Xojo Project - showing how to include your own built .dylib’s in your application

macOS: OpenSSL - Bring your Own

And just for fun… I have compiled the outdated OpenSSL 0.9.8zh as Universal (arm64 and x86_64). That’s a bit more tricky since you have to add/modify the Configuration for arm64 yourself. Notes are also in the example project. Not that I recommend that - but in case you are using Declares that only work with that libcrypto-version, and no longer with 1.1.1 - this might be a temporary solution to make your app working for a M1 Mac (as an arm64 build) without fiddling with existing Declares.

5 Likes

MBS Plugin has OpenSSL included.
If you let me know, we could add a few more methods for you…

For Windows OS also?

You can get OpenSSL built for Windows from the CURL project: curl for Windows

1 Like

Well, of course there are Plugins available. That’s even more convenient for most.
It’s just that this Thread and example is not about that :angel:

This one is for the curious, the interested and for those few in need of a “do it yourself” way.

Linux

Building should be quite similar to macOS, without the need of creating a Universal one.
I just haven’t done this myself yet because all our supported Distributions come with libcrypto versions we’re fine with.

Windows

Seems a bit more tricky to compile yourself.
If anyone has done so and would like to contribute, I’d be happy to add your Notes about “how to … for Windows”.

Meanwhile…:

Another source to get built libraries for Windows: Internet Component Suite

3 Likes

Hi Jürg,
thank you for sending me the .zip version via DropBox.

For those interested in this topic:

I’ve updated the example with a build script that should work for OpenSSL 3.0.x.
It’s now located on GitHub: macOS: OpenSSL - byo

And I have tried to build the outdated OpenSSL 0.9.8zh as a Universal Binary.
I just don’t have a M1 Mac, so I can’t try that.
Should someone want to try: Download the built example app from the Releases.
Thanks for letting me know if that works on a M1 Mac.

1 Like