"Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral" issue while installing react native on macOS Big Sur

12,389

Solution 1

You need to exclude architecture arm64 if you are using M1 mac. Please check this image

Also add this code at the end of the pod file

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
      end
    end
  end

Do pod install, Clean the build folder and restart the build it will resolve the issue.

Solution 2

What really worked for me, only add this Excluded Architectures and you will be fine, if you are using a Mac with M1 of course

enter image description here

Solution 3

I managed to resolve this issue by adding an empty swift file to the project in Xcode. This had the side effect of creating a bridging header file which (for me at least) got my project to compile.

Share:
12,389
Admin
Author by

Admin

Updated on June 07, 2022

Comments

  • Admin
    Admin almost 2 years

    I was trying to install React Native on my system, and found that it failed to install CocoaPods dependencies which is required by that template error.

    sudo arch -x86_64 gem install ffi fixed this issue but ended up with event-config.h" file not found error.

    I changed the changed the flipper version in pod file to use_flipper!({'Flipper'=>'0.76.0'}) and then I reached to the error mentioned above. Any help on this issue would be appreciated.

    node version : 15.10.0
    react-native version: 0.63.4
    Xcode version: 12.4
    

    Error description below:

    Showing Recent Messages
    
    Could not find or use auto-linked library 'swiftCoreGraphics'
    Could not find or use auto-linked library 'swiftUIKit'
    Could not find or use auto-linked library 'swiftDarwin'
    Could not find or use auto-linked library 'swiftFoundation'
    Could not find or use auto-linked library 'swiftMetal'
    Could not find or use auto-linked library 'swiftObjectiveC'
    Could not find or use auto-linked library 'swiftCoreFoundation'
    Could not find or use auto-linked library 'swiftDispatch'
    Could not find or use auto-linked library 'swiftCoreImage'
    Could not find or use auto-linked library 'swiftQuartzCore'
    Could not find or use auto-linked library 'swiftCore'
    Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
    Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral
    Undefined symbol: associated type descriptor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType
    
    Undefined symbol: associated conformance descriptor for Swift.ExpressibleByIntegerLiteral.Swift.ExpressibleByIntegerLiteral.IntegerLiteralType: Swift._ExpressibleByBuiltinIntegerLiteral
    
    Undefined symbol: method descriptor for Swift.ExpressibleByFloatLiteral.init(floatLiteral: A.FloatLiteralType) -> A
    
    Undefined symbol: protocol descriptor for Swift.ExpressibleByIntegerLiteral
    Undefined symbol: value witness table for Builtin.Int32
    Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreImage
    Undefined symbol: associated type descriptor for Swift.ExpressibleByFloatLiteral.FloatLiteralType
    Undefined symbol: __swift_FORCE_LOAD_$_swiftQuartzCore
    Undefined symbol: __swift_FORCE_LOAD_$_swiftDispatch
    Undefined symbol: method descriptor for Swift.ExpressibleByIntegerLiteral.init(integerLiteral: A.IntegerLiteralType) -> A
    Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreFoundation
    Undefined symbol: protocol witness table for Swift.Int : Swift._ExpressibleByBuiltinIntegerLiteral in Swift
    Undefined symbol: __swift_FORCE_LOAD_$_swiftObjectiveC
    Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreGraphics
    Undefined symbol: _swift_getForeignTypeMetadata
    Undefined symbol: __swift_FORCE_LOAD_$_swiftFoundation
    Undefined symbol: associated conformance descriptor for Swift.ExpressibleByFloatLiteral.Swift.ExpressibleByFloatLiteral.FloatLiteralType: Swift._ExpressibleByBuiltinFloatLiteral
    Undefined symbol: __swift_FORCE_LOAD_$_swiftUIKit
    Undefined symbol: __swift_FORCE_LOAD_$_swiftMetal
    Undefined symbol: Swift.Float.init(Swift.Double) -> Swift.Float
    Undefined symbol: __swift_FORCE_LOAD_$_swiftDarwin
    Undefined symbol: protocol witness table for Swift.Float : Swift._ExpressibleByBuiltinFloatLiteral in Swift
    
  • Nirmal Dalmia
    Nirmal Dalmia almost 3 years
    Why isn't this an accepted answer! I was struggling with the problem for hours and this solution just works!
  • Felipe Esteves
    Felipe Esteves almost 3 years
    I didn't need to add the podfile stuff. it works like a charm!
  • Nicolas Braun
    Nicolas Braun almost 3 years
    When doing so, node fails to launch. Maybe because it's trying to launch an x86 version of. it ? Any idea? env: node: No such file or directory
  • yansusanto
    yansusanto over 2 years
    This is to confirm that it works for XCode 13 on M1 Mac. And this should be the accepted answer.
  • Minhaz Panara
    Minhaz Panara over 2 years
    This resolved my issue.
  • Akila Devinda
    Akila Devinda over 2 years
    @NicolasBraun I'm having the same issue. DId you try to solve that ?
  • Yurij
    Yurij over 2 years
    @AkilaDevinda, just do brew install node and it will be fixed.
  • Yurij
    Yurij over 2 years
    I wonder, why do we should exclude arm64 when building on M1 Macs?
  • Dror Bar
    Dror Bar almost 2 years
    I have this issue but I don't have a Mac with M1 (have Intel chip)
  • Dipan Sharma
    Dipan Sharma almost 2 years
    @DrorBar can you please post the whole error you are facing ?
  • Dror Bar
    Dror Bar almost 2 years
    @DipanSharma It is the same as original poster. Regardless, after a couple of hours, searching and trying many suggestions, I finally managed to solve it by following step by step the following helpful comment: github.com/facebook/react-native/issues/…