facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.21k stars 24.33k forks source link

New project - Unable to find swift modules #31504

Closed rcwestlake closed 2 years ago

rcwestlake commented 3 years ago

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

Description

I installed react-native, created a new project using react-native init but am unable to get the project to build. I receive these warnings:

ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
Undefined symbols for architecture arm64:
  "protocol descriptor for Swift.ExpressibleByFloatLiteral", referenced from:
      l_got.$ss25ExpressibleByFloatLiteralMp in libYogaKit.a(YGLayoutExtensions.o)
  "associated type descriptor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType", referenced from:
      l_got.$s18IntegerLiteralTypes013ExpressibleByaB0PTl in libYogaKit.a(YGLayoutExtensions.o)
  "associated conformance descriptor for Swift.ExpressibleByIntegerLiteral.Swift.ExpressibleByIntegerLiteral.IntegerLiteralType: Swift._ExpressibleByBuiltinIntegerLiteral", referenced from:
      l_got.$ss27ExpressibleByIntegerLiteralP0cD4TypeAB_s01_ab7BuiltincD0Tn in libYogaKit.a(YGLayoutExtensions.o)
  "method descriptor for Swift.ExpressibleByFloatLiteral.init(floatLiteral: A.FloatLiteralType) -> A", referenced from:
      l_got.$ss25ExpressibleByFloatLiteralP05floatD0x0cD4TypeQz_tcfCTq in libYogaKit.a(YGLayoutExtensions.o)
  "protocol descriptor for Swift.ExpressibleByIntegerLiteral", referenced from:
      l_got.$ss27ExpressibleByIntegerLiteralMp in libYogaKit.a(YGLayoutExtensions.o)
  "value witness table for Builtin.Int32", referenced from:
      full type metadata for __C.YGUnit in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftCoreImage", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreImage_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreImage_$_YogaKit)
  "protocol witness table for Swift.Float : Swift._ExpressibleByBuiltinFloatLiteral in Swift", referenced from:
      associated type witness table accessor for Swift.ExpressibleByFloatLiteral.FloatLiteralType : Swift._ExpressibleByBuiltinFloatLiteral in __C.YGValue : Swift.ExpressibleByFloatLiteral in YogaKit in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftFoundation", referenced from:
      __swift_FORCE_LOAD_$_swiftFoundation_$_NewProject in File.o
      __swift_FORCE_LOAD_$_swiftFoundation_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftFoundation_$_YogaKit, __swift_FORCE_LOAD_$_swiftFoundation_$_NewProject )
  "_swift_getForeignTypeMetadata", referenced from:
      type metadata accessor for __C.YGValue in libYogaKit.a(YGLayoutExtensions.o)
      type metadata accessor for __C.YGUnit in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftObjectiveC", referenced from:
      __swift_FORCE_LOAD_$_swiftObjectiveC_$_NewProject in File.o
      __swift_FORCE_LOAD_$_swiftObjectiveC_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftObjectiveC_$_NewProject, __swift_FORCE_LOAD_$_swiftObjectiveC_$_YogaKit )
  "protocol witness table for Swift.Int : Swift._ExpressibleByBuiltinIntegerLiteral in Swift", referenced from:
      associated type witness table accessor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType : Swift._ExpressibleByBuiltinIntegerLiteral in __C.YGValue : Swift.ExpressibleByIntegerLiteral in YogaKit in libYogaKit.a(YGLayoutExtensions.o)
  "method descriptor for Swift.ExpressibleByIntegerLiteral.init(integerLiteral: A.IntegerLiteralType) -> A", referenced from:
      l_got.$ss27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfCTq in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftCoreFoundation", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreFoundation_$_NewProject in File.o
      __swift_FORCE_LOAD_$_swiftCoreFoundation_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreFoundation_$_YogaKit, __swift_FORCE_LOAD_$_swiftCoreFoundation_$_NewProject )
  "associated type descriptor for Swift.ExpressibleByFloatLiteral.FloatLiteralType", referenced from:
      l_got.$s16FloatLiteralTypes013ExpressibleByaB0PTl in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftQuartzCore", referenced from:
      __swift_FORCE_LOAD_$_swiftQuartzCore_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftQuartzCore_$_YogaKit)
  "__swift_FORCE_LOAD_$_swiftDispatch", referenced from:
      __swift_FORCE_LOAD_$_swiftDispatch_$_NewProject in File.o
      __swift_FORCE_LOAD_$_swiftDispatch_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftDispatch_$_NewProject, __swift_FORCE_LOAD_$_swiftDispatch_$_YogaKit )
  "associated conformance descriptor for Swift.ExpressibleByFloatLiteral.Swift.ExpressibleByFloatLiteral.FloatLiteralType: Swift._ExpressibleByBuiltinFloatLiteral", referenced from:
      l_got.$ss25ExpressibleByFloatLiteralP0cD4TypeAB_s01_ab7BuiltincD0Tn in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftUIKit", referenced from:
      __swift_FORCE_LOAD_$_swiftUIKit_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftUIKit_$_YogaKit)
  "__swift_FORCE_LOAD_$_swiftMetal", referenced from:
      __swift_FORCE_LOAD_$_swiftMetal_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftMetal_$_YogaKit)
  "Swift.Float.init(Swift.Double) -> Swift.Float", referenced from:
      static (extension in YogaKit):CoreGraphics.CGFloat.% postfix(CoreGraphics.CGFloat) -> __C.YGValue in libYogaKit.a(YGLayoutExtensions.o)
      (extension in YogaKit):__C.YGValue.init(CoreGraphics.CGFloat) -> __C.YGValue in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftDarwin", referenced from:
      __swift_FORCE_LOAD_$_swiftDarwin_$_NewProject in File.o
      __swift_FORCE_LOAD_$_swiftDarwin_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftDarwin_$_YogaKit, __swift_FORCE_LOAD_$_swiftDarwin_$_NewProject )
  "__swift_FORCE_LOAD_$_swiftCoreGraphics", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreGraphics_$_NewProject in File.o
      __swift_FORCE_LOAD_$_swiftCoreGraphics_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreGraphics_$_YogaKit, __swift_FORCE_LOAD_$_swiftCoreGraphics_$_NewProject )
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Definitely seems odd given not being able to build a new project would be a major issue. My suspicious is that it's unique to my setup (new computer).

React Native version:

    OS: macOS 11.2.3
    CPU: (8) arm64 Apple M1
    Memory: 142.36 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.1.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /opt/homebrew/bin/yarn
    npm: 7.11.2 - /opt/homebrew/bin/npm
    Watchman: 4.9.0 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 12.5/12E262 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.64.1 => 0.64.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. install react-native
  2. create new project using react-native init
  3. Run the run-ios command or open project in Xcode with the xcworkspace file.

Expected Results

I expect the build to run properly. I did not make any modifications to the project.

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

https://github.com/rcwestlake/TestNewRN

This is a screenshot of my DerivedData. Initially the NewProject.swiftmodule was not there but I had read that I needed to add a File.swift file to the project to trigger something so I created that and then that file showed up. image

rcwestlake commented 3 years ago

To get this to work, I had to exclude arm64 architecture. See: https://github.com/facebook/react-native/issues/31118. Definitely seems like a workaround.

developerantoniosousa commented 3 years ago

If this is a good option for you. You can remove the flipper from your Podfile file. Don't forget to re-install all pods again - it will remove Flipper's Pods.

stale[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

github-actions[bot] commented 2 years ago

This issue was closed because it has been stalled for 7 days with no activity.