react-native: xcode 16.2 Could not build module 'DarwinFoundation'

Description

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.2.sdk/usr/include/sys/_types/_mach_port_t.h:49:10 Could not build module β€˜DarwinFoundation’

Steps to reproduce

Screenshot 2025-01-03 at 2 49 30 PM

React Native Version

0.76.5

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 15.1
  CPU: (8) arm64 Apple M2
  Memory: 423.88 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.5
    path: ~/.nvm/versions/node/v18.20.5/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v18.20.5/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/bigbrainy/.rvm/gems/ruby-3.2.2/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "29"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play Experimental 16k Page Size ARM 64 v8a
      - android-TiramisuPrivacySandbox | Google Play ARM 64 v8a
      - android-VanillaIceCream | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/bigbrainy/.rvm/rubies/ruby-3.2.2/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: true

Stacktrace or Logs

/*
 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
 *
 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
 *
 * This file contains Original Code and/or Modifications of Original Code
 * as defined in and that are subject to the Apple Public Source License
 * Version 2.0 (the 'License'). You may not use this file except in
 * compliance with the License. The rights granted to you under the License
 * may not be used to create, or enable the creation or redistribution of,
 * unlawful or unlicensed copies of an Apple operating system, or to
 * circumvent, violate, or enable the circumvention or violation of, any
 * terms of an Apple operating system software license agreement.
 *
 * Please obtain a copy of the License at
 * http://www.opensource.apple.com/apsl/ and read it before using this file.
 *
 * The Original Code and all software distributed under the License are
 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
 * Please see the License for the specific language governing rights and
 * limitations under the License.
 *
 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
 */

/*
 *	mach_port_t - a named port right
 *
 *	In user-space, "rights" are represented by the name of the
 *	right in the Mach port namespace.  Even so, this type is
 *	presented as a unique one to more clearly denote the presence
 *	of a right coming along with the name.
 *
 *	Often, various rights for a port held in a single name space
 *	will coalesce and are, therefore, be identified by a single name
 *	[this is the case for send and receive rights].  But not
 *	always [send-once rights currently get a unique name for
 *	each right].
 *
 *	This definition of mach_port_t is only for user-space.
 *
 */

#ifndef _MACH_PORT_T
#define _MACH_PORT_T
#include <sys/_types.h> /* __darwin_mach_port_t */
typedef __darwin_mach_port_t mach_port_t;
#endif /* _MACH_PORT_T */

Reproducer

https://github.com/pareshbbi/Reproducer

Screenshots and Videos

Screenshot 2025-01-03 at 2 49 30 PM

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 38 (9 by maintainers)

Most upvoted comments

Same here Image

@AlejandroIrizarry to use firebase, you should install cocoapods using statically linked frameworks. You can do that by calling USE_FRAMEWORK=static bundle exec pod install or by adding ENV['USE_FRAMEWORKS']='static' at the beginning of your Podfile… but if you were using React Native with 0.76, that should already be the case.

If you are using NativeBase, we received multiple reports of Native Base not supporting the New Architecture properly (cc. @abubakarsd ).

NativeBase is also deprecated and unmaintained, so I strongly advise you to move away from it as it will work lesse and less with time.

Image

Side note, we already released 0.76.7, 0.77.1 and 0.78.0.

This issue was faced by me, and it was because of react-native-firebase. Because of use_modular_headers . I removed it and it worked. If you are using firebase and want a fix for it then do this change https://github.com/invertase/react-native-firebase/issues/7477#issuecomment-2405602649)ttps://github.com/invertase/react-native-firebase/issues/7477

Also if you see that new project is running perfectly and your current project fails then try to make the package.json and podfile of new project same as that of your current project, so that you will get to see if it is because of any dependency or not.

@cipolleschi it worked. Seems like the issue is in that specific project πŸ˜”

@AlejandroIrizarry Can you try to create a new app from the template with:

npx @react-native-community/cli init NewApp --version latest

And try again? If that works, there is some issue on the specific project.

If that does not, there is some issue in your local configuration.

I just run that yesterday and I had no problems in creating a new project and having it running.

Please:

  • remove node_modules
  • remove the ios/YourApp.xcworkspace file
  • remove the ios/Podfile.lock file
  • remove the ios/Pods folder
  • re-run yarn install
  • move to ios folder
  • run bundle install
  • run bundle exec pod install
  • open the YourApp.xcworkspace file (not the YourApp.xcodeproj file)

@pareshbbi bro, I was actually able to run your reproducer temp project, which you can see in the screenshot. As you can see the my mac running on latest mac version 15.2 and node is also latest but I think the issue with your mac is not with the environment actually it may the simulators issue. Try maybe deleting reinstalling again.

My system info: (Output of npx react-native info)

System: OS: macOS 15.2 CPU: (10) arm64 Apple M4 Memory: 154.91 MB / 16.00 GB Shell: version: β€œ5.9” path: /bin/zsh Binaries: Node: version: 23.5.0 path: /opt/homebrew/bin/node Yarn: version: 1.22.22 path: /opt/homebrew/bin/yarn npm: version: 10.9.2 path: /opt/homebrew/bin/npm Watchman: version: 2024.12.02.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.16.2 path: /Users/lovelytingy/.rbenv/shims/pod SDKs: iOS SDK: Platforms: - DriverKit 24.2 - iOS 18.2 - macOS 15.2 - tvOS 18.2 - visionOS 2.2 - watchOS 11.2 Android SDK: API Levels: - β€œ31” - β€œ33” - β€œ34” - β€œ35” Build Tools: - 30.0.3 - 31.0.0 - 34.0.0 - 35.0.0 - 36.0.0 System Images: - android-35 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2024.2 AI-242.23339.11.2421.12700392 Xcode: version: 16.2/16C5032a path: /usr/bin/xcodebuild Languages: Java: version: 17.0.13 path: /usr/bin/javac Ruby: version: 3.3.6 path: /Users/lovelytingy/.rbenv/shims/ruby npmPackages: β€œ@react-native-community/cli”: installed: 15.0.1 wanted: 15.0.1 react: installed: 18.3.1 wanted: 18.3.1 react-native: installed: 0.76.5 wanted: 0.76.5 react-native-macos: Not Found npmGlobalPackages: β€œreact-native”: Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: true newArchEnabled: true

Screenshot 2025-01-03 at 18 46 12

@pareshbbi Hi, thanks for submitting the issue. I would appreciate some more information, because you just added the basic reproducer, with no additional dependencies and the default App.tsx file.

We test that scenario internally before shipping a new version of React Native, so we know it works.

Can you share:

  • which dependencies are you using when the issue occurs
  • your Podfile
  • your AppDelegate

–

Have you tried to:

  1. remove node_modules
  2. remove the Podfile.lock, the Pods folder and the xcworkspace file
  3. re run yarn install
  4. re run bundle exec pod install ???