Skip to content

"working directory" not completely respected when using "-explicit-swift-module-map-file" #67212

Open
@chiragramani

Description

@chiragramani

Description
In our setup, -explicit-swift-module-map-file has relative paths. When the execution directory is the same as the working directory, it works all fine. When the execution directory is different, then it errors out.

error: emit-module command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: failed to open explicit Swift module: outputs/StressTest1.swiftmodule
.../swift_repro/foo.swift:5:8: error: no such module 'StressTest1'
import StressTest1

Though we can have absolute paths in "-explicit-swift-module-map-file" which would fix the above error, but we would like to have relative paths given remote caching and reproducibility aspects involved.

Steps to reproduce

  1. Download swift_repro.zip.
  2. ./root.sh - note - the first part of the script will be successful (execution directory the same as working directory)
  3. The second part will fail.
  4. Now - execute ./make_paths_absolute.sh - this makes the path in the "-explicit-swift-module-map-file" absolute.
  5. Now, execute ./root.sh again and this builds fine now.

Expected behavior

  1. working directory should be honoured(if present) when resolving paths mentioned in the -explicit-swift-module-map-file.

Environment

  • Swift compiler version info - swift-driver version: 1.75.2 Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
  • Xcode version info - Xcode 14.3.1, Build version 14E300b
  • Deployment target: iOS 15

Note: my understanding of the expected behavior might be wrong or there might be something else going on, so please feel free to correct me or share other ways to go about it, whatever you think is ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions