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

Symbol not found: _$s6SQLite10ConnectionC8LocationO8inMemoryyA2EmFWC #1231

Open
DNSTDevelopment opened this issue Dec 21, 2023 · 0 comments
Open

Comments

@DNSTDevelopment
Copy link

Build Information

  • Include the SQLite.swift version, commit or branch experiencing the issue.
    • SQLite.swift 0.13.3/0.14.0
  • Mention Xcode and OS X versions affected.
    • XCode15
  • How do do you integrate SQLite.swift in your project?
    • Swift Package manager

Problem

In my project, there're 2 framework in which SQLite is used.
And in my app, I need to import this oss as dynamic lirabray because it is used in more than one frmaework.
When I use cocoapods to do it, everything works fine.
But I was aksed to use SPM(Swift Package Manager) to import.
As I know, SPM can only import static library unless you edit the Package.swift. So I edit the Package.swift and add type:.dynamicin the product. After I do that and run the app again, I got runtime crush listed below:

Error

dyld[697]: Symbol not found: _$s6SQLite10ConnectionC8LocationO8inMemoryyA2EmFWC
  Referenced from: <4B8F1B6D-C959-38BE-84E4-B93DF2BF0DDC> /private/var/containers/Bundle/Application/81E9CF1A-9A0E-4FCC-8FD2-3E05F17F62AE/MPTDKSampleApp.app/Frameworks/DeviceAgentLogs.framework/DeviceAgentLogs
  Expected in:     <6439E3B1-5F0E-3B00-8846-DB8CD30EAE8F> /private/var/containers/Bundle/Application/81E9CF1A-9A0E-4FCC-8FD2-3E05F17F62AE/MPTDKSampleApp.app/Frameworks/SQLite.framework/SQLite

I have checked MPTDKSampleApp.app/Frameworks/SQLite.framework/SQLite and it is actually existed. I also have tried a lot of ways but cannot find the solution.

I also edited other third-party-library's Package.swift like ZipArchive and RxSwift and both of them works fine. No build error, no runtime crush.

Can anyone help me with this porblem?

Here is the Package.swift I edited:

Package.swift

// swift-tools-version:5.1

import PackageDescription

let buildTests = false

extension Product {
  static func allTests() -> [Product] {
    if buildTests {
      return [.executable(name: "AllTestz", targets: ["AllTestz"])]
    } else {
      return []
    }
  }
}

extension Target {
  static func rxCocoa() -> [Target] {
    #if os(Linux)
      return [.target(name: "RxCocoa", dependencies: ["RxSwift", "RxRelay"])]
    #else
      return [.target(name: "RxCocoa", dependencies: ["RxSwift", "RxRelay", "RxCocoaRuntime"])]
    #endif
  }

  static func rxCocoaRuntime() -> [Target] {
    #if os(Linux)
      return []
    #else
      return [.target(name: "RxCocoaRuntime", dependencies: ["RxSwift"])]
    #endif
  }

  static func allTests() -> [Target] {
    if buildTests {
      return [.target(name: "AllTestz", dependencies: ["RxSwift", "RxCocoa", "RxBlocking", "RxTest"])]
    } else {
      return []
    }
  }
}

let package = Package(
  name: "RxSwift",
  platforms: [.iOS(.v9), .macOS(.v10_10), .watchOS(.v3), .tvOS(.v9)],
  products: ([
    [
      .library(name: "RxSwift", type: .dynamic, targets: ["RxSwift"]),
      .library(name: "RxCocoa", targets: ["RxCocoa"]),
      .library(name: "RxRelay", targets: ["RxRelay"]),
      .library(name: "RxBlocking", targets: ["RxBlocking"]),
      .library(name: "RxTest", targets: ["RxTest"]),
      .library(name: "RxCocoa-Dynamic", type: .dynamic, targets: ["RxCocoa"]),
      .library(name: "RxRelay-Dynamic", type: .dynamic, targets: ["RxRelay"]),
      .library(name: "RxBlocking-Dynamic", type: .dynamic, targets: ["RxBlocking"]),
      .library(name: "RxTest-Dynamic", type: .dynamic, targets: ["RxTest"]),
    ],
    Product.allTests()
  ] as [[Product]]).flatMap { $0 },
  targets: ([
    [
      .target(name: "RxSwift", dependencies: []),
    ], 
    Target.rxCocoa(),
    Target.rxCocoaRuntime(),
    [
      .target(name: "RxRelay", dependencies: ["RxSwift"]),
      .target(name: "RxBlocking", dependencies: ["RxSwift"]),
      .target(name: "RxTest", dependencies: ["RxSwift"]),
    ],
    Target.allTests()
  ] as [[Target]]).flatMap { $0 },
  swiftLanguageVersions: [.v5]
)
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

1 participant