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

Xcode Build fails upon adding new target #30234

Closed
doylemark opened this issue Oct 23, 2020 · 5 comments
Closed

Xcode Build fails upon adding new target #30234

doylemark opened this issue Oct 23, 2020 · 5 comments
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.

Comments

@doylemark
Copy link

doylemark commented Oct 23, 2020

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Upon adding a new target to a fresh react-native app (in my case an iOS 14 Widget). Xcode fails to build the app. With two errors:

  1. Undefined symbol: _swift_getOpaqueTypeConformance
  2. Undefined symbol: _swift_getTypeByMangledNameInContextInMetadataState

The latter error points to #29246. However the suggested fix did not help.

LIBRARY_SEARCH_PATHS = (
   "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
-  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
+  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.2/$(PLATFORM_NAME)\"",
   "\"$(inherited)\"",
 );

Originally posted by @hengkx in #29246 (comment)

Bumping the Swift version to 5.2 led to 23 further undefined symbol errors mostly of type FORCE_LOAD.. eg: Undefined symbol: __swift_FORCE_LOAD_$_swiftObjectiveC

React Native version:

    OS: macOS 11.0
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 36.74 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.4.0 - ~/.nvm/versions/node/v14.4.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v14.4.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.1, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6821437
    Xcode: 12.1/12A7403 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: ~0.63.3 => 0.63.3 
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Instantiate a new react-native app: react-native init myProj
  2. In Xcode, file > new > target > Widget Extension
  3. Try to build app an observe described behaviour

Expected Results

The app should continue to build normally after adding a new target

Snack, code example, screenshot, or link to a repository:

n/a

@yybot1
Copy link

yybot1 commented Oct 30, 2020

I encountered the same problem and eventually fixed it myself.

There are multiple "Library Search Paths" in the settings, you need to change to setting for your widget target in the "TARGETS" categary, If you change the path setting for the "PROJECT", then those errors displayed.

@doylemark
Copy link
Author

Will test and close if solving, thanks

@doylemark
Copy link
Author

Resolved, solution is to make the following changes to the WidgetExtension target not project.

LIBRARY_SEARCH_PATHS = (
   "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
-  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
+  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.2/$(PLATFORM_NAME)\"",
   "\"$(inherited)\"",
 );

@timothyac
Copy link

I might be missing it, but it doesn't look my widget target has the LIBRARY_SEARCH_PATHS. I do see two in the settings, but one is for the debug version of the app target, and one is for the release version of the app target. Not sure if I'm doing something wrong when adding the widget to the project.

@adamsolomon1986
Copy link

Resolved, solution is to make the following changes to the WidgetExtension target not project.

LIBRARY_SEARCH_PATHS = (
   "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
-  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
+  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.2/$(PLATFORM_NAME)\"",
   "\"$(inherited)\"",
 );

yes that works, but just noting that 'targets' don't have a setting of that value, you just gotta do it on the 'Project' level.

@facebook facebook locked as resolved and limited conversation to collaborators Nov 29, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Nov 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants