Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OCUnit tests to existing iOS project. "ld: file not found"

I've been following this blog post: Adding unit tests to existing project.

I'm getting this error however:

ld: file not found: Build/Products/Debug-iphoneos/MyApp.app/MyApp Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

I have my test target properties,

Bundle Loader = $(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp

Test Host = $(BUNDLE_LOADER)

(which both equate to: build/Debug-iphoneos/MyApp.app/MyApp)

My wild guess is that those variables aren't pointing to the same location as the compiler. "build/Debug-iphoneos/..." vs "Build/Products/Debug-iphoneos/..."

I could be totally wrong on that guess, but either way, does anyone know what's causing this error or how I would fix those environment variables?

Thanks for any help,

Sam

like image 787
Sam Avatar asked Mar 05 '12 22:03

Sam


2 Answers

Dig into ~/Library/Developer/Xcode/DerivedData, down into your project. From there, follow the Bundle Loader path. See what's actually there.

Now look at your Info.plist (or your target's Info settings) and look for "Executable file" or CFBundleExecutable. If it's ${EXECUTABLE_NAME}, check your target's "Product name" setting.

like image 133
Jon Reid Avatar answered Oct 15 '22 14:10

Jon Reid


I ran into the same problem - it didn't make sense as the path it was using to the executable actually existed. Taking a close look at the compile command revealed that there was an extra space on the loader path that was the problem.

like image 24
Steve Dekorte Avatar answered Oct 15 '22 12:10

Steve Dekorte