From 81e2f01199fdf2029833aaf100ec8f17b5c04d6f Mon Sep 17 00:00:00 2001 From: Roberto Nibali Date: Wed, 8 Jul 2026 09:51:34 +0200 Subject: [PATCH] Darwin: fix ARM64 build and runtime issues Signed-off-by: Roberto Nibali --- configure.py | 30 +++++++++++++------ .../settings/editors/UIHostComboEditor.cpp | 8 ++--- .../darwin/HostDnsServiceDarwin.cpp | 3 +- .../src-server/darwin/HostPowerDarwin.cpp | 3 +- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/configure.py b/configure.py index da9479cef962..f47104757375 100755 --- a/configure.py +++ b/configure.py @@ -1524,6 +1524,11 @@ def checkHdr(self): asResults, _ = self.findFiles(sCurSearchPath, asHdrToSearch, fAbsolute = True, fStripFilenames = True); for sResIncFile, dictRes in asResults.items(): sIncPath = dictRes['found_path']; + if sIncPath \ + and self.enmBuildTarget == BuildTarget.DARWIN \ + and sResIncFile == 'iostream' \ + and '/opt/homebrew/include/c++/' in sIncPath: + continue; if sIncPath \ and sResIncFile not in setHdrFound: # Take the first match found. setHdrFound[sResIncFile] = sIncPath; @@ -1764,8 +1769,12 @@ def checkCallback_qt(self): sPathBin = None; sPathLibExec = None; - # Check if we have our own pre-compiled Qt in tools first. - sPathBase = self.getToolPath(); + # Check if we have our own pre-compiled Qt in tools first. A custom + # Darwin path may point at a normal framework installation instead. + if self.enmBuildTarget == BuildTarget.DARWIN and self.sRootPath: + sPathBase = None; + else: + sPathBase = self.getToolPath(); if sPathBase: self.asLibFiles = [ 'libQt6CoreVBox' ]; g_oEnv.set('VBOX_WITH_ORACLE_QT', '1'); @@ -1803,10 +1812,11 @@ def checkCallback_qt(self): # Search for the library file. # Note: Ordered by precedence. Do not change! - asPath = [ sPathBase, - getPackagePath('qt@6')[1], - '/System/Library', - '/Library' ]; + asPath = [ self.sRootPath, + sPathBase, + getPackagePath('qt@6')[1], + '/System/Library', + '/Library' ]; sPathFramework = None; for sPathBase in asPath: if not sPathBase: # No custom path? Skip. @@ -1825,14 +1835,16 @@ def checkCallback_qt(self): break; if sPathFramework: + sPathFrameworkParent = os.path.dirname(sPathFramework); # We need to clear the library defined the the LibraryCheck definition # -- macOS uses the framework concept instead. self.asLibFiles = []; - self.asLibPaths.insert(0, sPathFramework); + self.asLibPaths.insert(0, sPathFrameworkParent); # Include the framework headers. - self.asIncPaths.insert(0, f'{sPathBase}/lib/QtCore.framework/Headers'); + self.asIncPaths.insert(0, os.path.join(sPathFramework, 'Headers')); # More stuff needed in order to get it linked. - self.asLinkerArgs.extend([ '-std=c++17', '-framework', 'QtCore', '-F', f'{sPathBase}/lib', '-g', '-O', '-Wall' ]); + self.asCompilerArgs.extend([ '-F', sPathFrameworkParent ]); + self.asLinkerArgs.extend([ '-std=c++17', '-framework', 'QtCore', '-F', sPathFrameworkParent, '-g', '-O', '-Wall' ]); sPkgName = 'Qt6Core'; ## @todo Make the code generic once we have similar SDKs. if sPathBase: diff --git a/src/VBox/Frontends/VirtualBox/src/settings/editors/UIHostComboEditor.cpp b/src/VBox/Frontends/VirtualBox/src/settings/editors/UIHostComboEditor.cpp index 6fe67766ab1a..9b680d9643a1 100644 --- a/src/VBox/Frontends/VirtualBox/src/settings/editors/UIHostComboEditor.cpp +++ b/src/VBox/Frontends/VirtualBox/src/settings/editors/UIHostComboEditor.cpp @@ -147,19 +147,19 @@ QString UINativeHotKey::toString(int iKeyCode) { case shiftKey: case rightShiftKey: - strKeyName = strKeyName.arg(QChar(kShiftUnicode)); + strKeyName = strKeyName.arg(QChar(static_cast(kShiftUnicode))); break; case optionKey: case rightOptionKey: - strKeyName = strKeyName.arg(QChar(kOptionUnicode)); + strKeyName = strKeyName.arg(QChar(static_cast(kOptionUnicode))); break; case controlKey: case rightControlKey: - strKeyName = strKeyName.arg(QChar(kControlUnicode)); + strKeyName = strKeyName.arg(QChar(static_cast(kControlUnicode))); break; case cmdKey: case kEventKeyModifierRightCmdKeyMask: - strKeyName = strKeyName.arg(QChar(kCommandUnicode)); + strKeyName = strKeyName.arg(QChar(static_cast(kCommandUnicode))); break; } diff --git a/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp b/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp index 2b32987cec6e..c16e988d566a 100644 --- a/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp +++ b/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp @@ -241,6 +241,7 @@ int HostDnsServiceDarwin::updateInfo(void) { CFStringRef const serverAddressRef = (CFStringRef)CFArrayGetValueAtIndex(serverArrayRef, i); if (serverAddressRef) + { if (!queryCFStringAsUtf8Str(serverAddressRef, strTmp, _16K)) { LogRel(("HostDnsServiceDarwin: idx: %u: Failed to convert address.\n", i)); @@ -273,6 +274,7 @@ int HostDnsServiceDarwin::updateInfo(void) } else LogRel(("HostDnsServiceDarwin: line %u: bad nameserver address %s\n", i, strTmp.c_str())); + } } } @@ -313,4 +315,3 @@ void HostDnsServiceDarwin::Data::performShutdownCallback(void *pInfo) AssertPtrReturnVoid(pThis->m); ASMAtomicXchgBool(&pThis->m->m_fStop, true); } - diff --git a/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp b/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp index 2c1c7c65d8b8..9b4834787974 100644 --- a/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp +++ b/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp @@ -229,7 +229,7 @@ void HostPowerServiceDarwin::checkBatteryCriticalLevel(bool *pfCriticalChanged) result = CFDictionaryGetValueIfPresent(pSource, CFSTR(kIOPSDeadWarnLevelKey), &psValue); if (result) CFNumberGetValue((CFNumberRef)psValue, kCFNumberSInt32Type, &criticalValue); - critical = remCapacity < criticalValue; + critical = remCapacity < (float)criticalValue; /* We have to take action only if we are on battery, the * previous state wasn't critical, the state has changed & the @@ -249,4 +249,3 @@ void HostPowerServiceDarwin::checkBatteryCriticalLevel(bool *pfCriticalChanged) CFRelease(pBlob); CFRelease(pSources); } -