crossroadlabs / Markdown

Swift markdown library
GNU General Public License v3.0
80 stars 10 forks source link

'libmarkdown' error `'mkdio.h' file not found` when using the Markdown library after installing Discount via brew #8

Open dotZak opened 7 years ago

dotZak commented 7 years ago

Hello!

After running brew install discount I can see that discount did properly install. However, Swift can't compile my app without using the following command:

swift build -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib -Xswiftc -target -Xswiftc x86_64-apple-macosx10.12

I'm really new to this type of development and unfamiliar with the environment, so I am hoping this is not a real issue and is just some dummy error on my part.

This seems to be related to #3, which should have been resolved via a release for libmarkdown. Is there a status update on that?

Do you mind providing some insight on the issue?

PS. I'm following the Server-Side Swift book by @twostraws and it's been excellent. I've reached a project in the book that uses your library and that's when I found this issue.

System info

macOS 10.12.5 Xcode8.3.3

swift build output

➜  Project11 swift build
note: you may be able to install libmarkdown using your system-packager:

    brew install discount

note: you may be able to install libmarkdown using your system-packager:

    brew install discount

note: you may be able to install libmarkdown using your system-packager:

    brew install discount

Compile Swift Module 'libc' (1 sources)
Compile Swift Module 'Polymorphic' (2 sources)
Compile Swift Module 'Jay' (21 sources)
Compile Swift Module 'PathIndexable' (2 sources)
Compile Swift Module 'SwiftSlug' (1 sources)
Compile Swift Module 'Markdown' (3 sources)
Compile Swift Module 'Spectre' (8 sources)
Compile Swift Module 'Cryptor' (10 sources)
Compile Swift Module 'KituraTemplateEngine' (1 sources)
Compile Swift Module 'SwiftyJSON' (2 sources)
Compile Swift Module 'Socket' (3 sources)
Compile Swift Module 'LoggerAPI' (1 sources)
Compile Swift Module 'Core' (29 sources)
Compile Swift Module 'HeliumLogger' (2 sources)
Compile Swift Module 'Node' (22 sources)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "cdiscount.h"
        ^
/Users/zk/Developer/Server/Project11/.build/checkouts/CDiscount.git-4318135343521947030/cdiscount.h:22:10: error: 'mkdio.h' file not found
#include <mkdio.h>
         ^
/Users/zk/Developer/Server/Project11/.build/checkouts/Markdown.git--5008474681835546292/Sources/Markdown/Markdown.swift:22:8: error: could not build Objective-C module 'CDiscount'
import CDiscount
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "cdiscount.h"
        ^
/Users/zk/Developer/Server/Project11/.build/checkouts/CDiscount.git-4318135343521947030/cdiscount.h:22:10: error: 'mkdio.h' file not found
#include <mkdio.h>
         ^
/Users/zk/Developer/Server/Project11/.build/checkouts/Markdown.git--5008474681835546292/Sources/Markdown/Markdown.swift:22:8: error: could not build Objective-C module 'CDiscount'
import CDiscount
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "cdiscount.h"
        ^
/Users/zk/Developer/Server/Project11/.build/checkouts/CDiscount.git-4318135343521947030/cdiscount.h:22:10: error: 'mkdio.h' file not found
#include <mkdio.h>
         ^
/Users/zk/Developer/Server/Project11/.build/checkouts/Markdown.git--5008474681835546292/Sources/Markdown/Markdown.swift:22:8: error: could not build Objective-C module 'CDiscount'
import CDiscount
       ^
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/zk/Developer/Server/Project11/.build/debug.yaml

With -Xlinker and -target, but not -Xcc

➜  Project11 swift build -Xlinker -L/usr/local/lib -Xswiftc -target -Xswiftc x86_64-apple-macosx10.12
note: you may be able to install libmarkdown using your system-packager:

    brew install discount

note: you may be able to install libmarkdown using your system-packager:

    brew install discount

note: you may be able to install libmarkdown using your system-packager:

    brew install discount

