Skip to content

Commit

Permalink
Fix build of glog & Flipper-Glog on Apple Silicon (#32486)
Browse files Browse the repository at this point in the history
Summary:
This is a fixed version of the #32380 PR. It solves a typo, prevents variable substitution in the patch file, and moves it to a better place in the script so that CURRENT_ARCH is actually detected before checking whether to patch.

The `config.sub` included in glog is too old and does not recognize `arm64-*` as a valid arch when building. This, combined with an out of date Flipper-Glog version, results in persistent build failures on Apple Silicon machines.

p.s. i assume all the podfile lock changes were caused by me running this on an Apple Silicon Mac, and thus all the pod checksums were run against the arm64 versions of those pods rather than the normal x86_64 versions. if this is an issue I can revert the changes to that file, but it would seem to be an inevitable issue in future PR diffs...

## Changelog

- [iOS] [Fixed] - Apple Silicon builds of glog & Flipper-Glog

Pull Request resolved: #32486

Test Plan:
- Clone this branch on both an Apple Silicon- & Intel-based Mac
- Run `pod install` in `packages/rn-tester`
- Confirm that build passes successfully

Reviewed By: cortinico

Differential Revision: D32080994

Pulled By: yungsters

fbshipit-source-id: 76a7c5bba20d91905455920609c890e92bb5b980
  • Loading branch information
rayzr522 authored and facebook-github-bot committed Nov 3, 2021
1 parent 6fd3bc2 commit 25d4cb9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
16 changes: 8 additions & 8 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 @@ -881,18 +881,18 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBLazyVector: b81a2b70c72d8b0aefb652cea22c11e9ffd02949
FBReactNativeSpec: c72b6aa43f36a4bfa45376f24ac5d10339070635
FBReactNativeSpec: c41af89a2aca37e9fe937133ffe6758301ded893
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
Expand Down Expand Up @@ -923,13 +923,13 @@ SPEC CHECKSUMS:
React-RCTTest: 12bbd7fc2e72bd9920dc7286c5b8ef96639582b6
React-RCTText: e9146b2c0550a83d1335bfe2553760070a2d75c7
React-RCTVibration: 50be9c390f2da76045ef0dfdefa18b9cf9f35cfa
React-rncore: 95c628b2be148269a3189ad1c9f4390b6c73a7d7
React-rncore: a1249129f80f05d7e3bcba35239ceb394c1052cc
React-runtimeexecutor: 4b0c6eb341c7d3ceb5e2385cb0fdb9bf701024f3
ReactCommon: 7a2714d1128f965392b6f99a8b390e3aa38c9569
ScreenshotManager: 965ca5b82e28f0d7baac83c275521770407c60a4
ScreenshotManager: ec701affd6d2a5dabf8739b0cdcc937f7dbd2ac6
Yoga: c0d06f5380d34e939f55420669a60fe08b79bd75
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

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

0 comments on commit 25d4cb9

Please sign in to comment.