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

XCode 12 Build broken due to static package dependency #1530

Open
hakkurishian opened this issue Oct 12, 2020 · 10 comments
Open

XCode 12 Build broken due to static package dependency #1530

hakkurishian opened this issue Oct 12, 2020 · 10 comments

Comments

@hakkurishian
Copy link

Context and Description

A simple Kitura App ( kitura init) does not build on XCode 12 due to static library linking issue.

Environment Details

XCode 12.0
OSX 10.15.7
Swift 5.1

Steps to Reproduce

  1. create Kitura app with kitura init
  2. Build

Expected vs. Actual Behaviour

  • Expected: App Builds and runs
  • Actual: Build Error Swift package target 'agentcore' is linked as a static library by 'ApplicationTests' and 'agentcore'. This will result in duplication of library code.
@mbarnach
Copy link
Member

Have you tried with a simple Package.swift including Kitura? We are in the middle of the community migration and the CLI will deserve some attention.

@hakkurishian
Copy link
Author

hakkurishian commented Oct 14, 2020

@mbarnach thanks for the response. Is there currently and Docs/Getting Started/Migration Guide on how a previously working IBM Kitura app? Which dependencies are still supported, which have to be replaced? A simple Kitura-only dependent Package.swift is building, but leaves one clueless on how to use, since kitura.io and the getting started guide are down.

@futurejones
Copy link

@hakkurishian you can find all the info on the new website Kitura.dev
@mbarnach I have just submitted PR #1532 to fix all the broken links and refs.

@mbarnach
Copy link
Member

@hakkurishian Github is normally doing the migration, meaning if you have a package with github.com/IBM-Swift it will be resolved into github.com/Kitura. If you want to specifically use the community version, use a patch version of 200. So far not all repositories have that tag, so check first. But, everything should still be working with your existing package.
To troubleshoot your issue, I think you need to add your dependencies and see which one is failing (on a new project). Not super nice, but probably needed...

@futurejones Thanks for the PR, we will review it ASAP.

@dannys42
Copy link
Contributor

@hakkurishian Right now the focus is on making sure everything that was working from the IBM-Swift is now working on the Kitura org. I think all the package dependencies should be migrated, but not the examples/tutorials yet. So please let us know if you hit any dependencies that you need that are either not working or still on the IBM-Swift org.

@hakkurishian
Copy link
Author

@mbarnach thank you for the advice. I updated my package to the Kitura versions of the packages resulting in this Package.swift:

// swift-tools-version:5.0
import PackageDescription

let package = Package(
    name: "middleware",
    dependencies: [
      .package(url: "https://github.com/Kitura/Kitura.git", .upToNextMinor(from: "2.9.200")),
        .package(url: "https://github.com/Kitura/Kitura-net.git", .upToNextMinor(from: "2.4.200")),
        .package(url: "https://github.com/Kitura/BlueCryptor.git", .upToNextMinor(from: "1.0.200")),
      .package(url: "https://github.com/Kitura/HeliumLogger.git", from: "1.9.200"),
      .package(url: "https://github.com/Kitura/CloudEnvironment.git", from: "9.1.200"),
      .package(url: "https://github.com/RuntimeTools/SwiftMetrics.git", from: "2.0.0"),
      .package(url: "https://github.com/Kitura/Health.git", from: "1.0.200"),
      .package(url: "https://github.com/Kitura/Kitura-CredentialsJWT.git", from: "1.0.1")
    ],
    targets: [
      .target(name: "middleware", dependencies: [ .target(name: "Application") ]),
      .target(name: "Application", dependencies: [ "Kitura", "HeliumLogger", "CloudEnvironment","SwiftMetrics", "Health","CredentialsJWT"]),
      .testTarget(name: "ApplicationTests" , dependencies: [.target(name: "Application"), "Kitura", "HeliumLogger" ])
    ]
)

The resulting errors are:

image

@dannys42
Copy link
Contributor

@hakkurishian I just updated Kitura-CredentialsJWT. Can you update that version to 1.0.200 and try again?

We still need to migrate SwiftMetrics, but there's some delay there because it's owned by a different group. If that project is the source of additional conflicts for you, I can make a temporary fork to try to address those issues.

@mbarnach
Copy link
Member

@hakkurishian @dannys42 For SwiftMetrics, I have a temporary fork, that I'm using due to NIO update: https://github.com/mbarnach/SwiftMetrics/tree/NIO-update. I've pushed the PR, but no response yet. Hopefully the Kitura org could adopt that framework too...

@hakkurishian
Copy link
Author

@mbarnach thanks a lot, I have tried to reference all of the later versions resulting in this Package.swift:

// swift-tools-version:5.0
import PackageDescription

let package = Package(
    name: "middleware",
    dependencies: [
      .package(url: "https://github.com/Kitura/Kitura.git", .upToNextMinor(from: "2.9.200")),
        .package(url: "https://github.com/Kitura/Kitura-net.git", .upToNextMinor(from: "2.4.200")),
        .package(url: "https://github.com/Kitura/BlueCryptor.git", .upToNextMinor(from: "1.0.200")),
      .package(url: "https://github.com/Kitura/HeliumLogger.git", from: "1.9.200"),
      .package(url: "https://github.com/Kitura/CloudEnvironment.git", from: "9.1.200"),
        .package(url: "https://github.com/mbarnach/SwiftMetrics",.revision("a30520ee4953865df9b7b8c1745315b9f5d54898")),
      .package(url: "https://github.com/Kitura/Health.git", from: "1.0.200"),
      .package(url: "https://github.com/Kitura/Kitura-CredentialsJWT.git", from: "1.0.200")
    ],
    targets: [
      .target(name: "middleware", dependencies: [ .target(name: "Application") ]),
      .target(name: "Application", dependencies: [ "Kitura", "HeliumLogger", "CloudEnvironment","SwiftMetrics", "Health","CredentialsJWT"]),
      .testTarget(name: "ApplicationTests" , dependencies: [.target(name: "Application"), "Kitura", "HeliumLogger" ])
    ]
)

Unfortunately the errors about the static libraries remain

@mbarnach
Copy link
Member

@hakkurishian I had no issues compiling your package. I've you tried the command line (swift build where the Package.swift is?). Remove the Package.resolved first. There is also an option in Xcode to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants