XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

Framework dependencies aren't found

Open xgalaxy opened this issue 8 years ago • 9 comments

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.

xgalaxy avatar Dec 18 '17 03:12 xgalaxy

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.

xgalaxy avatar Dec 18 '17 03:12 xgalaxy

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.

yonaskolb avatar Dec 18 '17 05:12 yonaskolb

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?

yonaskolb avatar Dec 19 '17 13:12 yonaskolb

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

xgalaxy avatar Dec 23 '17 02:12 xgalaxy

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

yonaskolb avatar Dec 26 '17 16:12 yonaskolb

I'm not sure? I had no problems linking with them and to my recollection I did nothing special.

xgalaxy avatar Jan 06 '18 01:01 xgalaxy

I had to add

    settings:
      FRAMEWORK_SEARCH_PATHS: "$(inherited) $(PROJECT_DIR)/<Path-to-dependency>"

in a similar case.

Lutzifer avatar Mar 28 '18 15:03 Lutzifer

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.

Alex293 avatar May 26 '18 20:05 Alex293

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).

matthesoundman avatar Aug 25 '21 22:08 matthesoundman