'Undefined symbol: nominal type descriptor for Swift.UInt8

I am trying to run react native app in a Mac Mini with Apple M1 chipset.The project run well on intel based system but not running on M1. When I build I got following errors.

Undefined symbol: nominal type descriptor for Swift.UInt8

Undefined symbol: nominal type descriptor for Swift._ContiguousArrayStorage

Undefined symbol: _swift_deletedMethodError

Undefined symbol: __swift_FORCE_LOAD_$_swiftsimd

Undefined symbol: _swift_deallocObject

Undefined symbol: _swift_getObjCClassMetadata

Undefined symbol: __swift_FORCE_LOAD_$_swiftAVFoundation

Undefined symbol: Swift.String.count.getter : Swift.Int

Undefined symbol: (extension in Foundation):Swift.StringProtocol.cString(using: (extension in Foundation):Swift.String.Encoding) -> [Swift.Int8]?

Undefined symbol: Foundation.Data._Representation.replaceSubrange(_: Swift.Range<Swift.Int>, with: Swift.UnsafeRawPointer?, count: Swift.Int) -> ()

Undefined symbol: type metadata accessor for Foundation.__DataStorage

Undefined symbol: type metadata accessor for Foundation.Data.RangeReference

Undefined symbol: Swift.Hasher.init(_seed: Swift.Int) -> Swift.Hasher

Undefined symbol: Swift.String.hash(into: inout Swift.Hasher) -> ()

Undefined symbol: Swift.Hasher._finalize() -> Swift.Int

Undefined symbol: Foundation._convertNSErrorToError(__C.NSError?) -> Swift.Error

Undefined symbol: static (extension in ObjectiveC):__C.NSObject.== infix(__C.NSObject, __C.NSObject) -> Swift.Bool

Undefined symbol: static (extension in Foundation):Swift.String._unconditionallyBridgeFromObjectiveC(__C.NSString?) -> Swift.String

Undefined symbol: _swift_beginAccess

Undefined symbol: static (extension in Foundation):Swift.Dictionary._unconditionallyBridgeFromObjectiveC(__C.NSDictionary?) -> [A : B]

Undefined symbol: _swift_getTypeByMangledNameInContextInMetadataState

Undefined symbol: __swiftEmptyDictionarySingleton

Undefined symbol: _swift_bridgeObjectRetain

Undefined symbol: Swift._StringGuts.grow(Swift.Int) -> ()

Undefined symbol: nominal type descriptor for Swift.AnyHashable

Undefined symbol: static Swift._DictionaryStorage.allocate(capacity: Swift.Int) -> Swift._DictionaryStorage<A, B>

Undefined symbol: Swift.String.append(Swift.String) -> ()

Undefined symbol: protocol witness table for Swift.AnyHashable : Swift.Hashable in Swift

Undefined symbol: _swift_initStackObject

Undefined symbol: _swift_getWitnessTable

Undefined symbol: (extension in Foundation):Swift.Dictionary._bridgeToObjectiveC() -> __C.NSDictionary

Undefined symbol: protocol witness table for Swift.String : Swift.Hashable in Swift

Undefined symbol: __swift_FORCE_LOAD_$_swiftDispatch

Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreImage

Undefined symbol: __swiftEmptyArrayStorage

Undefined symbol: Swift.KEY_TYPE_OF_DICTIONARY_VIOLATES_HASHABLE_REQUIREMENTS(Any.Type) -> Swift.Never

Undefined symbol: Foundation.NSLog(Swift.String, Swift.CVarArg...) -> ()

Undefined symbol: _swift_bridgeObjectRetain_n

