New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The framework output during `make install` is not sufficient for development #232

Open
owensd opened this Issue Jul 30, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@owensd
Copy link
Contributor

owensd commented Jul 30, 2016

When downloading SourceKitten and running make install, the resulting framework that is output into /usr/local/Frameworks is not sufficient for development as it is missing many important parts of the framework's contents.

Here's the output from tree:

› tree /usr/local/Frameworks/SourceKittenFramework.framework
/usr/local/Frameworks/SourceKittenFramework.framework
├── Resources -> Versions/Current/Resources
├── SourceKittenFramework -> Versions/Current/SourceKittenFramework
└── Versions
    ├── A
    │   ├── Frameworks
    │   │   ├── Commandant.framework
    │   │   │   ├── Commandant -> Versions/Current/Commandant
    │   │   │   ├── Resources -> Versions/Current/Resources
    │   │   │   └── Versions
    │   │   │       ├── A
    │   │   │       │   ├── Commandant
    │   │   │       │   └── Resources
    │   │   │       │       └── Info.plist
    │   │   │       └── Current -> A
    │   │   ├── Result.framework
    │   │   │   ├── Resources -> Versions/Current/Resources
    │   │   │   ├── Result -> Versions/Current/Result
    │   │   │   └── Versions
    │   │   │       ├── A
    │   │   │       │   ├── Resources
    │   │   │       │   │   └── Info.plist
    │   │   │       │   └── Result
    │   │   │       └── Current -> A
    │   │   ├── SWXMLHash.framework
    │   │   │   ├── Resources -> Versions/Current/Resources
    │   │   │   ├── SWXMLHash -> Versions/Current/SWXMLHash
    │   │   │   └── Versions
    │   │   │       ├── A
    │   │   │       │   ├── Resources
    │   │   │       │   │   └── Info.plist
    │   │   │       │   └── SWXMLHash
    │   │   │       └── Current -> A
    │   │   ├── Yaml.framework
    │   │   │   ├── Resources -> Versions/Current/Resources
    │   │   │   ├── Versions
    │   │   │   │   ├── A
    │   │   │   │   │   ├── Resources
    │   │   │   │   │   │   └── Info.plist
    │   │   │   │   │   └── Yaml
    │   │   │   │   └── Current -> A
    │   │   │   └── Yaml -> Versions/Current/Yaml
    │   │   ├── libswiftCore.dylib
    │   │   ├── libswiftCoreGraphics.dylib
    │   │   ├── libswiftDarwin.dylib
    │   │   ├── libswiftDispatch.dylib
    │   │   ├── libswiftFoundation.dylib
    │   │   ├── libswiftIOKit.dylib
    │   │   └── libswiftObjectiveC.dylib
    │   ├── Resources
    │   │   └── Info.plist
    │   └── SourceKittenFramework
    └── Current -> A

30 directories, 22 files

Compare this to the framework that is output of the framework that is built by the SourceKittenFramework target:

├── Headers -> Versions/Current/Headers
├── Modules -> Versions/Current/Modules
├── Resources -> Versions/Current/Resources
├── SourceKittenFramework -> Versions/Current/SourceKittenFramework
└── Versions
    ├── A
    │   ├── Headers
    │   │   ├── BuildSystem.h
    │   │   ├── CXCompilationDatabase.h
    │   │   ├── CXErrorCode.h
    │   │   ├── CXString.h
    │   │   ├── Documentation.h
    │   │   ├── Index.h
    │   │   ├── Platform.h
    │   │   ├── SourceKittenFramework-Swift.h
    │   │   ├── SourceKittenFramework.h
    │   │   └── sourcekitd.h
    │   ├── Modules
    │   │   ├── SourceKittenFramework.swiftmodule
    │   │   │   ├── x86_64.swiftdoc
    │   │   │   └── x86_64.swiftmodule
    │   │   └── module.modulemap
    │   ├── Resources
    │   │   └── Info.plist
    │   └── SourceKittenFramework
    └── Current -> A

10 directories, 16 files

There are two very import sections missing from the framework that gets published in /usr/local/Frameworks:

  1. The Versions/Current/Headers contents
  2. The Versions/Current/Modules contents

Without both of these, attempting to link against this copy of the framework to use for development proves to be fruitless and results in the compiler error:

<path/to/file:line:column> error: no such module 'SourceKittenFramework'
import SourceKittenFramework
       ^

No amount of changing @rpath values or framework search path locations is going to help (unless you happen to change the search path to the location of a valid SourceKittenFramework.framework, which ends up causing a lot of confusing, as I ran into).

I'm working a PR that can address this issue as I don't think you intended to have two different versions of the framework.

@owensd

This comment has been minimized.

Copy link
Contributor

owensd commented Jul 31, 2016

So it looks like intended behavior that Xcode is stripping the information out of the framework during the "embedding" process.

I guess it's really up to you to decide if you think the version that is published should also be the same version as what is used when publishing your releases. However, this issue is a bit circular. I've figured out my exact repro steps of not getting everything working last night.

After I couldn't figure out what was going on, I tried to use the published release version: SourceKittenFramework.framework.zip. However, this will end up getting you the same issues that I ran into above:

<path/to/file:line:col>: error: missing required modules: 'SWXMLHash', 'Yaml'
import SourceKittenFramework
       ^

Since the developer versions (e.g. the ones with the headers and module information) are not published, the only way to use SourceKittenFramework is to download the source, build, and extract out all of the necessary frameworks.

/sigh... Xcode is really not helping us out here.

Anyhow, PR #233 is out to partially address this issue.

jpsim added a commit that referenced this issue Aug 21, 2016

@jpsim

This comment has been minimized.

Copy link
Owner

jpsim commented Aug 21, 2016

This is due to changes in #215, which evidently is causing issues. Prior to that, make install would include dependency frameworks nested in the Frameworks directory of SourceKittenFramework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment