When trying to use a third party dylib, like CoherentUI, on OS X, when trying to get the editor to run, I get the following error:
LogMac:Warning: dlopen failed: dlopen(/PathToProject/Plugins/CoherentUI/Binaries/Mac/UE4Editor-CoherentUIPlugin-Mac-Debug.dylib, 5): Library not loaded: @executable_path/libCoherentUI.dylib
Referenced from: /PathToProject/Plugins/CoherentUI/Binaries/Mac/UE4Editor-CoherentUIPlugin-Mac-Debug.dylib
Reason: image not found
LogModuleManager:Warning: ModuleManager: Unable to load module '/PathToProject/Plugins/CoherentUI/Binaries/Mac/UE4Editor-CoherentUIPlugin-Mac-Debug.dylib' because the file couldn't be loaded by the OS.
When running otool on the Libraries I found the following:
otool -L UE4Editor-CoherentUIPlugin-Mac-Debug.dylib
@rpath/UE4Editor-CoherentUIPlugin-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
@executable_path/libCoherentUI.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport (compatibility version 1.0.0, current version 263.9.0)
/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication (compatibility version 1.0.0, current version 57020.1.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)
/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.8.0)
/System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
@rpath/UE4Editor-SlateCore-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
@rpath/UE4Editor-Slate-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
@rpath/UE4Editor-InputCore-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
@rpath/UE4Editor-Core-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
@rpath/UE4Editor-CoreUObject-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
@rpath/UE4Editor-Engine-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
@rpath/UE4Editor-RenderCore-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
@rpath/UE4Editor-RHI-Mac-Debug.dylib (compatibility version 4.7.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
otool -L libCoherentUI.dylib:
@executable_path/libCoherentUI.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.44.0)
/System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
Reviewing all the libraries used by UE, this is the only instance I can find that uses @executable_path
, which might be the reason why it cannot find the dylib. (For example the ThirdParty CEF binary has @rpath
instead of @executable_path
in its listing)
Looking at the LinkerCommand in the MacToolChain, I find that it runs this command:
xcrun install_name_tool -change libCoherentUI.dylib @rpath/libCoherentUI.dylib "/PathToProject/Plugins/CoherentUI/Binaries/Mac/UE4Editor-CoherentUIPlugin-Mac-Debug.dylib"
Since the library has @executable_path/libCoherentUI.dylib
and not just libCoherentUI.dylib
, I believe the change isn’t doing what it is supposed to do.
I’m not an expert linker, but I’m curious if this is a problem in the tool chain?