Skip to content

Swift sometimes puts .d, .o and .swiftdeps in the root directory of a SPM project #8646

Closed as duplicate of#7930
@Jomy10

Description

@Jomy10

Description

Sometimes, when building with Swift Package Manager, it will put .d, .o and .swiftdeps in the root directory of the Swift Package.

Reproduction

I have encountered this bug multiple times, but have not found a reliable way to fix it.

Files are added to the root directory:
Image

This comes to my attention because an error occures during build:

error: link command failed with exit code 1 (use -v to see invocation)
ld: file cannot be open()ed, errno=2 path=/Users/jonaseveraert/Documents/projects/Beaver/.build/arm64-apple-macosx/debug/Beaver.build/GlobalCache.swift.o in '/Users/jonaseveraert/Documents/projects/Beaver/.build/arm64-apple-macosx/debug/Beaver.build/GlobalCache.swift.o'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I started seeing this bug when I upgraded from Swift 5.7 to Swift 6

Expected behavior

These files should be put in the build directory.

Environment

swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions