Skip to content

Commit

Permalink
Switch order of search libraries to fix M1 build error
Browse files Browse the repository at this point in the history
Summary: changelog: Resolve Xcode 13 build error on M1 Macs for projects created from RN template

Reviewed By: fkgozali

Differential Revision: D30693466

fbshipit-source-id: f0b4fd471de38119d636c8e337831aa4d4599c4e
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Sep 1, 2021
1 parent 8b4f507 commit 329b026
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -783,10 +783,10 @@
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"\"$(SDKROOT)/usr/lib/swift\"",
"$(inherited)",
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)",
"\"$(SDKROOT)/usr/lib/swift\"",
);
"LIBRARY_SEARCH_PATHS[arch=*]" = "$(inherited)";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -818,10 +818,10 @@
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"\"$(SDKROOT)/usr/lib/swift\"",
"$(inherited)",
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)",
"\"$(SDKROOT)/usr/lib/swift\"",
);
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down
4 changes: 2 additions & 2 deletions template/ios/HelloWorld.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@
"$(inherited)",
);
LIBRARY_SEARCH_PATHS = (
"\"$(SDKROOT)/usr/lib/swift\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
"\"$(inherited)\"",
"\"$(SDKROOT)/usr/lib/swift\"",
);
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -493,10 +493,10 @@
"$(inherited)",
);
LIBRARY_SEARCH_PATHS = (
"\"$(SDKROOT)/usr/lib/swift\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
"\"$(inherited)\"",
"\"$(SDKROOT)/usr/lib/swift\"",
);
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
Expand Down

2 comments on commit 329b026

@barbieri
Copy link
Contributor

Choose a reason for hiding this comment

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

guys, in particular @sammy-SC and @mikehardy: this fix to use SDKROOT is not really correct, the actual bug is Apple build of iphonesimulator lacks the arm64 architecture, see more info at #31480 (comment)

I've reported this to Apple, but if more people can do the same or someone have a faster access to Apple SDK guys, please ask this to be fixed.

@barbieri
Copy link
Contributor

Choose a reason for hiding this comment

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

@sammy-SC, @mikehardy see #31480 (comment), at least with Xcode 13.0 we just don't need these lines at all, being the problem $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME).

Would it be better to just have Podfile to delete the problematic LIBRARY_SEARCH_PATHS if Xcode is new enough? I don't have 12.5 or any other to confirm, but will see what I can do to verify.

Please sign in to comment.