Bug 224602 - MacCatalyst ANGLE is linked with @loader_path/../../../libANGLE-shared.dylib
Summary: MacCatalyst ANGLE is linked with @loader_path/../../../libANGLE-shared.dylib
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: ANGLE (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on: 224603 224605
Blocks:
  Show dependency treegraph
 
Reported: 2021-04-15 05:29 PDT by Kimmo Kinnunen
Modified: 2021-04-20 14:45 PDT (History)
8 users (show)

See Also:


Attachments
Patch (1.76 KB, patch)
2021-04-20 10:01 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (1.78 KB, patch)
2021-04-20 14:18 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2021-04-15 05:29:19 PDT
MacCatalyst ANGLE is linked with @loader_path/../../../libANGLE-shared.dylib 

The path may be wrong.
The use of @loader_path is probably wrong.
ld: warning: invalid -install_name (@loader_path/../../../libANGLE-shared.dylib) in dependent dylib (/Users/kkinnunen/Build/Debug-maccatalyst/libANGLE-shared.dylib). Dylibs/frameworks which might go in dyld shared cache cannot link with dylib that uses @rpath, @loader_path,
Comment 1 Kimmo Kinnunen 2021-04-15 05:30:07 PDT
<rdar://76602857>
Comment 2 Alex Christensen 2021-04-20 09:56:56 PDT
DYLIB_INSTALL_NAME_BASE is probably wrong when WK_ALTERNATE_FRAMEWORKS_DIR is used.
Comment 3 Alex Christensen 2021-04-20 09:59:44 PDT
I'm planning to fix this this afternoon.
Comment 4 Alex Christensen 2021-04-20 10:01:40 PDT
Created attachment 426562 [details]
Patch
Comment 5 EWS Watchlist 2021-04-20 10:02:32 PDT
Note that there are important steps to take when updating ANGLE. See https://trac.webkit.org/wiki/UpdatingANGLE
Comment 6 Kimmo Kinnunen 2021-04-20 11:05:38 PDT
Comment on attachment 426562 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=426562&action=review

> Source/ThirdParty/ANGLE/Configurations/ANGLE-dynamic.xcconfig:28
>  DYLIB_INSTALL_NAME_BASE_WK_RELOCATABLE_FRAMEWORKS_YES = @loader_path/../../../;

Out of curiosity, in which this loader_path is correct?
Comment 7 Alex Christensen 2021-04-20 12:14:45 PDT
The use of @loader_path is necessary when we use WK_RELOCATABLE_FRAMEWORKS because we need to be able to relocate them and have dyld still find the dylib relative to the framework.
Comment 8 Alex Christensen 2021-04-20 13:32:21 PDT
Comment on attachment 426562 [details]
Patch

When building project ANGLE:
INSTALL_PATH\=/System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks
DYLIB_INSTALL_NAME_BASE\=/System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks

When building project ANGLE_iosmac before this change:
INSTALL_PATH\=/System/iOSSupport//System/Library/PrivateFrameworks/WebCore.framework/Versions/A/Frameworks
DYLIB_INSTALL_NAME_BASE\=@loader_path/../../../

When building project ANGLE_iosmac after this change:
INSTALL_PATH\=/System/iOSSupport//System/Library/PrivateFrameworks/WebCore.framework/Versions/A/Frameworks
DYLIB_INSTALL_NAME_BASE\=/System/iOSSupport//System/Library/PrivateFrameworks/WebCore.framework/Versions/A/Frameworks

This leads me to believe this will fix the problem.
Comment 9 Alexey Proskuryakov 2021-04-20 14:09:30 PDT
Comment on attachment 426562 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=426562&action=review

> Source/ThirdParty/ANGLE/Configurations/ANGLE-dynamic.xcconfig:26
> +DYLIB_INSTALL_NAME_BASE_USE_ALTERNATE_FRAMEWORKS_DIR_YES = @(INSTALL_PATH);

Looking at other projects, and even at the below line, we are using DYLIB_INSTALL_NAME_BASE for this case, not INSTALL_PATH.

There is probably no difference in practice, but let's use the same solution as elsewhere.
Comment 10 Alex Christensen 2021-04-20 14:15:58 PDT
I verified that does the same thing so I'll do it.

I also verified that when using relocatable frameworks, DYLIB_INSTALL_NAME_BASE is @loader_path/../../../ so there *should* be no problem there.
Comment 11 Alex Christensen 2021-04-20 14:18:40 PDT
Created attachment 426589 [details]
Patch
Comment 12 EWS 2021-04-20 14:45:29 PDT
Committed r276318 (236799@main): <https://commits.webkit.org/236799@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426589 [details].