carthage version: 0.18.1xcodebuild -version: 8.0 8A218a--no-build? No--no-use-binaries? No--use-submodules? NoI have a framework A that depends on another framework B. The unit tests of framework A also depend on framework B. When I tried to run the unit tests, I got this message:
2016-11-27 20:47:51.056 xctest[65235:1064360] The bundle āATestsā couldnāt be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2016-11-27 20:47:51.057 xctest[65235:1064360] (dlopen_preflight(<<<path to DerivedData>>>): Library not loaded: @rpath/B.framework/B
Referenced from: <<<path to DerivedData>>>
Reason: image not found)
Program ended with exit code: 82
I found this issue: https://github.com/Carthage/Carthage/issues/700 and applied the suggestion made by zirinisp, i.e. I added "$(PROJECT_DIR)/Carthage/Build/iOS" to the test target's Runpath Search Path -- it worked.
Then I went to Carthage's README.md to see if this suggestion is captured there -- it isn't. The README only suggests that I add @loader_path/Frameworks to the "Runpath Search Paths" if it isn't already present, but it was present by default and it's not enough.
Then the README goes on to say that "in rare cases, you may want to also copy each dependency into the build product." I tried that and that worked as well.
So why am I opening this issue?
1) I feel that zirinisp's approach is more elegant. Are there any drawbacks of using that, as opposed to the "Copy Files" approach? If not, would you like to include it in the README?
2) If using the "Copy Files" approach is in fact the recommended way to solve this particular problem of a framework's unit test depending on another framework, then I am not sure the "in rare cases" qualifier is justified.
Considering Carthageās original goal was to be less intrusive, the run path solution seems more in line with that.
If using the "Copy Files" approach is in fact the recommended way to solve this particular problem of a framework's unit test depending on another framework, then I am not sure the "in rare cases" qualifier is justified.
IME _copy files_ isn't always required. I'm not sure under what circumstances it is and isn't.
Copying the files is preferred because then the unit test bundle is self-contained. In most cases, this shouldn't matter. But IMO it's not a great idea to point to frameworks in your project directory.
Closing this due to inactivity. Feel free to reopen if you have any updates on this.
Is there any solutions to this problem?
Two years later this is still an issue. It would be great if there was detail added to the documentation that described this step.
Adding $(PROJECT_DIR)/Carthage/Build/Mac to Runpath Search Paths under the test's Build Settings fixed my problem.
@mattgwwalker Thanks!! Your solution fixed my problem too šŗ
btw, what cause this problem?? š¤ š¤
The above solution should be adde to the docs!!!
Most helpful comment
Two years later this is still an issue. It would be great if there was detail added to the documentation that described this step.
Adding
$(PROJECT_DIR)/Carthage/Build/MactoRunpath Search Pathsunder the test'sBuild Settingsfixed my problem.