Skip to content

Commit 7351285

Browse files
authored
Fix building on CY2025 on MacOS (#1031)
### Fix building with MacOS on CY2025 ### Summarize your change. The versions of openexr and png included with CY2025 introduce rpath setups, which ends up conflicting with RV's own rpath management on macos. And resulting in build errors like the following when RV tries to overwrite them. ``` /Users/nelsonr/git/rv/_build_debug/RV_DEPS_OPENEXR/install/lib/libOpenEXRUtil-3_2_d.32.3.3.6.dylib (for architecture arm64) option "-add_rpath @loader_path/../lib" would duplicate path, file already has LC_RPATH for: @loader_path/../lib ``` The simplest olution is just to disable the rpath generation in those libraries, and let RV handle it as its currently doing for earlier versions. An corollary fix was required in the RV rpath script that removes rpaths to not to fail if there is no rpath (since we now effectively remove it at the build stage). Another script later in the build process will add the correct rpath back in. ### Describe the reason for the change. Fix building on MacOS with CY2025 ### Describe what you have tested and on which operating system. MacOS 26.1 ### Add a list of changes, and note any that might need special attention during the review. ### If possible, provide screenshots. Signed-off-by: Roger Nelson <[email protected]>
1 parent fe14d08 commit 7351285

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

cmake/dependencies/openexr.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ ENDIF()
163163
# OpenEXR tools are not needed.
164164
LIST(APPEND _configure_options "-DOPENEXR_BUILD_TOOLS=OFF")
165165

166+
# Disable OpenEXR's automatic rpath setup to avoid conflicts with RV's rpath management
167+
# OpenEXR 3.3+ automatically adds @loader_path/../lib which conflicts with our install scripts
168+
LIST(APPEND _configure_options "-DCMAKE_INSTALL_RPATH=")
169+
166170
EXTERNALPROJECT_ADD(
167171
${_target}
168172
URL "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v${_version}.zip"

cmake/dependencies/png.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ LIST(APPEND _configure_options "-DPNG_EXECUTABLES=OFF")
3939
LIST(APPEND _configure_options "-DPNG_TESTS=OFF")
4040
LIST(APPEND _configure_options "-DPNG_FRAMEWORK=OFF")
4141

42+
# Disable PNG's automatic rpath setup to avoid conflicts with RV's rpath management
43+
LIST(APPEND _configure_options "-DCMAKE_INSTALL_RPATH=")
44+
4245
EXTERNALPROJECT_ADD(
4346
${_target}
4447
URL ${_download_url}

src/build/remove_absolute_rpath.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ def delete_rpath(object_file_path, rpath):
7878
rpath,
7979
object_file_path,
8080
]
81-
subprocess.run(delete_rpath_command).check_returncode()
81+
result = subprocess.run(delete_rpath_command, capture_output=True, text=True)
82+
# Don't fail if the rpath doesn't exist (can happen during incremental rebuilds)
83+
if result.returncode != 0:
84+
if "no LC_RPATH load command" not in result.stderr:
85+
# Only fail for actual errors, not missing rpaths
86+
result.check_returncode()
87+
else:
88+
logging.info(f"\tRpath {rpath} not found in {object_file_path}, skipping")
8289

8390

8491
def change_shared_library_path(object_file_path, old_library_path):

0 commit comments

Comments
 (0)