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

The official compiler snapshots dump a bunch of *.emit-module.d files in the package directory #1214

Closed
finagolfin opened this issue Apr 25, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@finagolfin
Copy link
Contributor

Describe the bug
I've been seeing a bunch of emit-module.d files in my Swift package directories with the latest 5.7 and trunk snapshot builds. The first Apr. 12 5.7 snapshot doesn't have this problem, so building with swift build -v then comparing to the Apr. 18 snapshot shows that both run this identical command to emit a module:

/home/butta/swift-nio/swift-5.7-DEVELOPMENT-SNAPSHOT-2022-04-18-a-ubuntu20.04/usr/bin/swiftc -module-name _NIODataStructures -incremental -emit-dependencies -emit-module -emit-module-path /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug/_NIODataStructures.swiftmodule -output-file-map /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug/_NIODataStructures.build/output-file-map.json -parse-as-library -c /home/butta/swift-nio/Sources/_NIODataStructures/Heap.swift /home/butta/swift-nio/Sources/_NIODataStructures/PriorityQueue.swift -I /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug -target x86_64-unknown-linux-gnu -swift-version 5 -enable-batch-mode -index-store-path /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug/index/store -Onone -enable-testing -g -j1 -DSWIFT_PACKAGE -DDEBUG -module-cache-path /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -parseable-output -parse-as-library -v

but when translated to the swift-frontend only the later snapshot adds an unprefixed -emit-dependencies-path:

Swift version 5.7-dev (LLVM 8bbf73b53c59eeb, Swift a159921d1bf3336)Target: x86_64-unknown-linux-gnu/home/butta/swift-nio/swift-5.7-DEVELOPMENT-SNAPSHOT-2022-04-18-a-ubuntu20.04/usr/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /home/butta/swift-nio/Sources/_NIODataStructures/Heap.swift /home/butta/swift-nio/Sources/_NIODataStructures/PriorityQueue.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug -enable-testing -g -module-cache-path /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /home/butta/swift-nio/swift-5.7-DEVELOPMENT-SNAPSHOT-2022-04-18-a-ubuntu20.04/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /home/butta/swift-nio/swift-5.7-DEVELOPMENT-SNAPSHOT-2022-04-18-a-ubuntu20.04/usr/lib/swift -enable-anonymous-context-mangled-names -module-name _NIODataStructures -emit-module-doc-path /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug/_NIODataStructures.swiftdoc -emit-module-source-info-path /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug/_NIODataStructures.swiftsourceinfo -emit-dependencies-path _NIODataStructures.emit-module.d -parse-as-library -o /home/butta/swift-nio/.build/x86_64-unknown-linux-gnu/debug/_NIODataStructures.swiftmodule

which causes all those files to be dumped in the top level of the package, rather than in .build/ where they belong. I can reproduce with the Apr. 20 trunk snapshot and later for Ubuntu too. Adding -Xswiftc -disallow-use-new-driver works around the problem.

To Reproduce

  1. Install a recent snapshot of the Swift toolchain.
  2. Run swift build on any Swift package.
  3. Check with ls *.emit-module.d.

Expected behavior
No build files dumped outside the .build directory.

Environment:

  • OS: Ubuntu 20.04 x86_64

Additional context
#1056 most likely caused this problem.

@finagolfin finagolfin added the bug Something isn't working label Apr 25, 2022
@karwa
Copy link

karwa commented Apr 29, 2022

I'm seeing this as well on macOS, using the snapshot via Xcode. Snapshot is from 21/04.

image

@finagolfin
Copy link
Contributor Author

These files are now placed in .build/ after @compnerd's fix in #1088, checked with the May. 4th trunk snapshot build.

@finagolfin
Copy link
Contributor Author

Just downloaded the May 10th snapshot of the 5.7 toolchain and it doesn't have the problem either, now that that fix was backported in #1094.

@hborla hborla transferred this issue from swiftlang/swift Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants