johnxnguyen / Down

Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.
Other
2.26k stars 327 forks source link

Unable to build Swift package in Xcode 11.4.1 #209

Closed SwiftDevJournal closed 4 years ago

SwiftDevJournal commented 4 years ago

Please help prevent duplicate issues before submitting a new one:

Report

What did you do?

  1. Add Down to Swift Packages for Mac Cocoa app project with Xcode 11.4.1.
  2. Use master branch as the rule for the Swift package.
  3. Build the project.

What did you expect to happen?

I expected the package to build and to be able to import Down.

What happened instead?

I get the following compiler errors:

unknown type name 'cmark_reference_map'

For the following lines of code in the file inlines.h

void cmark_parse_inlines(cmark_mem *mem, cmark_node *parent,
                         cmark_reference_map *refmap, int options);

bufsize_t cmark_parse_reference_inline(cmark_mem *mem, cmark_chunk *input,
                                       cmark_reference_map *refmap);

I also get the error "Could not build Objective-C module libcmark" in the file BaseNode.Swift.

When I try to import Down, I get the following error message:

No such Module Down

UPDATE

I get the same compiler errors when I clone the Down project from GitHub and try to build the Swift package.

Luten commented 4 years ago

Got the same error while copying sources of Down lib inside my project and trying to build it. Xcode 11.4.1

Fixed it by adding #include <references.h> in inlines.h But after that got bunch of No such module 'libcmark' errors: #211

iwasrobbed-ks commented 4 years ago

Hi there 👋 I don't use Swift PM but feel free to open a pull request if you have fixes and improvements to that build process

KrisConrad commented 4 years ago

I'm also getting the Missing required module 'libcmark' error when trying to include the project from SPM or Cocoapods.

I've seen a lot of reports of this, many closed, but no fix.

iwasrobbed-ks commented 4 years ago

@KrisConrad Feel free to file a fix and happy to merge it; I don't use those build systems. I exclusively use CocoaPods and it works fine there on multiple versions of Xcode and iOS/macOS.

kengruven commented 4 years ago

Have you tried upgrading Xcode? There's an Xcode 11.5 now, which still supports every system that 11.4.x did.

I added "iwasrobbed/Down" as a Swift Package to a new Project in Xcode 11.5, and it built just fine. Then I added the first couple lines from Down's README to that program (and logged it), and it was able to generate HTML from Markdown. So, no problems with Down-via-SPM here.

SwiftDevJournal commented 4 years ago

I am able to build the Swift package in Xcode 11.6.