rapierorg / telegram-bot-swift

Telegram Bot SDK for Swift (unofficial)
https://github.com/rapierorg/telegram-bot-swift/wiki
Apache License 2.0
375 stars 63 forks source link

Swift build error #45

Closed EgorKolyshkin closed 4 years ago

EgorKolyshkin commented 6 years ago

That's what I did:

swift package init --type executable added a dependency in Package.swift swift build

And it throws a hundreds of errors, like: /opt/local/include/curl/system.h:399:12: note: while building module 'Darwin' imported from /opt/local/include/curl/system.h:399: # include ^ :338:9: note: in file included from :338: #import "ncurses.h" ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/ncurses.h:141:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/ncurses.h:141: #include ^ /opt/local/include/unctrl.h:60:63: error: unknown type name 'SCREEN' NCURSES_EXPORT(NCURSES_CONST char ) NCURSES_SP_NAME(unctrl) (SCREEN, chtype); ^ /opt/local/include/curl/system.h:399:12: note: while building module 'Darwin' imported from /opt/local/include/curl/system.h:399: '#' include ^ ...

My Package.swift:


import PackageDescription

let package = Package(
    name: "todo-bot",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(url: "https://github.com/zmeyc/telegram-bot-swift.git", from: "0.0.0")
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            named: "todo-bot",
            dependencies: ["telegram-bot-swift"]),
    ]
)
zmeyc commented 6 years ago

Could you try:

cd Examples/hello-bot
swift build

Does it fail with the same error?

EgorKolyshkin commented 6 years ago

No, if i git clone https://github.com/zmeyc/telegram-bot-swift And then cd examples/hello-bot and swift build It works fine

zmeyc commented 6 years ago

Does it checkout the latest version? "0.0.0" could fetch very old one. Also I've ported the lib to Swift 4 (in dev branch, not tagged yet), so you may want to try that version instead. It's still work-in-progress, I plan to remove SwiftyJSON dependency then release it.

EgorKolyshkin commented 6 years ago

Oh, I changed the version to the last one, and it doesn't throw errors now. But after I added to main.swift

import TelegramBot

it says "no such module"

zmeyc commented 6 years ago

It's now called TelegramBotSDK.

zmeyc commented 6 years ago

@EgorKolyshkin did it work?

EgorKolyshkin commented 6 years ago

No, i added “TelegramBotSDK” to a target dependency, and after i run swift build, it throws Product Dependency ‘TelegramBotSDK’ not found