From 18aed979a22e905211a9ca6d1688e26a7908ddb7 Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Mon, 27 Jul 2026 17:14:56 +0800 Subject: [PATCH] build: fix macOS build issues blocking app compilation - engine: liboakengine.dylib intentionally leaves olive::k_app_version to the final executable (olive-version-obj); whitelist that symbol with -U on Apple, where undefined symbols in dylibs are an error (ELF allows them by default). - app/common/configwrapper.h: only declare the int64_t/uint64_t conversion/assignment overloads on Linux LP64, where they differ from qint64/quint64; elsewhere both are long long and the extra overloads are redeclarations. --- app/common/configwrapper.h | 7 +++++++ engine/CMakeLists.txt | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/app/common/configwrapper.h b/app/common/configwrapper.h index 652e10ef3..9aa4c9131 100644 --- a/app/common/configwrapper.h +++ b/app/common/configwrapper.h @@ -58,6 +58,10 @@ public: { return static_cast(oakengine_config_get_int(key_utf8(), 0)); } + // int64_t/uint64_t overloads only exist where they differ from + // qint64/quint64 (Linux LP64: int64_t is long; on macOS/Windows both are + // long long, where declaring them would be a redeclaration). +#if defined(__linux__) operator int64_t() const { return oakengine_config_get_int(key_utf8(), 0); @@ -66,6 +70,7 @@ public: { return static_cast(oakengine_config_get_int(key_utf8(), 0)); } +#endif operator QString() const { char buf[1024]; @@ -103,6 +108,7 @@ public: oakengine_config_set_int(key_utf8(), static_cast(v)); return *this; } +#if defined(__linux__) OakConfigValue &operator=(int64_t v) { oakengine_config_set_int(key_utf8(), v); @@ -113,6 +119,7 @@ public: oakengine_config_set_int(key_utf8(), static_cast(v)); return *this; } +#endif OakConfigValue &operator=(const QString &v) { const QByteArray utf8 = v.toUtf8(); diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index c6039e878..9f5d04ca5 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -114,6 +114,14 @@ if (UNIX AND NOT APPLE) ${CMAKE_CURRENT_SOURCE_DIR}/oakengine.ver) endif () +# olive::k_app_version is intentionally left undefined in the shared library +# and provided by the final executable via olive-version-obj (see +# worker/CMakeLists.txt). ELF allows undefined symbols in shared libraries by +# default; the macOS linker does not, so whitelist that one symbol. +if (APPLE) + target_link_options(oakengine PRIVATE "LINKER:-U,__ZN5olive13k_app_versionE") +endif () + # Install into the platform's standard library directory (/usr/lib, # /usr/lib64 or the Debian multiarch path); Windows DLLs go next to the # executables in bin.