Link openssl in native extensions (DEF-3024) (SOLVED)

In my game I need some digest and cipher algorithms (MD5 / SHA1 / RSA / AES…), I cannot found related information in API references, so I decide to write a native extension to port lua openssl to Defold.

But when I tried to build the extension with prebuilt openssl static libraries, the build server failed to link it with following errors.

It seems Defold already included parts of openssl implementations in libdlib.a and caused the duplicate symbols.

I know there is a post in the forum about a similar issue. In this post, @sergey.lerg suggested to remove libcrypto.a from the extension or remove the duplicate symbols, but I don’t think this is a decent solution because there might be some binary compatibility issues between various major openssl releases.

So my questions are:

  1. Does Defold include parts or whole openssl libraries? If it does, which version used?
  2. Is possible Defold to open the digest and cipher algorithms to the extension developers (even just header files would be great help)? Since Defold has builtin https support, I suppose you already have these implemented.
  3. If these algorithms could be provide in lua, it would be wonderful for game developers and flexile for you. :rofl:

Thanks,
Joshua

2 Likes

We have a ticket (DEF-3024) for hiding these symbols names.
You are correct that we use some of these functions. I think the best way forward is for us to rename them in the engine so that you (or others) won’t get symbol collisions. We might change our back end in the future, so we most probably don’t want to expose these functions in out SDK. A more high level Lua approach might be better though, but it’s not something we have in our plans.

Thanks @Mathias_Westerdahl for the quick update! Meanwhile I will try to go with libtomcrypt since I have very tight project schedule. :sob:

Another way might be to use the GameAnalytics extension, which has currently worked around this issue with the crypto/ssl symbol names. (Thx @mts for that help!)

3 Likes

Thanks @Mathias_Westerdahl for the tips! I will check it out to see if this project can satisfy my needs :star_struck:

1 Like

A pure Lua solution for cryptography exists in the LuaLockbox lib: https://github.com/somesocks/lua-lockbox

2 Likes

Thanks @britzl, I’ll look into it.

Solved in Defold 1.2.126

2 Likes