Bug: Linking multiple dynamic libraries that depend on the same target fails with ld failing due to missing files

It seems it is common for any setup where two libraries from a package are imported, where one is dynamic and another one is not and there is interdependency between them. Here is an example from Apollo with exactly the same error.

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

let package = Package(
  name: "Apollo",
  platforms: [
   //...
  ],
  products: [
    .library(
      name: "Apollo-Dynamic",
      type: .dynamic,
      targets: ["Apollo"]),
   //...
    .library(
      name: "ApolloSQLite",
      targets: ["ApolloSQLite"]),
   //...
  ],
  dependencies: [
   //...
  ],
  targets: [
    .target(
      name: "Apollo",
      dependencies: [
   //...
      ],
    .target(
      name: "ApolloSQLite",
      dependencies: [
        "Apollo",
       //...
      ],
    ),
  ]
)

Importing into both Apollo-Dynamic and ApolloSQLite will end up in similar ld issue as above. :frowning: