Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Fix build of glog & Flipper-Glog on Apple Silicon #32486

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions packages/rn-tester/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PODS:
- Flipper-Glog
- libevent (~> 2.1.12)
- OpenSSL-Universal (= 1.1.180)
- Flipper-Glog (0.3.6)
- Flipper-Glog (0.3.9)
- Flipper-PeerTalk (0.0.4)
- Flipper-RSocket (1.4.3):
- Flipper-Folly (~> 2.6)
Expand Down Expand Up @@ -724,7 +724,7 @@ DEPENDENCIES:
- Flipper-DoubleConversion (= 3.1.7)
- Flipper-Fmt (= 7.1.7)
- Flipper-Folly (= 2.6.7)
- Flipper-Glog (= 0.3.6)
- Flipper-Glog (= 0.3.9)
- Flipper-PeerTalk (= 0.0.4)
- Flipper-RSocket (= 1.4.3)
- FlipperKit (= 0.99.0)
Expand Down Expand Up @@ -880,56 +880,56 @@ SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBLazyVector: b81a2b70c72d8b0aefb652cea22c11e9ffd02949
FBReactNativeSpec: c72b6aa43f36a4bfa45376f24ac5d10339070635
FBLazyVector: bf8edf9a0f1cbd285510d1c952242b0e793aa995
FBReactNativeSpec: d07ef80c9c47cdf1f295e29a0c23024154e1cdff
Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c
Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b
Flipper-Folly: 83af37379faa69497529e414bd43fbfc7cae259a
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
Flipper-Glog: 05579840e2750ec907ee2f81544f41ad76a7cae4
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541
FlipperKit: d8d346844eca5d9120c17d441a2f38596e8ed2b9
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85
glog: c10b67b343303f51715e5c5eedb18a41402f350a
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
RCT-Folly: 803a9cfd78114b2ec0f140cfa6fa2a6bafb2d685
RCTRequired: af2d6080a4b9ba0885b28ca78879a92066c71cab
RCTTypeSafety: c7a7f67ae5b1b986b78d817baa408fc984ab7c0c
React: f64c9f6db5428717922a3292ba6a448615a2e143
React-callinvoker: c5d61e29df57793f0dc10ec2bc01c846f863e51f
RCTRequired: 5c361764bef1a581e22428e064ef2143bf26383a
RCTTypeSafety: 04cc19cc554880f615e7ec166b6f06bb1bb23d8b
React: 7cc5a0fa9604eedd01a2bdc5e117ad538ff2485a
React-callinvoker: 16f1833d036f7b684a2b06bc5fa134258d8bdbd4
React-Codegen: 5c20632d128f21b4b94d00d70690821a8ac5dbef
React-Core: 22bc86b79dd931dbfb7fd2af91a35a98d41ceb64
React-CoreModules: a8e2bdc1ebbf8d440478456197abd58d1691f61a
React-cxxreact: cfc1663dae1ea52b465bbf021ef7b1527c5dc80c
React-Fabric: 002345cff43721617e0a3c0866f6f76bae8c50ff
React-graphics: 9a84942b49ea1375ce83844041fa2ba766cfe0b9
React-jsi: c1c0108d86e1378aabf7c9146ed7d12d87c7df85
React-jsiexecutor: d08ec14edc8f2e19af51550cd1505332eae35c7b
React-jsinspector: 7d223826b0e7a61b3540c21b9eca2603b1d4e823
React-logger: 2009c0280c286a76200d6b7c5fe242fad51ddd7a
React-perflogger: fe66bd6d8b17ebcfdf0159bf41fe28d8035ac20c
React-RCTActionSheet: 3131a0b9280aa0e51bdf54b3d79aecd8503db62c
React-RCTAnimation: 70f2b9daaa1b45dea608be865cc5f2e1789dbc39
React-RCTBlob: 48cae62d905ef96ab10c84ab16163643a3c872a7
React-RCTFabric: 27d0c8541250efd0d35e4d62e487fdb69481de33
React-RCTImage: 2ce3f1f72de91798eb31c9001b30cab8d1c71c4e
React-RCTLinking: 77300bd3cda2a613845ae0056b62ad330c2d319d
React-RCTNetwork: 8ef793740f893987384918e04382d37fac36960d
React-RCTPushNotification: 1845de920c2583f4541e13b3e9bd20a2ba896ffa
React-RCTSettings: 2beadc19336aa83a49e9ee9f704157c64799e840
React-RCTTest: 12bbd7fc2e72bd9920dc7286c5b8ef96639582b6
React-RCTText: e9146b2c0550a83d1335bfe2553760070a2d75c7
React-RCTVibration: 50be9c390f2da76045ef0dfdefa18b9cf9f35cfa
React-rncore: 95c628b2be148269a3189ad1c9f4390b6c73a7d7
React-runtimeexecutor: 4b0c6eb341c7d3ceb5e2385cb0fdb9bf701024f3
ReactCommon: 7a2714d1128f965392b6f99a8b390e3aa38c9569
ScreenshotManager: 965ca5b82e28f0d7baac83c275521770407c60a4
Yoga: c0d06f5380d34e939f55420669a60fe08b79bd75
React-Core: be03ea08c9f7e3ed90cb1a8938104edd162128e9
React-CoreModules: f8d684a58298e6bf3450c5a67e5bd51f085a97a6
React-cxxreact: cbae05897012c1836aa3d4f55fa35eaa7fbe3812
React-Fabric: 5c3506731fa552c440932172e99c793dab295311
React-graphics: 1dedf5f6c91e41a17f7f391b7d2782422b7c4848
React-jsi: a179df37386415476a4502c10e16bc049e2ebf50
React-jsiexecutor: 2982dde5b890dc422e235e49301dfbf5824f331d
React-jsinspector: 30fe295a74de1e2d0e1b085d7081113b4f0a72d6
React-logger: ca0ff3c7da297e462f8a1edc269b9eaf194fc3e7
React-perflogger: 9c31c94faa2b8c1f3a897c2609e4a7fc374ba2d5
React-RCTActionSheet: a9be3b95e0e8328e5a80882a51c9c04446278391
React-RCTAnimation: a395e1a36968da56f6edf05cac202b9d4f0a9db3
React-RCTBlob: 70813ab8c73e1df66950e3f72c72e3c927868262
React-RCTFabric: 1a9df1009e14c1a0648e2eb94f27b98e468d84c6
React-RCTImage: 25bd86a1124fb661339cd1249e87830ba3d11317
React-RCTLinking: 91e94f3bb1aa6971722015e2d15ae6d7b3df2a88
React-RCTNetwork: 318a980a0adde3ce6db139abaefeb86b5b1a2554
React-RCTPushNotification: 249d31ec502618e21b20b247a310734d2d226c35
React-RCTSettings: cbd291c38a784ed6b8a96a47aacd29b5804199b8
React-RCTTest: 2a0aa768deaa05293f6ccc97ef01d69ad1e7f1b4
React-RCTText: 78b3dc662ff98d9018b1185cacb1e463ba7ee4b4
React-RCTVibration: 0b807fd6301a73be46be56a362b64206f1f99e31
React-rncore: e497da2a1312c368abb73c75759370dafb277634
React-runtimeexecutor: 6be6d22787e9a3363fd3e67d8007b1afc1d4a1c6
ReactCommon: 4a6282a55531cd6dd0dc7538d5a6d1a1b26d9d1b
ScreenshotManager: 517874a30ba03b51f5901cee5fb440a49bdd8043
Yoga: c70db79706df9b7bedd521ac150f7834e2999964
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: b0db53c7196aa798709ee467d4d93e7300f7eacf
PODFILE CHECKSUM: eb8cf8c55af63e11cb1907f2ae6b457739f4f0af

