react-native-config: Build input file cannot be found with Xcode 14

I was able to build different environments using Xcode 13, but after updating to Xcode 14, I got this error: error build: Build input file cannot be found: '/Users/user/Library/Developer/Xcode/DerivedData/.../Build/Products/GeneratedInfoPlistDotEnv.h'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

Any ideas? Thanks in advance!!

Xcode version: 14.0
react-native: 0.67.4
react-native-config: 1.4.6

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 22
  • Comments: 22

Most upvoted comments

For me, in ios/<app>.xcodeproj/project.pbxproj,

EXCLUDED_ARCHS = arm64 ; which I removed, then started working

Same issue on my side, project is working fine on XCode 13 and get the same error with XCode 14. Tried to upgrade to 1.4.7 but doesn’t changed anything. Also tried to build with legacy build settings, doesn’t helped neither 😕

My workaround is back to Xcode 13, hope it helps your case @albat

We were able to work around this issue. In our case, because the .podspec file doesn’t list $BUILD_DIR/GeneratedInfoPlistDotEnv.h as an output_file in its [CP-User] Config codegen Run Script phase, Xcode was not building react-native-config early enough. This caused our app target to fail because the header file had not been generated yet. Adding an output_files entry to the .podspec fixes this issue.

Here is a patch if you’re using patch-package:

$ cat patches/react-native-config+1.4.6.patch

diff --git a/node_modules/react-native-config/react-native-config.podspec b/node_modules/react-native-config/react-native-config.podspec
index 54985dd..854bfe7 100644
--- a/node_modules/react-native-config/react-native-config.podspec
+++ b/node_modules/react-native-config/react-native-config.podspec
@@ -25,7 +25,8 @@ HOST_PATH="$SRCROOT/../.."
 "${PODS_TARGET_SRCROOT}/ios/ReactNativeConfig/BuildDotenvConfig.rb" "$HOST_PATH" "${PODS_TARGET_SRCROOT}/ios/ReactNativeConfig"
 ),
     execution_position: :before_compile,
-    input_files: ['$PODS_TARGET_SRCROOT/ios/ReactNativeConfig/BuildDotenvConfig.rb']
+    input_files: ['$PODS_TARGET_SRCROOT/ios/ReactNativeConfig/BuildDotenvConfig.rb'],
+    output_files: ['$BUILD_DIR/GeneratedInfoPlistDotEnv.h']
   }
 
   s.requires_arc = true

We also had updated from a previous version of react-native-config which was generating the header file in a different location. As a result, we also had to update our Info.plist Preprocessor Prefix File build setting to point to the new location $(BUILD_DIR)/GeneratedInfoPlistDotEnv.h image

Working in 1.4.11 version

I found my own solution (using an old version of React Native):

Added this to the “Bundle React Native Code And Images” phase (which contains the script node_modules/react-native/scripts/react-native-xcode.sh:

outputPaths = (
"${BUILD_DIR}/GeneratedInfoPlistDotEnv.h"
);

I found my own solution (using an old version of React Native):

Added this to the “Bundle React Native Code And Images” phase (which contains the script node_modules/react-native/scripts/react-native-xcode.sh:

outputPaths = (
"${BUILD_DIR}/GeneratedInfoPlistDotEnv.h"
);

work for me too,

I found my own solution (using an old version of React Native):

Added this to the “Bundle React Native Code And Images” phase (which contains the script node_modules/react-native/scripts/react-native-xcode.sh:

outputPaths = (
"${BUILD_DIR}/GeneratedInfoPlistDotEnv.h"
);

Worked for me!!!

i have same issue.

Build input file cannot be found: '/Users/inkcrazy/Library/Developer/Xcode/DerivedData/Daling-arvboeyqyunjixcoavidvtbyfrru/Build/Intermediates.noindex/ArchiveIntermediates/Daling/InstallationBuildProductsLocation/Applications/Daling.app/Daling'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

i change

-"EXCLUDED_ARCHS[sdk=*]" = arm64;
+"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;

66f8f100b472cd5f48301b02b747056f

Switching the scheme works for me

After spending hours of debugging, I ended up downgrading to the Xcode 13. It was the only solution for me as of now. When I compared the file changes since the last time the build was successfully archived, I observed that there were some code changes made by the Xcode 14(when I ran the build in it) in the file ios/<project_name>.xcodeproj/project.pbxproj something like:

/* ReactNativeConfig.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeConfig.xcodeproj; path = "../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj"; sourceTree = "<group>"; };

and

/* libReactNativeConfig.a in Frameworks */,

There were a couple more related to ReactNativeConfig.xcodeproj.

I reverted those, downgraded to Xcode 13, deleted Derived Data, tried archiving again and this time, it was successful.

1 more thing, I recently switched to the M2 Mac from Intel-Based Mac(last successful Archive was on Intel-Based Mac). I am not sure if that has anything to do with this issue.

I hope it will be helpful for someone.