Skip to content

Commit

Permalink
Ensure OpenSSL libraries have correct suffix on Android.
Browse files Browse the repository at this point in the history
Since OpenSSL v3 the libraries need to be named e.g. libssl_3.so
  • Loading branch information
martinburchell committed Jan 2, 2024
1 parent f6d608b commit 8e14ede
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tablet_qt/camcops.pro
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,8 @@ equals(CAMCOPS_OPENSSL_LINKAGE, "static") {
}
# Regardless of how *CamCOPS* talks to OpenSSL, under Android *Qt* talks to
# it dynamically:
ANDROID_EXTRA_LIBS += "$${OPENSSL_DIR}/libcrypto$${DYNAMIC_LIB_EXT}" # needed for Qt
ANDROID_EXTRA_LIBS += "$${OPENSSL_DIR}/libssl$${DYNAMIC_LIB_EXT}"
ANDROID_EXTRA_LIBS += "$${OPENSSL_DIR}/libcrypto_3$${DYNAMIC_LIB_EXT}" # needed for Qt
ANDROID_EXTRA_LIBS += "$${OPENSSL_DIR}/libssl_3$${DYNAMIC_LIB_EXT}"
# ... must start "lib" and end ".so", otherwise Qt complains.


Expand Down
14 changes: 12 additions & 2 deletions tablet_qt/tools/build_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
import os
from os import chdir, listdir
from os.path import expanduser, isdir, isfile, join, split
from pathlib import Path
from pathlib import Path, PurePath
import platform
import re
import shutil
Expand Down Expand Up @@ -2926,6 +2926,16 @@ def build_openssl(cfg: Config, target_platform: Platform) -> None:
shortbasename = basename[len(libprefix) :]
shadow_targets.append(join(dirname, shortbasename))

if target_platform.android:
# https://bugreports.qt.io/browse/QTBUG-110915
# need to rename targets to be e.g. libssl_3.so
for t in main_targets:
path = PurePath(t)
shadow_target = PurePath(
path.parent / f"{path.stem}_3"
).with_suffix(path.suffix)
shadow_targets.append(shadow_target)

targets = main_targets + shadow_targets
if not cfg.force_openssl and all(isfile(x) for x in targets):
report_all_targets_exist("OpenSSL", targets)
Expand Down Expand Up @@ -3146,7 +3156,7 @@ def runmake(command: str = "") -> None:
# -------------------------------------------------------------------------
for i, t in enumerate(main_targets):
target_platform.verify_lib(t)
if BUILD_PLATFORM.windows:
if BUILD_PLATFORM.windows or target_platform.android:
assert len(shadow_targets) == len(main_targets)
shutil.copyfile(t, shadow_targets[i])

Expand Down

0 comments on commit 8e14ede

Please sign in to comment.