Skip to content

Cxx interop problem #3093

Open
Open
@postmechanical

Description

@postmechanical

Expected behavior

Using swift-nio package in a project with Cxx interop enabled builds, runs, and is debuggable.

Actual behavior

Using swift-nio package in a project with Cxx interop enabled builds and runs but renders debugger unusable with following error:

(lldb) po someVar
error: /Users/some.user/Library/Developer/Xcode/DerivedData/SomeProject-ejsisrcmvvxjfmgjdseiwglvudot/SourcePackages/checkouts/swift-nio/Sources/CNIOLLHTTP/include/c_nio_llhttp.h:3:1: import of C++ module 'std_stdint_h' appears within extern "C" language linkage specification
#include <stdint.h>
^

Locally modifying c_nio_llhttp.h as follows builds, runs, and is debuggable:

13a14
> 
15c16,18
< extern "C" {
---
> #include <cstdint>
> #else
> #include <stdint.h>
18c21,23
< #include <stdint.h>
---
> #ifdef __cplusplus
> extern "C" {
> #endif

Steps to reproduce

I have attempted a standalone repro without success so far. The project in which I've enabled Cxx interop is a sizeable legacy project that is a mix of UIKit and SwiftUI.

At the project level I have added -cxx-interoperability-mode=default -Xcc -std=c++17 to the OTHER_SWIFT_FLAGS build setting. I have one local package that depends on grpc-swift which transitively depends on swift-nio and this local package does not enable Cxx interop. I have another local package that depends on a remote package that requires Cxx interop and is using swiftSettings: [.interoperabilityMode(.Cxx)] on the target definition and cxxLanguageStandard: .cxx17 on the package definition.

If possible, minimal yet complete reproducer code (or URL to code)

No minimal standalone repro yet.

SwiftNIO version/commit hash

2.78.0

System & version information

Please provide at the very least your operating system and Swift version
information.

macOS: 14.7.1
Swift: 5.9
Xcode: 16.2 (16C5032a)

Ideally, run

scripts/nio-diagnose -o nio-diagnose.md PID_OF_YOUR_NIO_PROGRAM

and attach (or paste) the resulting file nio-diagnose.md into this bug report
or send it to the SwiftNIO maintainers privately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions