Skip to content
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

Crash/error due to jazzy not enabling modules for Objective-C #452

Closed
rastersize opened this issue Jan 7, 2016 · 5 comments
Closed

Crash/error due to jazzy not enabling modules for Objective-C #452

rastersize opened this issue Jan 7, 2016 · 5 comments
Assignees
Milestone

Comments

@rastersize
Copy link

When running jazzy on an Objective-C project of mine I get the following error:

~/Project/include/SomeObjCHeader.h:1:1: error: use of '@import' when modules are disabled

The command used is:

jazzy --sdk iphonesimulator \
      --objc \
      --umbrella-header include/Umbrella.h \
      --framework . \
      --source-directory . \
      --module ModuleName

The error output also contains the following Ruby trace:

/Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/executable.rb:36:in `execute_command': /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/SourceKitten/bin/sourcekitten ["doc", "--objc", "/Users/cedercra/Projects/Spotify/GLUE/include/GLUE.h", "-x", "objective-c", "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk", "-I", "/Users/cedercra/Projects/Spotify/GLUE"] (RuntimeError)

Expanding the arguments manually using the -x flag and adding -fmodules yields a different error though:

jazzy --sdk iphonesimulator \
     --objc \
     --umbrella-header include/Umbrella.h \
     --framework . \
     --source-directory . \
     --module ModuleName \
     --x --objc,/Users/me/Project/include/Umbrella.h,-x,objective-c,-isysroot,/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk,-I,/Users/me/Project,-fmodules

fatal error: Unsupported CXCursorKind: ModuleImport: file /Users/jp/Projects/jazzy/SourceKitten/Source/SourceKittenFramework/ObjCDeclarationKind.swift, line 64
/Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/executable.rb:36:in `execute_command': /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/SourceKitten/bin/sourcekitten ["doc", "--objc", "/Users/me/Project/include/Umbrella.h", "-x", "objective-c", "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk", "-I", "/Users/me/Project", "-fmodules"] (RuntimeError)

fatal error: Unsupported CXCursorKind: ModuleImport: file /Users/jp/Projects/jazzy/SourceKitten/Source/SourceKittenFramework/ObjCDeclarationKind.swift, line 64
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/sourcekitten.rb:140:in `run_sourcekitten'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:57:in `block in build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:55:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/lib/jazzy/doc_builder.rb:55:in `build'
    from /Library/Ruby/Gems/2.0.0/gems/jazzy-0.5.0/bin/jazzy:15:in `<top (required)>'
    from /usr/local/bin/jazzy:23:in `load'
    from /usr/local/bin/jazzy:23:in `<main>'

The Xcode project has modules enabled for the target. jazzy version used is 0.5.0.

Any suggestions on how to get jazzy working?

@rastersize
Copy link
Author

Could it be that SourceKitten doesn’t like our usage of @import OtherModule;? Given that in the second error (when manually setting all the arguments to SourceKitten) it fails on parsing a ModuleImport declaration kind. Related code: ObjCDeclarationKind.swift#L64.

@jpsim ^

@jpsim
Copy link
Collaborator

jpsim commented Jan 7, 2016

You're exactly right! If we added ModuleImport to the list of CXCursorKinds that SourceKitten supports, your second command should work.

Jazzy's Objective-C mode works great once it has the right compiler arguments, but it's not smart enough to do that automatically in all cases yet (see jpsim/SourceKitten#88).

@rastersize
Copy link
Author

@jpsim Aha! Thanks!

Yea the project I’m running it against has a somewhat complex setup. For reasons 😄

@jpsim
Copy link
Collaborator

jpsim commented Jan 7, 2016

Yea the project I’m running it against has a somewhat complex setup. For reasons

Not at all! This is certainly jazzy's limitation here, modules are totally standard in 2016 and we should support them.

@jpsim
Copy link
Collaborator

jpsim commented Apr 6, 2016

This should now be fixed. Thanks for your patience!

@jpsim jpsim closed this as completed Apr 6, 2016
@pigeon-archive pigeon-archive modified the milestone: The Past Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants