Skip to content

Commit 9dfbde8

Browse files
committed
macOS: stabilize OpenRV build (Qt 6.6, AGL workaround, disable optional plugins)
This commit stabilizes OpenRV on macOS (Apple Silicon, macOS Tahoe) and completes a successful RV.app build. Key changes: - Added build options to disable optional components: - RV_BUILD_PYSIDE (disable PySide6) - RV_BUILD_NDI (disable NDI output plugin) - RV_BUILD_TESTS (disable test targets) - Implemented a dummy AGL.framework workaround to satisfy Qt/OpenGL link requirements on modern macOS where AGL is removed. - Fixed multiple NULL-pointer crashes in Mu/Python integration by adding defensive checks before Python C-API calls. - Hardened Python startup paths to tolerate missing optional Qt/PySide components. - Ensured PySide6 and Homebrew Qt are not pulled into the build. - Verified RV.app builds and launches successfully on Apple Silicon (arm64). Result: - RV.app builds successfully on macOS using Qt 6.6.x. - No startup crashes. - Optional plugin warnings are non-fatal. - This commit represents a stable macOS build checkpoint. Note: RV.app is not committed to the repository. Built artifacts are excluded per standard practice.
1 parent d484a9c commit 9dfbde8

File tree

19 files changed

+1148
-637
lines changed

19 files changed

+1148
-637
lines changed

BUILD_MACOS_FIXES.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# macOS Build Fixes for OpenRV
2+
3+
This document summarizes the fixes applied to enable building OpenRV on macOS (Apple Silicon).
4+
5+
## Issues Identified and Fixed
6+
7+
### 1. Qt Path Priority Issue (FIXED)
8+
**Problem:** CMake was finding Qt6 from Homebrew (`/opt/homebrew/lib/cmake/Qt6`) instead of the user-specified Qt installation, causing build failures because Homebrew Qt lacks QtWebEngineCore.
9+
10+
**Fix Applied:** Modified `cmake/dependencies/qt6.cmake` to:
11+
- Prepend the specified Qt location to `CMAKE_PREFIX_PATH` (instead of appending)
12+
- Clear cached Qt6 variables to force re-discovery with the specified location
13+
- Updated error message to reference Qt 6.5.3 instead of Qt 5.15
14+
15+
**Files Changed:**
16+
- `cmake/dependencies/qt6.cmake`
17+
18+
### 2. Missing Dependencies
19+
20+
#### Required but Missing:
21+
1. **Qt 6.5.3** - Must be installed from official Qt installer (not Homebrew)
22+
- Download from: https://www.qt.io/download-open-source
23+
- Install Qt 6.5.3 to `~/Qt/6.5.3/macos` or similar location
24+
- Set `QT_HOME` environment variable or let `rvcmds.sh` auto-detect
25+
26+
2. **Xcode Developer Directory** - Currently pointing to Command Line Tools
27+
- Run: `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer`
28+
- Verify with: `xcode-select -p` (should return `/Applications/Xcode.app/Contents/Developer`)
29+
30+
#### Already Installed:
31+
- ✅ CMake 3.31.2 (meets requirement of 3.31.X+)
32+
- ✅ Ninja build system
33+
- ✅ Most Homebrew packages (ninja, readline, sqlite, xz, zlib, autoconf, automake, libtool, python@3.11, yasm, clang-format, black, meson, nasm, pkg-config, glew, rust)
34+
35+
#### Potentially Missing:
36+
-`tcl-tk` - Now installed
37+
38+
## Build Instructions
39+
40+
### Prerequisites Setup
41+
42+
1. **Install Qt 6.5.3:**
43+
```bash
44+
# Download Qt 6.5.3 from https://www.qt.io/download-open-source
45+
# Install to default location: ~/Qt/6.5.3/macos
46+
```
47+
48+
2. **Fix Xcode Developer Directory:**
49+
```bash
50+
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
51+
xcode-select -p # Verify it returns /Applications/Xcode.app/Contents/Developer
52+
```
53+
54+
3. **Install Missing Homebrew Packages (if needed):**
55+
```bash
56+
brew install tcl-tk # Already installed
57+
```
58+
59+
### Building OpenRV
60+
61+
1. **Navigate to OpenRV directory:**
62+
```bash
63+
cd /Users/tonylyons/Dropbox/Public/GitHub/OpenRV
64+
```
65+
66+
2. **Source the build commands:**
67+
```bash
68+
export RV_VFX_PLATFORM=CY2024
69+
source rvcmds.sh
70+
```
71+
72+
3. **First-time build:**
73+
```bash
74+
rvbootstrap
75+
```
76+
77+
4. **Subsequent builds:**
78+
```bash
79+
rvmk
80+
```
81+
82+
### Build Output Location
83+
84+
- **Release build:** `_build/stage/app/RV.app/Contents/MacOS/RV`
85+
- **Debug build:** `_build_debug/stage/app/RV.app/Contents/MacOS/RV`
86+
87+
## CMake Configuration
88+
89+
The build system will automatically:
90+
- Download and build most dependencies (Boost, OpenEXR, OCIO, Python, etc.)
91+
- Use the specified Qt installation via `RV_DEPS_QT_LOCATION`
92+
- Configure for Apple Silicon (arm64) architecture
93+
94+
## Notes
95+
96+
- The fix ensures that when `RV_DEPS_QT_LOCATION` is specified, CMake will prioritize that location over system-installed Qt (like Homebrew)
97+
- All other dependencies are built from source during the build process
98+
- The build process uses a Python virtual environment (`.venv`) for Python dependencies

BUILD_REQUIREMENTS.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# OpenRV macOS Build Requirements
2+
3+
## Current Status
4+
5+
**Qt 6.6.3 detected** at `/Users/tonylyons/Qt/6.6.3/macos`
6+
**QtWebEngine confirmed present**
7+
**Qt6Multimedia missing** - Required for audio functionality
8+
9+
## Required Qt Components
10+
11+
OpenRV requires the following Qt 6.6.3 components:
12+
13+
1.**Qt WebEngine** - Already installed
14+
2.**Qt Multimedia** - **MISSING** - Required for audio playback
15+
16+
## Fix: Install Qt Multimedia
17+
18+
**Install via Qt Maintenance Tool:**
19+
20+
```bash
21+
open ~/Qt/MaintenanceTool
22+
```
23+
24+
Then:
25+
1. Click "Add or remove components"
26+
2. Select your Qt 6.6.3 installation
27+
3. Expand "Qt 6.6.3" → "Additional Libraries"
28+
4. Check "Qt Multimedia" component
29+
5. Click "Next" and complete the installation
30+
31+
**Verify installation:**
32+
```bash
33+
ls -d /Users/tonylyons/Qt/6.6.3/macos/lib/cmake/Qt6Multimedia
34+
```
35+
Should show the directory exists.
36+
37+
## Build Commands (After Installing Qt Multimedia)
38+
39+
```bash
40+
cd /Users/tonylyons/Dropbox/Public/GitHub/OpenRV
41+
export RV_VFX_PLATFORM=CY2024
42+
export QT_HOME=/Users/tonylyons/Qt/6.6.3/macos
43+
source rvcmds.sh
44+
rvbootstrap
45+
```
46+
47+
## Verification
48+
49+
To verify Qt detection is working (not using Homebrew Qt):
50+
- Check that `QT_HOME` points to `/Users/tonylyons/Qt/6.6.3/macos`
51+
- CMake should find Qt components from that location, not `/opt/homebrew/lib/cmake/Qt6`

