Problems after upgrading to Xcode 10: Build input file cannot be found
Asked Answered
P

32

166

I upgraded my Xcode SDK to version 10 last night and then find I cannot build.

I'm getting this error:

Build input file cannot be found: '/Users/call01/Library/Developer/Xcode/DerivedData/Comp-Lite-Apps-gytvmossqptokeafrddvvmnlzadk/Build/Products/Debug-iphoneos/SG11.app/SG11

which did not exist before my upgrade and I'm tempted to revert back but would like to stick with version 10 if I can resolve this issue.

Presbyter answered 19/9, 2018 at 8:51 Comment(0)
A
162

Try to switch back to the Legacy Build System (File > Project Settings > Workspace Settings > Legacy Build System)

Amesace answered 24/9, 2018 at 12:39 Comment(4)
It can also be occur if you move the info.plist to other directory. Just a comment :DMousse
Didn't work for me. What worked for me was: 1. Clean project and remove "DerivedData". 2. Remove input files not found (reference only without deleting) from project. 3. Build 4. Add files again. 5. BuildLoath
For me this is not an option since it produced another error "error: the use of xcframeworks is not supported in the legacy build system."Timmerman
This is workaround, not solution!Concinnity
P
157

For Swift files or files that belong to the project such as:

Build input file cannot be found: PATH/TO/FILE/FILE.swift

This issue can happen when files or folders have been removed or moved in the project.

To fix it:

  1. Go in the project-navigator, select your project

  2. Select Build Phasestab

  3. In Compile Sources section, check for the file(s) that Xcode is complaining of

  4. Notice that the file(s) have the wrong path, and delete them by clicking on the minus icon

  5. Re-add the file(s) by clicking the plus icon and search in the project.

  6. Product > Clean Build Folder

  7. Build

You generally find these missing files in the Recovered References folder of Xcode in the project tree (look for the search bar at the bottom-left of Xcode and search for your complaining file):

Deleting them from this folder can also solve the error.

Pretension answered 11/3, 2019 at 23:5 Comment(1)
Sometimes when I rename from within XCode, the file in 'Finder' still holds the old name. Locate the file in 'Finder' and rename it to the new name.Juna
G
81

For me In Xcode 10, this solution worked like a charm. Just go to the Recovered References folder and remove all files in red color and add it again with proper reference. If Recovered References folder was not found: Check for all missing files in the project (files in red colour) and try to add files references again.

enter image description here

Geometry answered 25/10, 2018 at 8:54 Comment(4)
I cannot find "Recovered References" on my projectDisinfect
What do you mean by "add it again with proper reference" after we've removed the red files?Friederike
@Friederike I meant that You can add those file references again in your project, with drag and drop or copy paste. Just like adding a new file in the project.Geometry
@davidmlee I think what this guy means in other words is: "open all of your folders in the project, delete the red stuff, and add it in again." There doesn't need to be a recovered references folder.Detroit
W
31

Just check the path to .plist file in Build Settings of your target

enter image description here

Whitleywhitlock answered 26/8, 2019 at 13:49 Comment(1)
What exactly is to be checked here?Jojo
S
28

Funnily, closing Xcode and reopening it might also be enough.

Spinel answered 20/12, 2018 at 14:18 Comment(0)
J
25

This worked for me in Xcode 10:

  • Click Project icon/name in your Xcode project
  • Go to General tab
  • Click [Choose info.plist File] under Identity section
  • Select the info.Plist file
  • Check Info tab to see if info.plist was loaded successfully
  • Build and run
Jerk answered 31/10, 2018 at 14:36 Comment(0)
F
24

This is an architecture problem. Do not change to legacy build system!

I got the same error, but what solved it for me was this:

You see at the top?

The top says architectures in VALID_ARCHS are also excluded in EXCLUDED ARCHS. I was messing around with them to get a Swift Package to compile in Xcode 12, and have spent hours on this.

It would compile on the simulator and not on a device.

