Skip to content

Commit

Permalink
[native] fix iOS build on x86_64
Browse files Browse the repository at this point in the history
Summary:
In the Library Search Paths section of our Xcode project, we list:

```
"$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/release",
"$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/release",
```

When we build for Any iOS Device (arm64), Xcode locates the arm64 static library in the first search path. Then, when we build for Simulator (x86_64), Xcode again locates the arm64 static library in the first search path, and we get an error.

If we haven't previously built for Any iOS Device (arm64), when we build for Simulator (x86_64), Xcode doesn't find anything in the first search path, locates the x86_64 static library in the second search path, and builds successfully.

The solution is to set the search paths conditionally.

Test Plan: built the app for any iOS device, then for simulator, then did an archive build (release). All succeeded. Tried them in various orders just to be sure.

Reviewers: ashoat, atul

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D9886
  • Loading branch information
vdhanan committed Nov 15, 2023
1 parent f4bed29 commit a46af06
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions native/ios/Comm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,13 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-safe-area-context\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-video\"",
/usr/lib/swift,
);
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = (
"$(inherited)",
"$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/release",
);
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = (
"$(inherited)",
"$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/release",
);
OTHER_CPLUSPLUSFLAGS = (
Expand Down Expand Up @@ -1383,7 +1389,13 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-safe-area-context\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-video\"",
/usr/lib/swift,
);
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = (
"$(inherited)",
"$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/release",
);
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = (
"$(inherited)",
"$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/release",
);
ONLY_ACTIVE_ARCH = YES;
Expand Down

0 comments on commit a46af06

Please sign in to comment.