Kitura / Kitura-CredentialsHTTP

A plugin for the Kitura-Credentials framework that authenticates using HTTP Basic and Digest authentication
Apache License 2.0
16 stars 14 forks source link

Issue with linking of CommonCrypto #45

Open oleksandrlysenkov opened 6 years ago

oleksandrlysenkov commented 6 years ago

Hello, I want add HTTP basic auth to my project but when I add CredentialsHTTP package I got error during building the package - http://prntscr.com/ihtfu7

Also I found it's a common issues: https://github.com/IBM-Swift/BlueCryptor/issues/27 https://github.com/IBM-Swift/BlueCryptor/issues/29

With the same list of packages, but without CredentialsHTTP everything is built fine http://prntscr.com/ihthyi Please help me with this issue.

Thanks in advance, Oleksandr

ianpartridge commented 6 years ago

Hi, can you paste your full Package.swift here please?

oleksandrlysenkov commented 6 years ago
// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Server",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMajor(from: "2.2.0")),
        .package(url: "https://github.com/IBM-Swift/Kitura-Credentials.git", .upToNextMajor(from: "2.1.0")),
        // .package(url: "https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git", from: "2.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(
            name: "Server",
            dependencies: ["Kitura", "SwiftShell", "Credentials"]),
    ]
) 
oleksandrlysenkov commented 6 years ago

Have you uncommented .package(url: "https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git", from: "2.0.0"), for Package.swift file from above? Exactly this causes an error - http://prntscr.com/ihulnn Currently there is no Fetching https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git string in your quote above. Without .package(url: "https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git", from: "2.0.0") everything works fine.

Please use this code (same but with uncommented CredentialsHTTP package):

// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Server",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMajor(from: "2.2.0")),
        .package(url: "https://github.com/IBM-Swift/Kitura-Credentials.git", .upToNextMajor(from: "2.1.0")),
        .package(url: "https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git", from: "2.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(
            name: "Server",
            dependencies: ["Kitura", "SwiftShell", "Credentials"]),
    ]
) 
rchatham commented 6 years ago

I'm getting the same error! Is there any updates to this?

Andrew-Lees11 commented 6 years ago

@rchatham Thanks for bringing this to our attention. The cause of this a conflict between Kitura-CredentialsHTTP which uses upToNextMinor of Kitura-Credentials from 2.0.0 and Kitura-Credentials which is set to 2.1.0.

You can fix this in your package.swift by changing dependancies to:

.package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.0.0")),
        .package(url: "https://github.com/IBM-Swift/Kitura-Credentials.git", .upToNextMinor(from: "2.0.0")),
        .package(url: "https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git", from: "2.0.0"),

We will also create and tag a pull request changing Kitura-CredentialsHTTP to use next major which will make your original package.swift compile.

rchatham commented 6 years ago

Actually my Package.swift file looks like this.

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "Server",
    products: [
      .executable(
        name: "Server",
        targets:  [ "Server" ]
      ),
    ],
    dependencies: [
      .package(url: "https://github.com/IBM-Swift/Kitura.git", from: "2.1.0"),
      .package(url: "https://github.com/IBM-Swift/HeliumLogger.git", from: "1.7.1"),
      .package(url: "https://github.com/IBM-Swift/CloudEnvironment.git", from: "6.0.0"),
      .package(url: "https://github.com/RuntimeTools/SwiftMetrics.git", from: "2.2.1"),
      .package(url: "https://github.com/IBM-Swift/Health.git", .upToNextMinor(from: "0.0.0")),
      .package(url: "https://github.com/IBM-Swift/LoggerAPI.git", from: "1.0.0"),
      .package(url: "https://github.com/IBM-Swift/Kitura-CORS.git", .upToNextMinor(from: "2.1.0")),
      .package(url: "https://github.com/IBM-Swift/Swift-Kuery-ORM.git", .upToNextMinor(from: "0.0.1")),
      .package(url: "https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL.git", .upToNextMinor(from: "1.1.0")),
      .package(url: "https://github.com/IBM-Swift/Kitura-Credentials.git", from: "2.1.0"),
      .package(url: "https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git", from: "2.0.0"),
      .package(url: "https://github.com/rchatham/ShortCode.git", from: "0.0.5"),
    ],
    targets: [
      .target(
        name: "Server", 
        dependencies: [ .target(name: "Application"), "Kitura" , "HeliumLogger" ]
        ),
      .target(
        name: "Application", 
        dependencies: [ "Kitura" , "KituraCORS" , "CloudEnvironment" , "SwiftMetrics" , "Health" , "SwiftKueryORM" , "SwiftKueryPostgreSQL" ]
        ),
      .target(
        name: "Models", 
        dependencies: [ "Kitura" , "SwiftKueryORM" , "SwiftKueryPostgreSQL" , "ShortCode" ]
        ),
      .target(
        name: "Authentication", 
        dependencies: [ "Kitura" , "CredentialsHTTP" ,  "HeliumLogger" ]
        ),

      .testTarget(
        name: "ApplicationTests" , 
        dependencies: [ .target(name: "Application"), "Kitura" , "HeliumLogger" ]
        ),
      .testTarget(
        name: "ModelsTests" , 
        dependencies: [ .target(name: "Models"), "Kitura" , "HeliumLogger" ]
        ),
      .testTarget(
        name: "AuthenticationTests" , 
        dependencies: [.target(name: "Authentication"), "Kitura" , "HeliumLogger" ]
        ),
    ]
)
Andrew-Lees11 commented 6 years ago

@rchatham We have just tagged a patch which should prevent the conflict so if you could try generating your project and see if it works now. You may need to do swift package update so it doesn't use cached dependencies.

rchatham commented 6 years ago

@Andrew-Lees11 I managed to get my dependencies to resolve but am now getting the following error, missing required modules: 'CCurl', 'CHTTPParser'. Any ideas?