The Solution:

  • Go to Build Settings
  • Ensure "Architectures" contains 1 entry : $(ARCHS_STANDARD)
  • Ensure there is nothing in "Excluded Architectures"

Build Settings

  • Now scroll right to the bottom of Build Settings.
  • Make sure the VALID_ARCHS is exactly the same as this screenshot.
  • The arm stuff is $(ARCHS_STANDARD) again.
  • If VALID_ARCHS doesn't exist, add it with the + button.

Add button for VALID_ARCHS

VALID_ARCHS

  • Clean (cmd-shift-K)
  • Your project should now build perfect on both the simulator and device!
  • If it doesn't work, you need to make sure all these settings are the same both in your target build settings and the project build settings.
  • Note, if you have a Mac with Apple silicon, you may not need to do any of this.
Fabria answered 16/3, 2021 at 12:47 Comment(1)
I have mac with Apple Silicon. If I try to build the app I am getting the error as Showing All Errors Only Build input file cannot be found: '/Users/name/Library/Developer/Xcode/DerivedData/helloapp-dhdivlzaazbnhtguhlgnkkglsibo/Build/Products/Debug-iphonesimulator/Hello App.app/Hello App'. Any work around for this?Culpepper
D
15

The above solution eventually works for me; however, I need to do some more extra steps to finally make it to compile successfully. (These extra steps were required even on Xcode 9.)

  1. Xcode: File -> Workspace Settings -> Build System: Legacy Build System
  2. Xcode: Product -> Clean
  3. Rotate to compile thru different emulator types, such as "iPhone 8", "iPhone 8 Plus", etc. (They might fail or might not.)
  4. Eventually compile on "Generic iOS Device"
Disinfect answered 18/10, 2018 at 18:45 Comment(0)
U
14