BUILD_STATUS.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# OpenRV macOS Build Status
2+
3+
## Current Status
4+
5+
**Qt Detection Fixed**: CMake now correctly prioritizes the specified Qt installation (`/Users/tonylyons/Qt/6.5.3/macos`) over Homebrew Qt.
6+
7+
**Build Environment Ready**: All required Homebrew packages installed, CMake configured, Python virtual environment set up.
8+
9+
**QtWebEngine Missing**: Qt 6.5.3 installation is missing the QtWebEngine component, which is required for building OpenRV.
10+
11+
## Required Action: Install QtWebEngine
12+
13+
QtWebEngine must be installed via the Qt Maintenance Tool. Follow these steps:
14+
15+
1. **Open Qt Maintenance Tool:**
16+
```bash
17+
open ~/Qt/MaintenanceTool
18+
```
19+
(If not found there, check `~/Qt/` directory or re-download from https://www.qt.io/download-open-source)
20+
21+
2. **In Qt Maintenance Tool:**
22+
- Click "Add or remove components"
23+
- Select your Qt 6.5.3 installation
24+
- Expand "Qt 6.5.3" → "Additional Libraries"
25+
- Check "Qt WebEngine" component
26+
- Click "Next" and complete the installation
27+
28+
3. **Verify Installation:**
29+
```bash
30+
ls -d /Users/tonylyons/Qt/6.5.3/macos/lib/cmake/Qt6WebEngineCore
31+
```
32+
Should show the directory exists.
33+
34+
## Build Commands (After Installing QtWebEngine)
35+
36+
Once QtWebEngine is installed, run:
37+
38+
```bash
39+
cd /Users/tonylyons/Dropbox/Public/GitHub/OpenRV
40+
export RV_VFX_PLATFORM=CY2024
41+
export QT_HOME=/Users/tonylyons/Qt/6.5.3/macos
42+
source rvcmds.sh
43+
rvbootstrap
44+
```
45+
46+
Or step by step:
47+
```bash
48+
source rvcmds.sh
49+
rvsetup # Install Python dependencies (already done)
50+
rvcfg # Configure CMake
51+
rvbuild # Build the project
52+
```
53+
54+
## Final Output Location
55+
56+
After successful build:
57+
- **Release build:** `_build/stage/app/RV.app/Contents/MacOS/RV`
58+
- **Debug build:** `_build_debug/stage/app/RV.app/Contents/MacOS/RV`
59+
60+
**To launch:**
61+
```bash
62+
open _build/stage/app/RV.app
63+
# or
64+
_build/stage/app/RV.app/Contents/MacOS/RV
65+
```
66+
67+
## Fixes Applied
68+
69+
1. **Qt Path Priority** (`cmake/dependencies/qt6.cmake`):
70+
- Prepend Qt location to `CMAKE_PREFIX_PATH` to prioritize over Homebrew
71+
- Clear cached Qt6 variables to force re-discovery
72+
- Updated error message for Qt 6.5.3
73+
74+
2. **QtWebEngine Installation Guidance**:
75+
- Clear error message directing users to install via Qt Maintenance Tool
76+
- Qt 6.5.3 WebEngine cannot be auto-downloaded (unlike 6.8.3)
77+
78+
## Verification
79+
80+
To verify Qt detection is working correctly (not picking up Homebrew Qt):
81+
82+
```bash
83+
cd /Users/tonylyons/Dropbox/Public/GitHub/OpenRV
84+
export RV_VFX_PLATFORM=CY2024
85+
export QT_HOME=/Users/tonylyons/Qt/6.5.3/macos
86+
source rvcmds.sh
87+
rvcfg 2>&1 | grep -i "qt\|webengine"
88+
```
89+
90+
Should show:
91+
- `Using Qt 6.5 installation already set at /Users/tonylyons/Qt/6.5.3/macos`
92+
- No references to `/opt/homebrew/lib/cmake/Qt6`

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ INCLUDE(rv_targets) # RV's build platform definitions
9494
INCLUDE(rv_globals) # RV's CMake-build global variables
9595
INCLUDE(rv_stage) # RV's local appplication packaging
9696
INCLUDE(rv_vfx)
97-
INCLUDE(CTest)
97+
IF(RV_BUILD_TESTS)
98+
INCLUDE(CTest)
99+
ENABLE_TESTING()
100+
ELSE()
101+
MESSAGE(STATUS "Tests are disabled (RV_BUILD_TESTS=OFF)")
102+
ENDIF()
98103

99104
# The 'cxx_defaults' module will sets global C/C++ compiler defaults Note that variable such as 'CMAKE_CXX_COMPILER_ID' is only available after the 'project'
100105
# statement just above.

cmake/defaults/rv_options.cmake

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,25 @@ SET_PROPERTY(
116116
CACHE RV_FFMPEG
117117
PROPERTY STRINGS ${_RV_FFMPEG}
118118
)
119+
120+
#
121+
# PySide option
122+
#
123+
# This option controls whether PySide2/PySide6 is built as part of the Python3 dependency. PySide is not required for RV runtime, but may be needed for Python
124+
# bindings.
125+
#
126+
OPTION(RV_BUILD_PYSIDE "Build PySide2/PySide6 as part of Python3 dependency" ON)
127+
128+
#
129+
# NDI plugin option
130+
#
131+
# This option controls whether the NDI output plugin is built. NDI is an optional plugin that requires the NDI SDK to be installed.
132+
#
133+
OPTION(RV_BUILD_NDI "Build NDI output plugin (requires NDI SDK)" ON)
134+
135+
#
136+
# Tests option
137+
#
138+
# This option controls whether test targets are built and enabled. Tests are not required for RV runtime.
139+
#
140+
OPTION(RV_BUILD_TESTS "Build and enable test targets" ON)

cmake/defaults/rv_targets.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,29 @@ IF(APPLE)
9090
-DOSX_VERSION=${_macos_version_string}
9191
)
9292

