etternagame / etterna

Advanced cross-platform rhythm game focused on keyboard play
https://etternaonline.com/
MIT License
474 stars 133 forks source link

Make OpenSSL static link on all operating systems preferentially #1229

Open g-robertson opened 1 year ago

g-robertson commented 1 year ago

This should resolve issue #1215 as it will make the binaries generated for Linux static link OpenSSL so ubuntu 22.04 should not need to have OpenSSL 1.1 to function.

The reason this was chosen over switching to OpenSSL 3.0 with maintaining dynamic linking on Linux is because doing this would create the same problem for Ubuntu 20.04 LTS as they are stuck with OpenSSL 1.1. The CI for Etterna also uses Ubuntu 20.04 which means trying to switch to OpenSSL 3.0 would make that build fail without manually grabbing the package from the Ubuntu 22.04 repositories.

The reason dynamic linking is still allowed in the build process is for operating systems (Arch Linux) that lack static versions of packages and must dynamically link if they want to compile the game (see #952)

nico-abram commented 1 year ago

Is there a reason to automatically switch to dynamic linking in the cmake script if we fail to find a static openssl? That seems bad to me if the user explicitly sets OPENSSL_USE_STATIC_LIBS

g-robertson commented 1 year ago

The aim was for compilation to "just work" without any additional flags on the same devices that it currently does regardless of if they don't have dynamic or static versions of openssl. I could make it error if it's not found statically with an error message more explicit in what needs to be done in order to make compilation work on systems without static versions of OpenSSL (e.g. "No static version of OpenSSL was found, try setting the flag -OPENSSL_USE_STATIC_LIBS=OFF".)