COCOAPODS: 1.11.2
21 changes: 21 additions & 0 deletions scripts/ios-configure-glog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ if [ -z "$CURRENT_ARCH" ] || [ "$CURRENT_ARCH" == "undefined_arch" ]; then
fi
fi

if [ "$CURRENT_ARCH" == "arm64" ]; then
cat <<\EOF >>fix_glog_0.3.5_apple_silicon.patch
diff --git a/config.sub b/config.sub
index 1761d8b..43fa2e8 100755
--- a/config.sub
+++ b/config.sub
@@ -1096,6 +1096,9 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
+ arm64-*)
+ basic_machine=$(echo $basic_machine | sed 's/arm64/aarch64/')
+ ;;
none)
basic_machine=none-none
os=-none
EOF
Comment on lines +24 to +39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to a separate file? That can make it easier to read and iterate on in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure! any preference on where that file lives? and do you know where this script is run relative to?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm… maybe you can create that file as a sibling to this one (scripts/) and reference it by fetching the path to the current file?

Something like this…

THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)

patch … "$THIS_DIR/fix_glog_0.3.5_apple_silicon.patch"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yungsters so i did some experimenting, and the issue is that we aren't actually calling this script directly, but rather reading the contents and passing that directly into the podspec:

https://github.com/facebook/react-native/blob/main/third-party-podspecs/glog.podspec#L14

therefore there is no ${BASH_SOURCE[0]}, as the script is called directly via bash -c, basically eval'ing the contents of the file. so i see three solutions:

  1. interpolate the scripts dir path into the script programmatically after we File.read the script
  2. change the glog.podspec file to call the script directly (i.e. /bin/bash /absolute/path/to/scripts/ios-configure-glog.sh), and thus be able to infer that path
  3. leave it as is in the PR, dynamically generating the file when needed

do you have a preference? my gut says option 2 because it feels like the "most correct" use of this bash script, but it also is a more fundamental change to how this script is being used and may have ramifications i don't see right now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the contents of the file into the podspec? Oh boy… 😬

Thanks for investigating, haha. Hmm… #1 increases complexity so I prefer not doing that.

I agree that #2 seems more right, but I would (maybe incorrectly) presume that this was done a certain way for some reason. But I am all for trying it out!

How about this… I'll merge this PR as-is, and you can optionally follow-up with #2 to improve general engineering of this. If that ends up being a rabbit hole or if you don't have time for it, then we still resolved the issue you set out to initially resolve.


patch -p1 config.sub fix_glog_0.3.5_apple_silicon.patch
fi

export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
export CXX="$CC"

Expand Down
2 changes: 1 addition & 1 deletion scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def use_flipper!(versions = {}, configurations: ['Debug'])
versions['Flipper-DoubleConversion'] ||= '3.1.7'
versions['Flipper-Fmt'] ||= '7.1.7'
versions['Flipper-Folly'] ||= '2.6.7'
versions['Flipper-Glog'] ||= '0.3.6'
versions['Flipper-Glog'] ||= '0.3.9'
versions['Flipper-PeerTalk'] ||= '0.0.4'
versions['Flipper-RSocket'] ||= '1.4.3'
versions['OpenSSL-Universal'] ||= '1.1.180'
Expand Down