swiftlang / swift-syntax

A set of Swift libraries for parsing, inspecting, generating, and transforming Swift source code.
Apache License 2.0
3.24k stars 413 forks source link

Swft build fails with 'error: could not build Objective-C module 'SwiftSyntax'' #2649

Closed drekka closed 6 months ago

drekka commented 6 months ago

Description

I'm building a SPM project that uses SwiftSyntax similar to Apple's swift-format project. In my package file I've included SwiftSyntax's main branch and the project builds in Xcode without issue.

But when I attempt to build it on the command line using swift build I get a series of errors like this one:

error: emit-module command failed with exit code 1 (use -v to see invocation)
/Users/derekclarkson/projects/SwiftTypesetter/.build/arm64-apple-macosx/debug/SwiftSyntax.build/module.modulemap:2:12: error: header '/Users/derekclarkson/projects/SwiftTypesetter/.build/arm64-apple-macosx/debug/SwiftSyntax.build/SwiftSyntax-Swift.h' not found
    header "/Users/derekclarkson/projects/SwiftTypesetter/.build/arm64-apple-macosx/debug/SwiftSyntax.build/SwiftSyntax-Swift.h"
           ^

I know SwiftSyntax can be used in an SPM project and built using swift build because it works in Apple's swift-format project, but I don't know why it's not working for me or what I've missed.

Any clues?

Steps to Reproduce

No response

ahoppen commented 6 months ago

Synced to Apple’s issue tracker as rdar://127811495

drekka commented 6 months ago

Opps I had a fault in my package I hadn't spotted. So closing.