.app file not found in Derived Data
Asked Answered
S

7

16

When trying to compile my project I am getting this error and am wondering if anyone knows how to fix it?

I've read every answer on SO and elsewhere on the internet pertaining to this kind of linker error. I've tried so many solutions, including the very popular --delete derived data in xcode, quit xcode completely, delete it again on the command line and then restart xcode-- still nothing. This started after I tried to attach a device to my computer (which I've since deleted from the organizer) that was a friends to try to run it on his iPad. I'm at my wits end and can't afford to waste anymore time on this. Any ideas on how to fix it?

The app file in the Products folder is red.

EDIT: More info: The actual app is not being built and put in the Library/Developer/{app}/Build/Product folder. I've tried reconnecting the device and adding the provision profile manually from the apple website, then trying to Build->Archive the app while the device is selected. I still get the error. I've tried changing from debug to release in the Schemes and doing all of that, I still get the error. I tried uninstalling xcode and reinstalling it, deleting the app completely off the computer (including the derived data) pulling back down from Git and I get the same error.

Ld /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/UnitTests.octest/UnitTests normal i386     cd /Users/mischabuckler/Desktop/Git/TRx     setenv IPHONEOS_DEPLOYMENT_TARGET 6.1     setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator -F/Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Intermediates/TRx.build/Debug-iphonesimulator/UnitTests.build/Objects-normal/i386/UnitTests.LinkFileList -bundle_loader /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/TRx.app/TRx -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -framework SenTestingKit -framework UIKit -framework Foundation -o /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/UnitTests.octest/UnitTests

ld: file not found: /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/TRx.app/TRx clang: error: linker command failed with exit code 1 (use -v to see invocation)

Shevlo answered 9/4, 2013 at 0:45 Comment(4)
Not sure what your question is. What are you trying to do?Concuss
sorry I will edit the question to be more clear.Shevlo
Are you trying to build the test target or the app target?Concuss
I'm trying to build the app targetShevlo
S
5

So for anyone else who finds this and is frustrated what I ended up doing was deleting the target dependencies for both my app and the unit tests and then building the app once, then re-adding them and building the app again, and it worked fine.

Shevlo answered 20/4, 2013 at 7:3 Comment(0)
S
47

This happens when you rename the main target, and the test target hasn't been updated. Check the build settings in the test target and make sure the paths are pointing to the new folders. For example, if you renamed the target SuperAwesome to just Super, your test target is expecting files in SuperAwesome.app/ folder when it should be updated to Super.app/

Sadonia answered 13/10, 2014 at 5:6 Comment(6)
THANK YOU :D - lead to solving lots of other issues using this as wellAnamorphoscope
To fix the issue for me I had to go into the test target, then build settings, Linking category, and delete the path referenced in debug and release. These paths were pointing to the old target prior to renamingPerfume
I am facing the same problem and it is in fact giving an error for the wrong .app. However, I can't seem to find the path reference in Build settings EDIT: I found them under Testing in Build settingsFever
Whilst I hadn't changed the target name itself I had changed the product name so I had to change the test hosts directories to matchBabylonian
This worked for me, thanks, Build Settings - Testing - Test Host debug and release foldersEnsemble
This saved me with this issue #37462203Debauched
D
7

Ok, the clue, while difficult to spot, is that the message you posted above isn't one building your app, but your unit tests. It also mentions it at the top of your output window, but one doesn't expect that to change.

You've possibly renamed your scheme, and in doing so the unit test is pointing to your real build or something else. Your app may well actually have built fine, but its your unit test target that fails.

If the problem is that you've been renaming targets then in your UnitTest scheme, go to build settings and search for TEST, which should bring up the settings for TEST HOST. Make sure these values are pointing to whatever you want the test app to be called and not the main executable.

For me it was just a case of appending "test" onto both the debug & release setting of my test target's TEST_HOST.

It all builds for me now, though annoyingly it is actually building both targets - at least they both compile.

Dispensatory answered 27/11, 2014 at 16:1 Comment(0)
S
5

So for anyone else who finds this and is frustrated what I ended up doing was deleting the target dependencies for both my app and the unit tests and then building the app once, then re-adding them and building the app again, and it worked fine.

Shevlo answered 20/4, 2013 at 7:3 Comment(0)
E
4

Try duplicating the target, and run using the target's copy.

Evvy answered 12/1, 2015 at 8:22 Comment(0)
S
2

I hate Mach-o linker errors, its frustrating, anyway, I faced the same issue by creating a new scheme, it worked like magic for me. Adding new scheme

Stubbed answered 3/9, 2015 at 21:10 Comment(0)
A
1

Go to Project -- > Build Settings --> Testing --> Test Host Remove all the paths in Test Host, and do a clean build.

Anathema answered 11/8, 2015 at 8:54 Comment(0)
P
1

Try to run Clean and then Build/Run the project

enter image description here

Pollie answered 19/9, 2016 at 22:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.