As a workaround use the "old" linker, with the -ld_classic linker flag. For more info see the man page of ld or this thread. You will get slower link times for example though.
Post
Replies
Boosts
Views
Activity
There has to be some difference between RealityKit and RealityFoundation because the first one is picked up from /System/iOSSupport/System/Library/Frameworks/ if this is the first path in DYLD_FRAMEWORK_PATH, but for second the mentioned override happens. Anyway I need more extensive study on dyld source for better understanding.
The options I found so far:
Replace LC_LOAD_DYLIB / LC_ID_DYLIB in the executable to point to a custom linker, which given the amount of hardcoded /usr/lib/dyld paths is probably not an option, and I would guess the linker location is also enforced by the kernel.
Write a custom XCTest driver.
Remove / rename RealityKit.framework from Xcode provided SharedFrameworks. This actually makes the executable start and run, and seems like a cheap workaround to allow running and testing RealityKit independent code.
Will go with the last one for now.
[quote='788794022, DTS Engineer, /thread/755856?answerId=788794022#788794022']
You could potentially get around that by weak linking to the specific symbols
[/quote]
That's what I meant by "weakly loading".
[quote='788794022, DTS Engineer, /thread/755856?answerId=788794022#788794022']
what ends up bringing it RealityKit?
[/quote]
It's not that RealityKit is brought in regardless if it's used, but that a different incompatible framework is loaded if /System/iOSSupport/System/Library/Frameworks is prepended to DYLD_FRAMEWORK_PATH.
dyld[44019]: find path "/System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation"
dyld[44019]: possible path(DYLD_FRAMEWORK/LIBRARY_PATH): "/System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation"
dyld[44019]: no pseudo-dylibs to search
dyld[44019]: found: dylib-from-cache: (0x0A52) "/System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation"
// ...
dyld[44019]: found '/Applications/Xcode.app/Contents/SharedFrameworks/RealityFoundation.framework/Versions/A/RealityFoundation' which invalidates PrebuiltLoader for '/System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation'
dyld[44019]: PrebuiltLoader 0x24059cf38 'RealityFoundation' not used because a file was found that overrides it
dyld[44019]: using JustInTimeLoader 0x1143e1c20 for /System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation
dyld[44019]: <91D6CFF8-6AC5-34BC-B1FE-83EA3CB7C7E3> /System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation
// ...
dyld[44019]: find path "/System/Library/PrivateFrameworks/RealityIO.framework/Versions/A/RealityIO"
dyld[44019]: possible path(DYLD_FRAMEWORK/LIBRARY_PATH): "/System/iOSSupport/System/Library/Frameworks/RealityIO.framework/Versions/A/RealityIO"
dyld[44019]: no pseudo-dylibs to search
dyld[44019]: possible path(DYLD_FRAMEWORK/LIBRARY_PATH): "/Users/spacecadet/projects/shapr3d/src/shapr3d/build/cmake/DerivedData/Shapr3D/Build/Products/Debug-maccatalyst/RealityIO.framework/Versions/A/RealityIO"
dyld[44019]: no pseudo-dylibs to search
dyld[44019]: possible path(DYLD_FRAMEWORK/LIBRARY_PATH): "/Users/spacecadet/projects/shapr3d/src/shapr3d/build/products/Debug-maccatalyst/RealityIO.framework/Versions/A/RealityIO"
dyld[44019]: no pseudo-dylibs to search
dyld[44019]: possible path(DYLD_FRAMEWORK/LIBRARY_PATH): "/Applications/Xcode.app/Contents/SharedFrameworks/RealityIO.framework/Versions/A/RealityIO"
dyld[44019]: no pseudo-dylibs to search
dyld[44019]: found: dylib-from-disk-to-override-cache: "/Applications/Xcode.app/Contents/SharedFrameworks/RealityIO.framework/Versions/A/RealityIO"
dyld[44019]: using JustInTimeLoader 0x1143e5410 for /Applications/Xcode.app/Contents/SharedFrameworks/RealityIO.framework/Versions/A/RealityIO
dyld[44019]: <6194C114-E51C-38BF-AC13-23DF6A3435E3> /Applications/Xcode.app/Contents/SharedFrameworks/RealityIO.framework/Versions/A/RealityIO
// ...
dyld[44019]: find path "@rpath/RealityFoundation.framework/Versions/A/RealityFoundation"
dyld[44019]: possible path(DYLD_FRAMEWORK/LIBRARY_PATH): "/System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation"
dyld[44019]: found: already-loaded-by-path: "/System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation"
// and then in the end
dyld[44019]: Symbol not found: _$s10RealityKit11__EntityRefV0A10FoundationE28__validInteractionIdentifier0E04UUIDVvg
Referenced from: <6194C114-E51C-38BF-AC13-23DF6A3435E3> /Applications/Xcode.app/Contents/SharedFrameworks/RealityIO.framework/Versions/A/RealityIO
Expected in: <91D6CFF8-6AC5-34BC-B1FE-83EA3CB7C7E3> /System/iOSSupport/System/Library/Frameworks/RealityFoundation.framework/Versions/A/RealityFoundation
[quote='788595022, DTS Engineer, /thread/755856?answerId=788595022#788595022']
I had a good look at this today and I can’t see any reasonable way around it )-:
[/quote]
Thanks for checking anyway.
Would it be possible to weakly load the framework somehow, so that at least we can run other tests without having to remove code at build time?
Yes, it's FB13800154
Still present in Xcode 15.0 (15A240d). At least with the new debug console the messages of the "com.apple.coreui" subsystem can be filtered out.
Indeed, thanks. Somehow I was expecting the same behaviour as with ld64.
By the way do you know how to access the source of ld_prime? ld64 wasn't updated recently, and ld -v points to dyld. The Xcode project there indeed has an ld-prime target and also references an ld directory but it's missing from the source tree.
FB13258697