93+
# AGL framework was deprecated and removed in macOS 10.14+ Qt6::OpenGL adds -framework AGL, but it doesn't exist in newer macOS SDKs Check if AGL exists in
94+
# the SDK, and if not, use our dummy framework
95+
EXECUTE_PROCESS(
96+
COMMAND find ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks -name "AGL.framework" 2>/dev/null
97+
OUTPUT_VARIABLE AGL_FRAMEWORK_PATH
98+
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
99+
)
100+
IF(AGL_FRAMEWORK_PATH STREQUAL "")
101+
# AGL doesn't exist in SDK - add our dummy AGL framework to framework search path This allows the linker to find -framework AGL without modifying Qt
102+
SET(_dummy_agl_framework_path
103+
"${CMAKE_BINARY_DIR}/frameworks"
104+
)
105+
IF(EXISTS "${_dummy_agl_framework_path}/AGL.framework")
106+
# Add dummy AGL framework directory to framework search path
107+
ADD_LINK_OPTIONS(-F "${_dummy_agl_framework_path}")
108+
MESSAGE(STATUS "Using dummy AGL framework at ${_dummy_agl_framework_path}/AGL.framework")
109+
ELSE()
110+
# Fallback: use undefined dynamic lookup if framework doesn't exist This is less ideal but allows build to proceed
111+
ADD_LINK_OPTIONS(-Wl,-undefined,dynamic_lookup)
112+
MESSAGE(WARNING "Dummy AGL framework not found at ${_dummy_agl_framework_path}/AGL.framework, using -undefined dynamic_lookup fallback")
113+
ENDIF()
114+
ENDIF()
115+
93116
#
94117
# CXXFLAGS_DARWIN += -DOSX_VERSION=\"$(shell sw_vers -productVersion)\"
95118
#

cmake/dependencies/imgui.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,24 @@ SET(_patch_command_for_imgui
120120
patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/imgui_cpp_h.patch
121121
)
122122

123+
# On macOS, add framework search path for dummy AGL framework
124+
IF(RV_TARGET_DARWIN)
125+
SET(_dummy_agl_framework_path
126+
"${CMAKE_BINARY_DIR}/frameworks"
127+
)
128+
IF(EXISTS "${_dummy_agl_framework_path}/AGL.framework")
129+
# Add framework search path so linker can find dummy AGL framework
130+
LIST(APPEND _configure_options "-DCMAKE_EXE_LINKER_FLAGS=-F${_dummy_agl_framework_path}")
131+
LIST(APPEND _configure_options "-DCMAKE_SHARED_LINKER_FLAGS=-F${_dummy_agl_framework_path}")
132+
LIST(APPEND _configure_options "-DCMAKE_MODULE_LINKER_FLAGS=-F${_dummy_agl_framework_path}")
133+
ELSE()
134+
# Fallback: use undefined dynamic lookup if framework doesn't exist
135+
LIST(APPEND _configure_options "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-undefined,dynamic_lookup")
136+
LIST(APPEND _configure_options "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-undefined,dynamic_lookup")
137+
LIST(APPEND _configure_options "-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-undefined,dynamic_lookup")
138+
ENDIF()
139+
ENDIF()
140+
123141
EXTERNALPROJECT_ADD(
124142
${_target}
125143
URL ${_imgui_download_url}

0 commit comments

Comments
 (0)