SourceKitten icon indicating copy to clipboard operation
SourceKitten copied to clipboard

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

Open owensd opened this issue 9 years ago • 2 comments

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 avatar Jul 30 '16 21:07 owensd

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.

owensd avatar Jul 31 '16 07:07 owensd

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.

jpsim avatar Aug 21 '16 19:08 jpsim