Framework dependencies aren't found
XCodeGen version: 1.4.0 from homebrew tap.
Here is what my dependency section looks like:
dependencies:
- framework: Vendor/Realm/Realm_iOS.framework
- framework: Vendor/Realm/RealmSwift_iOS.framework
In XCode under the Frameworks folder they show up with the relative path as the name. And when I try and compile I get this error:
ld: framework not found Realm_iOS
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I manually remove and readd the frameworks in XCode it compiles fine.
As an aside it would be kind of nice if these didn't show up with the relative path but just the name instead. But I digress.
Interesting, I’ll need to debug this. They should indeed be showing up with just the name, and linking correctly. Are you also adding the vendor directory as a target source? If so, that might be messing things up.
Are you able to share more of your spec @xgalaxy? Do you have the createIntermediateGroups options on, any fileGroups, included Vendor or it's sub directories as sources?
Yes. Sorry for the delay. Maybe I'm doing something wrong? Thanks for the help.
name: Roman
targets:
Roman_iOS:
type: application
platform: iOS
sources:
- path: App/iOS
name: iOS
dependencies:
- framework: Vendor/Realm/Realm_iOS.framework
- framework: Vendor/Realm/RealmSwift_iOS.framework
Roman_watchOS:
type: application.watchapp2
platform: watchOS
sources:
- path: App/watchOS
name: watchOS
dependencies:
- framework: Vendor/Realm/Realm_watchOS.framework
- framework: Vendor/Realm/RealmSwift_watchOS.framework
Your spec looks fine. I downloaded the realm frameworks and couldn't get them to link properly even manually, which is strange. How did you accomplish it? I've fixed the issue with the framework names
I'm not sure? I had no problems linking with them and to my recollection I did nothing special.
I had to add
settings:
FRAMEWORK_SEARCH_PATHS: "$(inherited) $(PROJECT_DIR)/<Path-to-dependency>"
in a similar case.
I used FRAMEWORK_SEARCH_PATHS: "$(inherited) $(PROJECT_DIR)/<Path-to-dependency>" and it worked. For realm keep in mind that you need to include RealmSwift and Realm.
FRAMEWORK_SEARCH_PATHS is being set to the path that is fed from the dependencies.
dependencies:
- framework: path/relative/to/project.yml/myframework.framework
There should be an option to not copy this path to the FRAMEWORK_SEARCH_PATHS as that search path for linking will not be relative to the $(PROJECT_DIR).