Compile Swift Module 'Markdown' (3 sources)
Compile Swift Module 'Jay' (21 sources)
Compile Swift Module 'libc' (1 sources)
Compile Swift Module 'Polymorphic' (2 sources)
Compile Swift Module 'PathIndexable' (2 sources)
Compile Swift Module 'SwiftSlug' (1 sources)
Compile Swift Module 'Spectre' (8 sources)
Compile Swift Module 'KituraTemplateEngine' (1 sources)
Compile Swift Module 'Cryptor' (10 sources)
Compile Swift Module 'SwiftyJSON' (2 sources)
Compile Swift Module 'Socket' (3 sources)
Compile Swift Module 'LoggerAPI' (1 sources)
Compile Swift Module 'Core' (29 sources)
Compile Swift Module 'HeliumLogger' (2 sources)
Compile Swift Module 'Node' (22 sources)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "cdiscount.h"
        ^
/Users/zk/Developer/Server/Project11/.build/checkouts/CDiscount.git-4318135343521947030/cdiscount.h:22:10: error: 'mkdio.h' file not found
#include <mkdio.h>
         ^
/Users/zk/Developer/Server/Project11/.build/checkouts/Markdown.git--5008474681835546292/Sources/Markdown/Markdown.swift:22:8: error: could not build Objective-C module 'CDiscount'
import CDiscount
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "cdiscount.h"
        ^
/Users/zk/Developer/Server/Project11/.build/checkouts/CDiscount.git-4318135343521947030/cdiscount.h:22:10: error: 'mkdio.h' file not found
#include <mkdio.h>
         ^
/Users/zk/Developer/Server/Project11/.build/checkouts/Markdown.git--5008474681835546292/Sources/Markdown/Markdown.swift:22:8: error: could not build Objective-C module 'CDiscount'
import CDiscount
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "cdiscount.h"
        ^
/Users/zk/Developer/Server/Project11/.build/checkouts/CDiscount.git-4318135343521947030/cdiscount.h:22:10: error: 'mkdio.h' file not found
#include <mkdio.h>
         ^
/Users/zk/Developer/Server/Project11/.build/checkouts/Markdown.git--5008474681835546292/Sources/Markdown/Markdown.swift:22:8: error: could not build Objective-C module 'CDiscount'
import CDiscount
       ^
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/zk/Developer/Server/Project11/.build/debug.yaml

The "working" command

➜  Project11 swift build -Xcc -I/usr/local/include -Xlinker -L/usr/local/lib -Xswiftc -target -Xswiftc x86_64-apple-macosx10.12
note: you may be able to install libmarkdown using your system-packager:

    brew install discount

note: you may be able to install libmarkdown using your system-packager:

    brew install discount

note: you may be able to install libmarkdown using your system-packager:

    brew install discount

Compile Swift Module 'Markdown' (3 sources)
Compile Swift Module 'libc' (1 sources)
Compile Swift Module 'Polymorphic' (2 sources)
Compile Swift Module 'Jay' (21 sources)
Compile Swift Module 'PathIndexable' (2 sources)
Compile Swift Module 'SwiftSlug' (1 sources)
Compile Swift Module 'Spectre' (8 sources)
Compile Swift Module 'Cryptor' (10 sources)
Compile Swift Module 'KituraTemplateEngine' (1 sources)
Compile Swift Module 'SwiftyJSON' (2 sources)
Compile Swift Module 'Socket' (3 sources)
Compile Swift Module 'LoggerAPI' (1 sources)
Compile Swift Module 'Core' (29 sources)
Compile Swift Module 'HeliumLogger' (2 sources)
Compile Swift Module 'Node' (22 sources)
Compile Swift Module 'PathKit' (1 sources)
Compile Swift Module 'Stencil' (19 sources)
Compile Swift Module 'KituraStencil' (1 sources)
Compile Swift Module 'JSON' (9 sources)
Compile Swift Module 'MySQL' (11 sources)
Compile Swift Module 'SSLService' (1 sources)
Compile CHTTPParser http_parser.c
Compile CHTTPParser utils.c
Linking CHTTPParser
Compile Swift Module 'KituraNet' (34 sources)
Compile Swift Module 'Kitura' (43 sources)
Compile Swift Module 'project11' (1 sources)
Linking ./.build/debug/project11
kirktautz-zz commented 7 years ago

Same issue. Thank you for the working command. I am on the same lesson in that book and ran into the exact same issue. Hopefully it will be resolved soon.

enzosterro commented 7 years ago

I have the identical issue, but I've temporary resolved it with the "working" command. Thanks a lot, @dotZak!