Skip to content

Linux: C++ Interop doesn't work with explicit module builds #86328

@etcwilde

Description

@etcwilde

Description

Enabling C++ interop and explicit module builds causes the compiler to look in the wrong location for the C++ runtime modulemap on Linux resulting in the following error:
<unknown>:0: error: error opening input file '/include/c++/12/module.modulemap'.
On this system, the C++ headers are located at /usr/include/c++/12, but the modulemap file doesn't live there either. Without explicit module builds enabled, swiftc -cxx-interoperability-mode=default test.swift compiles fine.

Reproduction

// test.swift
import CxxStdlib
swiftc test.swift -explicit-module-build -cxx-interoperability-mode=default
  error: generate-pcm command failed with exit code 1 (use -v to see invocation)
  <unknown>:0: error: error opening input file '/include/c++/12/module.modulemap' (No such file or directory)

Expected behavior

It should compile

Environment

This is the nightly debian-12 image: swiftlang/swift:nightly-debian12

Swift version 6.3-dev (LLVM de874f037eb84a3, Swift 895c96380559e47)
Target: aarch64-unknown-linux-gnu
Build config: +assertions

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++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