Skip to content

Xcode Build fails upon adding new target #30234

Closed
@doylemark

Description

@doylemark

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions