'Getting "ld: symbol(s) not found for architecture x86_64 clang" on one of nearly identicals machines

I've been on this for two days, searched every corner of the internet and couldn't find any solutions.

Currently, when I try to build React-Native Xcode project on M1 Max, I get ld: symbol(s) not found for architecture x86_64 clang for a lot of symbols. While on regular M1, the build goes through.

I can't seem to find any differences that would be even remotely related with the clang error.

Also asked few colleagues to run the project, got few with same error (M1 Pro and M1 Max) and one with nearly identical setup in every way and the build went through on his machine (M1 Pro MBP, same macOS (thought that Monterey and Big Sur could be different somewhere, but it seems not), ruby, node, etc)

I've also tried looking for any issues with search paths and project setup, but it looks fine (also it builds fine on other machines). That means it's probably 100% setup problem. I should also mention, that other projects I've tried to build are working brilliantly.

Any directions which ways should I look into finding what's so different between the machines?

Any comments would be really helpful, totally lost right now. Thanks.


Showing Recent Errors Only
Undefined symbol: _pb_ostream_from_buffer

Undefined symbol: _pb_encode_string

Undefined symbol: _pb_decode_varint

Undefined symbol: _pb_encode_submessage

Undefined symbol: _pb_decode

Undefined symbol: _GPBClearOneof

Undefined symbol: _OBJC_CLASS_$_GTMLogMininumLevelFilter

Undefined symbol: _OBJC_CLASS_$_GPBCodedOutputStream

Undefined symbol: _pb_read

Undefined symbol: _OBJC_CLASS_$_GPBInt32Array

Undefined symbol: _OBJC_CLASS_$_GPBDescriptor

Undefined symbol: _OBJC_METACLASS_$_GPBMessage

Undefined symbol: _OBJC_CLASS_$_GPBMessage

Undefined symbol: _pb_istream_from_buffer

Undefined symbol: _OBJC_CLASS_$_GPBRootObject

Undefined symbol: _OBJC_METACLASS_$_GPBRootObject

Undefined symbol: _OBJC_CLASS_$_GDTCORTransport

Undefined symbol: _OBJC_CLASS_$_GTMSessionCookieStorage

Undefined symbol: _OBJC_CLASS_$_GTMSessionFetcher

Undefined symbol: _OBJC_CLASS_$_GTMLogger

Undefined symbol: _OBJC_CLASS_$_GTMSessionFetcherService

Undefined symbol: _OBJC_CLASS_$_GULCCComponentType

Undefined symbol: _OBJC_CLASS_$_GPBEnumArray

Undefined symbol: _OBJC_METACLASS_$_GTMLogger

Undefined symbol: _GULLogInfo

Undefined symbol: _GULIsLoggableLevel

Undefined symbol: _GULLogBasic

Undefined symbol: _kGULNetworkHTTPStatusCodeNotFound

Undefined symbol: _kGULNetworkHTTPStatusOK

Undefined symbol: _kGULNetworkHTTPStatusCodeCannotAcceptTraffic

Undefined symbol: _GULLogWarning

Undefined symbol: _OBJC_CLASS_$_GULNetwork

Undefined symbol: _OBJC_CLASS_$_GPBEnumDescriptor

Undefined symbol: _OBJC_CLASS_$_GULAppDelegateSwizzler

Undefined symbol: _OBJC_CLASS_$_FlipperKitReactPlugin

Undefined symbol: _OBJC_CLASS_$_GULAppEnvironmentUtil

Undefined symbol: _kGULNetworkHTTPStatusCodeNotModified

Undefined symbol: _GULLogError

Undefined symbol: _kGULNetworkHTTPStatusCodeUnavailable

Undefined symbol: _OBJC_CLASS_$_FIRComponent

Undefined symbol: _OBJC_CLASS_$_RCTBridge

Undefined symbol: _OBJC_CLASS_$_GULMutableDictionary

Undefined symbol: _OBJC_CLASS_$_FIRAuth

Undefined symbol: _OBJC_CLASS_$_FIRInstallations

Undefined symbol: _kFIRLoggerAnalytics

Undefined symbol: _FIRFirebaseVersion

Undefined symbol: _OBJC_CLASS_$_RCTBundleURLProvider

Undefined symbol: _OBJC_CLASS_$_GULUserDefaults

Undefined symbol: _OBJC_CLASS_$_FlipperKitNetworkPlugin

Undefined symbol: _pb_encode_varint

Undefined symbol: _OBJC_CLASS_$_GULCCComponent

Undefined symbol: _OBJC_CLASS_$_FKUserDefaultsPlugin

Undefined symbol: _OBJC_CLASS_$_SKDescriptorMapper

Undefined symbol: _kGTMSessionFetcherStatusDomain

Undefined symbol: _OBJC_CLASS_$_GULCCComponentContainer

Undefined symbol: _pb_encode

Undefined symbol: _OBJC_CLASS_$_Orientation

Undefined symbol: _OBJC_CLASS_$_FlipperClient

Undefined symbol: _OBJC_CLASS_$_RNCPushNotificationIOS

Undefined symbol: _GULSetLoggerLevel

Undefined symbol: _OBJC_CLASS_$_FlipperKitLayoutPlugin

Undefined symbol: _OBJC_CLASS_$_GULSwizzler

Undefined symbol: _OBJC_CLASS_$_RNBootSplash

Undefined symbol: _pb_encode_tag_for_field

Undefined symbol: _OBJC_CLASS_$_FIROptions

Undefined symbol: _OBJC_CLASS_$_RNBranch

Undefined symbol: _OBJC_CLASS_$_RCTLinkingManager

Undefined symbol: _OBJC_CLASS_$_UAirship

Undefined symbol: _OBJC_CLASS_$_GPBFileDescriptor

Undefined symbol: _OBJC_CLASS_$_FIRApp

Undefined symbol: _OBJC_CLASS_$_RCTRootView

Undefined symbol: _FIRInstallationIDDidChangeNotification

Undefined symbol: _kGULNetworkHTTPStatusNoContent

Undefined symbol: _OBJC_CLASS_$_SKIOSNetworkAdapter

Here's the react-native info diff (M1 mac mini / M1 Max MBP)

Here's the brew list --versions diff (M1 Max MBP / M1 mac mini)



Solution 1:[1]

This works for me.

You can exclude arm64 for simulator architecture both from your main Project and the Pod project.

enter image description here

enter image description here

Solution 2:[2]

The only thing that worked to me was replace all the part from "post_install" on Podfile to the code below.

use_flipper!()

post_install do |installer|
  react_native_post_install(installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

After that. Run the following commands in terminal on iOS folder.

pod deintegrate && pod install

Now clean build cache on Xcode and run the project.

Shortcut: CMD + SHIFT + K

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 Md. Robi Ullah
Solution 2