swift-server / swift-backtrace

💥 Backtraces for Swift on Linux and Windows
Apache License 2.0
296 stars 34 forks source link

No such module 'Backtrace' #55

Closed paradiseduo closed 2 years ago

paradiseduo commented 2 years ago
❯ ./build-macOS_x86.sh                                                                                                                                                                                                                                          took 3s at 17:18:57
Updating https://github.com/apple/swift-argument-parser
Fetching https://github.com/swift-server/swift-backtrace.git from cache
Updated https://github.com/apple/swift-argument-parser (1.78s)
Fetched https://github.com/swift-server/swift-backtrace.git (1.78s)
Computing version for https://github.com/swift-server/swift-backtrace.git
Computed https://github.com/swift-server/swift-backtrace.git at 1.3.1 (0.46s)
Computing version for https://github.com/apple/swift-argument-parser
Computed https://github.com/apple/swift-argument-parser at 1.0.3 (0.40s)
Computing version for https://github.com/swift-server/swift-backtrace.git
Computed https://github.com/swift-server/swift-backtrace.git at 1.3.1 (0.00s)
Computing version for https://github.com/apple/swift-argument-parser
Computed https://github.com/apple/swift-argument-parser at 1.0.3 (0.00s)
Creating working copy for https://github.com/swift-server/swift-backtrace.git
Working copy of https://github.com/swift-server/swift-backtrace.git resolved at 1.3.1
warning: dependency 'swift-backtrace' is not used by any target
/Users/admin/Desktop/Code/resymbol/.build/x86_64-apple-macosx/release/Backtrace.build/module.modulemap:2:12: error: header '/Users/admin/Desktop/Code/resymbol/.build/x86_64-apple-macosx/release/Backtrace.build/Backtrace-Swift.h' not found
    header "/Users/admin/Desktop/Code/resymbol/.build/x86_64-apple-macosx/release/Backtrace.build/Backtrace-Swift.h"
           ^
/Users/admin/Desktop/Code/resymbol/Sources/resymbol/main.swift:2:8: error: could not build Objective-C module 'Backtrace'
import Backtrace
tomerd commented 2 years ago

@paradiseduo can you post more details about the use case? maybe share the project or a small reproducer?

ktoso commented 2 years ago

Coming here unrelatedly, but might as well drop a hint.

Frequently when you hit this type of error /Users/admin/Desktop/Code/resymbol/.build/x86_64-apple-macosx/release/Backtrace.build/module.modulemap:2:12: error: header '/Users/admin/Desktop/Code/resymbol/.build/x86_64-apple-macosx/release/Backtrace.build/Backtrace-Swift.h' not found

it actually is a missing explicit dependency -- you need to add a dependency for the Backtrace target in your Package.swift before you depend on it in your app.

This is what https://github.com/apple/swift-package-manager/pull/3562/commits/a4114eb92d2d77fd85495ac5a0fb3617f0e5267e will be diagnosing better actually; but that didn't make it into 5.7 sadly