Skip to content

Commit

Permalink
[xplat] remove -weak_framework (#89233)
Browse files Browse the repository at this point in the history
Summary: The `-weak_framework` flag is no longer necessary, Buck will weakly link frameworks depending on the `target_sdk_version` of the binary being linked.

Test Plan:
Compare IG load commands before and after change with P553208168
```
load command difference in Instagram.app/Frameworks/InstagramXplatFramework.framework/InstagramXplatFramework
 --- /tmp/tmpvd97s2v0    2022-11-16 12:13:54.082910598 -0800
+++ /tmp/tmpj20r_4ca    2022-11-16 12:13:54.082910598 -0800
@@ -9,7 +9,7 @@
        /System/Library/Frameworks/CoreHaptics.framework/CoreHaptics (compatibility version 1.0.0, current version 1.0.0, weak)
        /System/Library/Frameworks/CoreImage.framework/CoreImage (compatibility version 1.0.0, current version 5.0.0)
        /System/Library/Frameworks/CoreLocation.framework/CoreLocation (compatibility version 1.0.0, current version 2780.0.17)
-       /System/Library/Frameworks/CoreML.framework/CoreML (compatibility version 1.0.0, current version 1.0.0, weak)
+       /System/Library/Frameworks/CoreML.framework/CoreML (compatibility version 1.0.0, current version 1.0.0)
        /System/Library/Frameworks/CoreMedia.framework/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
        /System/Library/Frameworks/CoreServices.framework/CoreServices (compatibility version 1.0.0, current version 1226.0.0)
        /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony (compatibility version 1.0.0, current version 0.0.0)
@@ -33,9 +33,9 @@
        /System/Library/Frameworks/Security.framework/Security (compatibility version 1.0.0, current version 60420.40.34)
        /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration (compatibility version 1.0.0, current version 1241.40.2)
        /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 6109.1.108)
-       /System/Library/Frameworks/UserNotifications.framework/UserNotifications (compatibility version 1.0.0, current version 1.0.0, weak)
+       /System/Library/Frameworks/UserNotifications.framework/UserNotifications (compatibility version 1.0.0, current version 1.0.0)
        /System/Library/Frameworks/VideoToolbox.framework/VideoToolbox (compatibility version 1.0.0, current version 1.0.0)
-       /System/Library/Frameworks/WebKit.framework/WebKit (compatibility version 1.0.0, current version 614.2.9, weak)
+       /System/Library/Frameworks/WebKit.framework/WebKit (compatibility version 1.0.0, current version 614.2.9)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
        /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.8)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.32.0)
```
Both these changes are correct, WebKit is available from 8.0, UserNotifications from 10.0 and CoreML from 11.0. Instagram has a deployment target of 12.4.

Reviewed By: ebgraham

Differential Revision: D41348639

Pull Request resolved: #89233
Approved by: https://github.com/malfet
  • Loading branch information
rmaz authored and pytorchmergebot committed Nov 18, 2022
1 parent 19e66fc commit 12a9744
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions c2_defs.bzl
Expand Up @@ -221,26 +221,13 @@ def get_c2_fbobjc_ios_frameworks():
frameworks = []

if get_c2_mpscnn():
frameworks.append(
frameworks.extend([
"$SDKROOT/System/Library/Frameworks/Metal.framework",
)
"$SDKROOT/System/Library/Frameworks/MetalPerformanceShaders.framework",
])

return frameworks

def get_c2_fbobjc_linker_flags():
flags = []

if get_c2_mpscnn():
# Need linker flags as no platform_frameworks exist, and we can't
# use MPSCNN on x86_64.
# We use weak_framework as it's iOS 10
flags = [
"-L$SDKROOT/System/Library/Frameworks/MetalPerformanceShaders.framework",
"-weak_framework",
"MetalPerformanceShaders",
]
return flags

def get_c2_fbobjc_exported_preprocessor_flags():
flags = []

Expand Down Expand Up @@ -311,12 +298,6 @@ def get_c2_default_cxx_args():
STATIC_LIBRARY_IOS_CONFIG,
extra_target_config = C2_FBOBJC_EXTRA_TARGET_CONFIG,
),
fbobjc_exported_platform_linker_flags = [
(
"iphoneos",
get_c2_fbobjc_linker_flags(),
),
],
fbobjc_exported_platform_preprocessor_flags = [
(
"iphoneos",
Expand Down

0 comments on commit 12a9744

Please sign in to comment.