Can't Use Previews in Xcode in a Local Package if it requires SQLite.swift

Open
#1,156 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
sqlite, swift

Research direction

Start with the Package.swift dependency declaration and the ContentView.swift preview shown in the report. Reproduce the Xcode Preview build with the stated SQLite.swift, macOS, and Xcode versions, then compare the behavior with issue 1150; done means the local package preview builds without the missing SQLiteObjc module or related linker errors.

Written by the indexing model from the issue text.

Description

First of all: I don't believe this is an error in SQLite.swift package, but I'm hoping someone has solved this problem.

I'm getting

"missing required module 'SQLiteObjc'"

when I try to use previews. I don't run into this problem in the main module, but when the view is in a local package imported by my app.

I imagine that you (or Stephen) have run into this problem when using previews (I see he makes heavy use of them in his point free episodes), and trust that one of you knows how to make the compiler happy. I have posted this question on StackOverflow, but all I got is downvoted :(

Xcode Previews fail with: "missing required module 'SQLiteObjc'"

An issue was recently fixed for Carthage installs:

https://github.com/stephencelis/SQLite.swift/issues/1150

One suggestion I found was to try adding: ${SRCROOT}/SQLiteObjc to the Swift Compiler Search Paths but that didn't help.

my Package.swift contains:

  .package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.13.2"),

which resolves to 0.13.3

This problem occurs on an M1 MacBookPro running Monterey 12.5.1/Xcode 13.4.1 as well as Monterey 12.6 using (just released) Xcode 14. The app compiles without errors and runs fine. I just can't view previews.

When I compiled this morning, the missing SQLiteObjc message did not appear.
Again 🤷🏻

import SwiftUI
import TasksSQLite

struct ContentView: View {
    var body: some View {
        Text("Hello, world!")
            .padding()
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
Monterey 12.5.1

no such file or directory: '/Users/xxx/Library/Developer/Xcode/DerivedData/Tasklist-abrktmwcewhompgocivntszewxla/Build/Intermediates.noindex/Previews/Tasklist/Products/Debug-iphonesimulator/PackageFrameworks/TasksSQLite_584AE96A3AF58A43_PackageProduct.framework/TasksSQLite_584AE96A3AF58A43_PackageProduct'


LinkDylibError: Failed to build PrimaryPage.swift

Linking failed: no such file or directory: '/Users/xxx/Library/Developer/Xcode/DerivedData/Tasklist-abrktmwcewhompgocivntszewxla/Build/Intermediates.noindex/Previews/Tasklist/Products/Debug-iphonesimulator/PackageFrameworks/TasksSQLite_584AE96A3AF58A43_PackageProduct.framework/TasksSQLite_584AE96A3AF58A43_PackageProduct'

clang: error: no such file or directory: '/Users/xxx/Library/Developer/Xcode/DerivedData/Tasklist-abrktmwcewhompgocivntszewxla/Build/Intermediates.noindex/Previews/Tasklist/Products/Debug-iphonesimulator/PackageFrameworks/TasksSQLite_584AE96A3AF58A43_PackageProduct.framework/TasksSQLite_584AE96A3AF58A43_PackageProduct'

Edit:

I just cleaned the build folder again, and the error came back up:

<unknown>:0: error: missing required module 'SQLiteObjc'

missing required module 'SQLiteObjc'


SchemeBuildError: Failed to build the scheme "Tasklist"

missing required module 'SQLiteObjc'

Compile TasklistApp.swift (arm64):
:0: error: missing required module 'SQLiteObjc'

Emitting module for Tasklist:
:0: error: missing required module 'SQLiteObjc'

Compile ContentView.swift (arm64):
:0: error: missing required module 'SQLiteObjc'

Monterey 12.6

missing required module 'SQLiteObjc'


SchemeBuildError: Failed to build the scheme "Tasklist"

missing required module 'SQLiteObjc'

Emitting module for Tasklist:
:0: error: missing required module 'SQLiteObjc'

Compile ContentView.swift (arm64):
:0: error: missing required module 'SQLiteObjc'

Compile TasklistApp.swift (arm64):
:0: error: missing required module 'SQLiteObjc'

Copy Tasklist.abi.json (arm64):
error: /Users/xxx/Library/Developer/Xcode/DerivedData/Tasklist-abrktmwcewhompgocivntszewxla/Build/Intermediates.noindex/Previews/Tasklist/Intermediates.noindex/Tasklist.build/Debug-iphonesimulator/Tasklist.build/Objects-normal/arm64/Tasklist.abi.json: No such file or directory (in target 'Tasklist' from project 'Tasklist')

Copy Tasklist.swiftdoc (arm64):
error: /Users/xxx/Library/Developer/Xcode/DerivedData/Tasklist-abrktmwcewhompgocivntszewxla/Build/Intermediates.noindex/Previews/Tasklist/Intermediates.noindex/Tasklist.build/Debug-iphonesimulator/Tasklist.build/Objects-normal/arm64/Tasklist.swiftdoc: No such file or directory (in target 'Tasklist' from project 'Tasklist')

Copy Tasklist.swiftmodule (arm64):
error: /Users/xxx/Library/Developer/Xcode/DerivedData/Tasklist-abrktmwcewhompgocivntszewxla/Build/Intermediates.noindex/Previews/Tasklist/Intermediates.noindex/Tasklist.build/Debug-iphonesimulator/Tasklist.build/Objects-normal/arm64/Tasklist.swiftmodule: No such file or directory (in target 'Tasklist' from project 'Tasklist')

Copy Tasklist.swiftsourceinfo (arm64):
error: /Users/xxx/Library/Developer/Xcode/DerivedData/Tasklist-abrktmwcewhompgocivntszewxla/Build/Intermediates.noindex/Previews/Tasklist/Intermediates.noindex/Tasklist.build/Debug-iphonesimulator/Tasklist.build/Objects-normal/arm64/Tasklist.swiftsourceinfo: No such file or directory (in target 'Tasklist' from project 'Tasklist')

Once Again: I don't believe this is an error in SQLite.swift package, but I'm hoping someone has solved this problem.

Dominant language
Swift
Stars
10.2k
Forks
1.6k
Avg merge
6d 2h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stephencelis/SQLite.swift

All issues in stephencelis/SQLite.swift

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.