I fixed this issue this way: go to your project's Build Phases (click on project icon at the top, and then click on Build Phases). Search for your file there. If it's there (it'll be grayed out), delete it. Then clean (shift + alt + command + k), and run! Hope it helps.

Undemonstrative answered 20/11, 2018 at 19:19 Comment(0)
N
12

If the error says it can't find Info.plist and it's looking in the wrong path, do the following:

  1. Select your project from the navigator, then select your target
  2. Select "Build Settings" and search "plist"
  3. There should be an option called Info.plist File. Change the location to the correct one.
Nawrocki answered 19/2, 2019 at 1:35 Comment(1)
Thank you! It's still a solution today on Xcode 15.2. It's in the Packaging>info.plist File entry. Happened for me after a project rename.Morpheme
G
6

None of the above worked for me, but this did:

  1. Open project in Finder, right click on your .xcodeproj file and show package contents
  2. Open project.pbxproj in a text editor
  3. Find the reference to your missing file
  4. Edit path = "path/to/file.swift" to the actual location on disk and save the file.
  5. Rebuild the project
Goshen answered 28/5, 2019 at 11:55 Comment(0)
J
5

In my case I had a build script that generated the .app binary (Buck). The Buck build script ran in parallel with Swift Embed build step. Because the .app binary was not generated yet the Swift step would fail.

In my build script I added "$BUILD_PRODUCTS_DIR/$EXECUTABLE_PATH" under "Output Files".

This tells Xcode's New Build System that this script will output the app Binary and in turn Xcode will make sure to synchronize any build steps that depend on this artifact.

enter image description here

Jaguar answered 3/8, 2020 at 20:15 Comment(0)
G
4

Open the right navigation pane where your project files exist OR JUST click on cmd + 1. Then search for "Recovered References" folder. Open it and delete all red files, then everything will work so fine.

Grillparzer answered 9/12, 2018 at 18:16 Comment(0)
B
4

I ran into this error after renaming a file. Somehow Xcode didn't correctly rename the actual file on disk.

So it wasn't able to find the file. Sometimes the files gets highlights with a red text color. At other times the Swift icon in front of the file was getting a gray overlay.

The fix was simple.

  • Look into the error and see exactly which file it's unable to find.
  • Select the file that can't be found.
  • Go to the 'File Inspector'. It's on Xcode's right navigation pane.
  • Click on the folder icon.
  • Select the correct file.
  • Clean build and run it again.
Besprent answered 14/2, 2020 at 13:9 Comment(0)
S
3

This worked for me

  1. try deleting the red colored files
  2. delete the files in derived data
  3. clean the build folder
  4. then try building by using "new build system" from file->workspace settings
Sever answered 12/11, 2018 at 11:15 Comment(0)
K
3

I had this happen for building my unit tests. This may have happened because I deleted the example tests.

I removed the Unit test bundle then re-added it as shown in the pictures below and all was well again.

enter image description here

enter image description here

Kvass answered 22/2, 2019 at 14:58 Comment(0)
H
3

I had a similar issue after upgrading to a new swift version recently. Moving files around caused my xcode project to reference items that were no longer in the project directory giving me the Error Code Build Input File Not Found.

In my situation I somehow had multiple files/images that were being referenced as described below:enter image description here

In the image above.

  • Navigate to your Targets page.
  • Then Click on the Build Phases tab on the top.
  • Scroll Down to Copy Bundle Resources
  • Find the affected files and remove them. (hit delete on them or select them and hit the minus button )

It was in here that I somehow had multiple files and images that were being referenced from other folders and the build would fail as they could no longer find them. And I could not find them either! or how Xcode was still referencing them

I hope this helps someone else !

Hallowed answered 29/3, 2019 at 19:56 Comment(0)
D
2

I had the same issue. The problem was that I didn't have any file under the Target > Build Phases > Compile Sources. The problem was solved after I added at leas one file to Compile Sources.

Derayne answered 24/4, 2019 at 10:40 Comment(0)
B
2

Not that I did anything wrong, but I ran into this issue for a completely different reason and kinda know what caused this.

I previously used finder and dragged a file into my project's directory/folder. I didn't drag into Xcode. To make Xcode include that file into the project, I had to drag it into Xcode myself later again.

But when I switched to a new branch which didn't have that file (nor it needed to), Xcode was giving me this error:

Build input file cannot be found: '/Users/honey/Documents/xp/xpios/powerup/Models Extensions/CGSize+Extension.swift'


I did clean build folder and delete my derived data, but it didn't work until I restarted my Xcode.

Besprent answered 24/4, 2019 at 15:7 Comment(0)
C
2

In my case, the file (and the directory) that XCode was mentioning was incorrect, and the issue started occurring after a Git merge with a relatively huge branch. To fix the same, I did the following steps:

  • Searched for the file in the directory system of XCode.
  • Found the errored file highlighted in red (i.e, it was missing).
  • Right clicked on the file and removed the file.
  • I tried building my code again, and voila, it was successful.

I hope these steps help someone out.

Clydesdale answered 19/12, 2019 at 12:36 Comment(0)
Z
1

What Xcode was complaining about was a XIB file I got it working by going to Project -> Build Phases -> Copy Bundle Resources, removing the "problematic" XIB, cleaning (CMD+Shift+K), building and adding it back again.

Zipnick answered 10/2, 2019 at 3:6 Comment(0)
C
1

There is also one possibility that sometimes when you move your files to different folder and especially when you move your info.plist to other folder, you need to define the location of that file. To solve this problem, simply click on your project blue icon on the top, and you will see a button in place of project name and bundle id, click on it and locate the info.plist file there, clean and compile happily.

Coburg answered 19/3, 2019 at 8:26 Comment(0)
O
1

I ran into this problem soon after upgrading to Xcode 10, but that was not the issue.

I tried changing the build system, but that gave me a separate error that meant the same thing. Generally saying "File X can not be found".

There are multiple things to check when a file can not be found.

  1. Recovered references Folder Apple does this nice thing where if it detects a reference to a file that doesn't exists it will add this reference into a group called "Recovered References"

That is nice of Apple but it doesn't always work.

  1. Build Phases Compile Sources In this list, there could be meta data for a file that the project is suppose to compile, but the file does not actually exists and it's attempting to find the file at the given path. In this list it will be dimmed out, delete them and re-add them by toggling the file's target dependencies or manually removing it and dragging it in.

  2. File's Path Double check the file path that the error is printing out and the file path for the file in finder. You can easily see this by clicking on the file in Xcode and checking the "Show the file inspector" tab (the left most tab). If these paths are correct then you are good!

  3. Dimmed out files in your project that are not in recovered references or red This one pissed me off because it's not obvious about what happened, but basically if you go into finder and move a file to a different location with out updating the reference in the project it will throw the error as the file no longer exists there. The only indication I have found for that is that the file in the "Project Navigator" tab (left most tab) is very slightly dimmed, but when you go to delete this file Xcode doesn't prompt you to delete the reference or send to trash. You can fix this by deleting the file and re-adding it to the project or going to the "File Inspector" tab and click the folder icon next to the path and change it to the proper location.

Either way, the error indicates that it can't find a file, switching to the old build system is a bandaid for a more concrete issue. We as developers understand that a compiler just wants an artifact to be listed at the end of a file path. Somewhere the path is not correct! We have to find where that is!

My issue was resolved with item 4 listed above. Hope this helps somebody.

Obsecrate answered 17/4, 2019 at 13:12 Comment(0)
O
1

In my case I accidentally deleted one third-party xcodeproj folder I used in my app.

Ovovitellin answered 28/7, 2019 at 6:31 Comment(0)
C
1

If you tried profiling, and then it didn't work, and now you cannot build, go into your Target pane (via the Project Icon), Switch to the Build Settings tab, search for PROFILE - and set CLANG_USE_OPTIMIZATION_PROFILE to "No".

Ctenidium answered 15/1, 2020 at 8:31 Comment(0)
B
1

In my case, I had created a new test target and deleted the default swift file so it was left with just the info.plist. Adding a new file fixed this.

Bughouse answered 11/5, 2020 at 14:34 Comment(0)
L
1

The "Legacy Build System" solution didn't work for me. What worked it was:

  1. Clean project and remove "DerivedData".
  2. Remove input files not found from project (only references, don't delete files).
  3. Build (=> will generate errors related to missing files).
  4. Add files again to project.
  5. Build (=> should SUCCEED).
Loath answered 21/9, 2020 at 21:58 Comment(0)
W
1

I know that this is an old subject, but I found the issue with xcode 12.3 and was related to an error while doing the CopyPlist of the main.Storyboard during compilation.

Actually, changing the build settings to "Legacy Build Setting" worked, but it is deprecated, so I discarded it because is a short term solution.

Check this:

enter image description here

With that setting, worked for me. Before I had "Copy plist".

Windbag answered 11/1, 2021 at 11:57 Comment(0)
H
1

I had deleted a Pod Folder to fix an error. If you're using cocoa pods, run:

  1. pod deintegrate
  2. pod install

This should rebuild your pods and all files inside of them.

Hawker answered 23/9, 2021 at 17:22 Comment(0)
M
1

After struggling with this issue for about 45mins, here is a super easy solution that worked for me.

  1. On the project explorer, click on the file/folder that is in red colour (means project is not able to locate the file)
  2. Look at the details tab in the file inspector (generally to the right of the screen - see the attached screenshot)
  3. Click on the folder icon and locate the real file/folder in your local machine.

That is it. This should do the trick. Basically help your xcode locate the directories and update the reference cache.

enter image description here

Miki answered 23/10, 2021 at 20:30 Comment(0)
M
1

Just leaving extra one here not seemed to be listed above.

I've had Excluded architecture arm64 in build settings while trying to launch it on iphone 7 plus.

Removing it solved the issue

Markmarkdown answered 25/7, 2023 at 12:12 Comment(0)
Y
0

Random, for Cocoapods: I hadn't added my test target to my Podfile.

Yttriferous answered 25/8, 2021 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.