BUG: Duplicate RPATH's on macOS>=15.4 causing installation failures
This is the rattler-build equivalent of the conda-build issue: https://github.com/conda/conda-build/issues/5671 and https://github.com/conda-forge/openusd-feedstock/runs/53327988461 .
In particular, I encountered this case in https://github.com/conda-forge/openusd-feedstock/pull/16, where the rpath processing logic on usdShaders.dylib resulted in:
2025-10-21T23:24:23.9802660Z │ │ Running codesign: "/Users/runner/miniforge3/conda-bld/bld/rattler-build_openusd_1761080859/build_env/bin/codesign" "-f" "-s" "-" "/var/folders/5k/fq5ptf2906bgfn1krb78bmj00000gn/T/openusdAyAWXa/lib/python3.10/site-packages/pxr/Sdf/_sdf.so"
2025-10-21T23:24:23.9803630Z │ │ Rpath not in prefix or allow-listed: @loader_path/../../lib - removing it
2025-10-21T23:24:23.9804990Z │ │ builtin relink for "usdShaders.dylib":
2025-10-21T23:24:23.9805720Z │ │ - changing absolute rpath from "$PREFIX/lib" to "@loader_path/../../lib"
2025-10-21T23:24:23.9806450Z │ │ - changing absolute rpath from "@loader_path/../../lib" to "@loader_path/../../lib"
2025-10-21T23:24:23.9807470Z │ │ Running codesign: "/Users/runner/miniforge3/conda-bld/bld/rattler-build_openusd_1761080859/build_env/bin/codesign" "-f" "-s" "-" "/var/folders/5k/fq5ptf2906bgfn1krb78bmj00000gn/T/openusdAyAWXa/plugin/usd/usdShaders.dylib"
2025-10-21T23:24:23.9808390Z │ │ Rpath not in prefix or allow-listed: @loader_path/. - removing it
2025-10-21T23:24:23.9809240Z │ │ builtin relink for "libusd_usdUtilsValidators.dylib":
2025-10-21T23:24:23.9810960Z │ │ - changing absolute rpath from "$PREFIX/lib" to "@loader_path/"
2025-10-21T23:24:23.9812230Z │ │ - changing absolute rpath from "@loader_path/." to "@loader_path/."
2025-10-21T23:24:23.9812950Z │ │ Rpath not in prefix or allow-listed: @loader_path/. - removing it
2025-10-21T23:24:23.9813610Z │ │ builtin relink for "libusd_hgiInterop.dylib":
2025-10-21T23:24:23.9814900Z │ │ - changing absolute rpath from "$PREFIX/lib" to "@loader_path/"
2025-10-21T23:24:23.9816950Z │ │ - changing absolute rpath from "@loader_path/." to "@loader_path/."
note how the processing logic results in a duplicated RPATH, that then resulted in (duplicate LC_RPATH '@loader_path/../../lib') errors:
│ Traceback (most recent call last):
│ File "$SRC_DIR/openusd_plugins_sanity_check.py", line 43, in main
│ if not plugin.Load():
│ pxr.Tf.ErrorException:
│ Error in 'pxrInternal_v0_25_5__pxrReserved__::PlugPlugin::_Load' at line 244 in file /Users/runner/miniforge3/conda-bld/bld/rattler-build_openusd_1761080859/work/pxr/base/plug/plugin.cpp : 'Failed to load plugin 'usdShaders': dlopen($PREFIX/plugin/usd/usdShaders.dylib, 0x0002): tried: '$PREFIX/plugin/usd/usdShaders.dylib' (duplicate LC_RPATH '@loader_path/../../lib'), '/System/Volumes/Preboot/Cryptexes/OS$PREFIX/plugin/usd/usdShaders.dylib' (no such file), '$PREFIX/plugin/usd/usdShaders.dylib' (duplicate LC_RPATH '@loader_path/../../lib') in '$PREFIX/plugin/usd/usdShaders.dylib''
│ During handling of the above exception, another exception occurred:
│ Traceback (most recent call last):
│ File "$SRC_DIR/openusd_plugins_sanity_check.py", line 62, in <module>
│ sys.exit(main())
│ File "$SRC_DIR/openusd_plugins_sanity_check.py", line 46, in main
│ load_failures.append(plugin.GetName())
│ AttributeError: 'Plugin' object has no attribute 'GetName'
│ × error Script failed with status 1
It would be great if rattler-build itself de-duplicated the RPATHs after all the processing.
Yes, I think that's something we should be able to add to rattler-build. Were you able to workaround this or is this (very) urgent?
I tried, but openusd is quite big (but fortunately quite parallel), and my workaround failed. I will probably need to iterate on a physical macOS machine to do some faster iterations.
Worst case I manually modify the rpath after installation to avoid the problem.
I tried, but openusd is quite big (but fortunately quite parallel), and my workaround failed. I will probably need to iterate on a physical macOS machine to do some faster iterations.
Yes, I couldn't check that on a physical macOS machine, and now I encountered the same problem in https://github.com/conda-forge/openusd-feedstock/pull/15 .
For anyone experiencing this, see https://github.com/conda-forge/openusd-feedstock/pull/15/commits/4fef8af422c3a10473b248a14a273d21b8eb2599 and https://github.com/conda-forge/openusd-feedstock/pull/15/commits/9f54a26faaf003605b75637e37735be8a1b6a7b1 for a possible workaround.