Undefined symbol: (extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString

Undefined symbol: _swift_bridgeObjectRelease

Undefined symbol: Foundation.Data._bridgeToObjectiveC() -> __C.NSData

Undefined symbol: _swift_allocObject

Undefined symbol: static (extension in Foundation):Swift.String.Encoding.utf8.getter : (extension in Foundation):Swift.String.Encoding

Undefined symbol: Swift._HashTable.previousHole(before: Swift._HashTable.Bucket) -> Swift._HashTable.Bucket

Undefined symbol: _swift_initStaticObject

Undefined symbol: protocol conformance descriptor for Swift.String : Swift.StringProtocol in Swift

Undefined symbol: associated type descriptor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType

Undefined symbol: type metadata for Swift.String

Undefined symbol: Swift._stringCompareWithSmolCheck(_: Swift._StringGuts, _: Swift._StringGuts, expecting: Swift._StringComparisonResult) -> Swift.Bool

Undefined symbol: type metadata for Swift.AnyHashable

Undefined symbol: (extension in Foundation):Swift.Error.localizedDescription.getter : Swift.String

Undefined symbol: nominal type descriptor for Swift.CollectionOfOne

Undefined symbol: _swift_isUniquelyReferenced_nonNull_native

Undefined symbol: __swift_FORCE_LOAD_$_swiftUIKit

Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral

Undefined symbol: associated conformance descriptor for Swift.ExpressibleByIntegerLiteral.Swift.ExpressibleByIntegerLiteral.IntegerLiteralType: Swift._ExpressibleByBuiltinIntegerLiteral

Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreFoundation

Undefined symbol: value witness table for Builtin.UnknownObject

Undefined symbol: method descriptor for Swift.ExpressibleByFloatLiteral.init(floatLiteral: A.FloatLiteralType) -> A

Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreAudio

Undefined symbol: protocol descriptor for Swift.ExpressibleByIntegerLiteral

Undefined symbol: _swift_dynamicCast

Undefined symbol: protocol conformance descriptor for <A where A == Swift.UInt8> Swift.CollectionOfOne<A> : Foundation.ContiguousBytes in Foundation

Undefined symbol: value witness table for Builtin.Int32

Undefined symbol: type metadata accessor for (extension in Foundation):Swift.String.Encoding

Undefined symbol: _swift_retain

Undefined symbol: __swift_FORCE_LOAD_$_swiftMetal

Undefined symbol: Swift.AnyHashable._rawHashValue(seed: Swift.Int) -> Swift.Int

Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreGraphics

Undefined symbol: type metadata for Any

Undefined symbol: protocol witness table for Swift.Float : Swift._ExpressibleByBuiltinFloatLiteral in Swift

Undefined symbol: __swift_FORCE_LOAD_$_swiftFoundation

Undefined symbol: _swift_getForeignTypeMetadata

Undefined symbol: method descriptor for Swift.ExpressibleByIntegerLiteral.init(integerLiteral: A.IntegerLiteralType) -> A

Undefined symbol: nominal type descriptor for Swift._DictionaryStorage

Undefined symbol: static Swift._DictionaryStorage.copy(original: Swift.__RawDictionaryStorage) -> Swift._DictionaryStorage<A, B>

Undefined symbol: _swift_willThrow

Undefined symbol: _swift_endAccess

Undefined symbol: __swift_FORCE_LOAD_$_swiftObjectiveC

Undefined symbol: _swift_errorRelease

Undefined symbol: protocol witness table for Swift.Int : Swift._ExpressibleByBuiltinIntegerLiteral in Swift

Undefined symbol: _swift_getTypeByMangledNameInContext

Undefined symbol: (extension in Foundation):Swift.Array._bridgeToObjectiveC() -> __C.NSArray

Undefined symbol: associated type descriptor for Swift.ExpressibleByFloatLiteral.FloatLiteralType

Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreMedia

Undefined symbol: Foundation.__DataStorage.init(capacity: Swift.Int) -> Foundation.__DataStorage

Undefined symbol: __swift_FORCE_LOAD_$_swiftQuartzCore

Undefined symbol: _swift_release

Undefined symbol: static Swift._DictionaryStorage.resize(original: Swift.__RawDictionaryStorage, capacity: Swift.Int, move: Swift.Bool) -> Swift._DictionaryStorage<A, B>

Undefined symbol: associated conformance descriptor for Swift.ExpressibleByFloatLiteral.Swift.ExpressibleByFloatLiteral.FloatLiteralType: Swift._ExpressibleByBuiltinFloatLiteral

Undefined symbol: _swift_getErrorValue

Undefined symbol: __swift_FORCE_LOAD_$_swiftDarwin

How can I fix this issue. I already tried adding a Swift file and bridge file. But that doesnt work.Please help me

Xcode version : 13.0, React Native Version : 0.64.2, iOS simulator 15, Mac OS: 11.4,



Solution 1:[1]

For those who still have this issue you can try out the following because it worked for me:

The link to the original post: https://dev.to/mngyuan/updating-react-native-projects-for-m1-mac-development-1mk4

We're going to exclude the arm64 architecture from our build. Under Targets, select your project -> Build Settings -> Excluded Architectures, and add Any IOS Simulator SDK : arm64 for both Debug and Release. Do the same for your Pods project.

enter image description here

enter image description here

If your project for some reason has VALID_ARCHS set, you'll want to remove that key from your project as well (and the Pods project) at this stage. We're very close to done, but the version of Flipper installed in your pods is likely not new enough to include the fixes for M1 macs. Open ios/Podfile and apply the following

  • use_flipper!
  • use_flipper!({ 'Flipper' => '0.75.0' })

And update your Pods

cd ios/

optionally reinstall all your Pods if you're still having issues

pod deintegrate

pod update

If you performed a build which failed, you might want to clear DerivedData like so

rm -rf ~/Library/Developer/Xcode/DerivedData/

Since am running react-native 0.64 I also had to add this to my pod file

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 karanzijm