Skip to content

Linux debug builds fail to build (pure bridging mode) #74701

Closed
@rjmansfield

Description

@rjmansfield

Description

Building the debug variant on Linux will result in failure. If you work around #74659, the next issue encountered is:

/home/ryan_mansfield/swift/swift/SwiftCompilerSources/Sources/Basic/Utils.swift:57:44: error: cannot find 'stderr' in scope
public var standardError = CFileStream(fp: stderr)
                                           ^~~~~~
/home/ryan_mansfield/swift/swift/SwiftCompilerSources/Sources/Basic/Utils.swift:62:55: error: cannot find type 'FILE' in scope
  public typealias FILEPointer = UnsafeMutablePointer<FILE>
                                                      ^~~~
/home/ryan_mansfield/swift/swift/SwiftCompilerSources/Sources/Basic/Utils.swift:69:5: error: cannot find 'fputs' in scope
    fputs(string, fp)
    ^~~~~
/home/ryan_mansfield/swift/swift/SwiftCompilerSources/Sources/Basic/Utils.swift:73:5: error: cannot find 'fflush' in scope
    fflush(fp)
    ^~~~~~

This is because in Debug mode, BRIDGING_MODE=PURE is enabled and then in PURE_BRIDGING_MODE is defined and as a result in include/swift/Basic/BasicBridging.h USED_IN_CPP_SOURCE is not defined, and stdio.h is not implicitly included.

It appears this worked up until 0c8c985 with removal of the import CxxStdlib
@eeckstein fyi

Reproduction

On linux build without args (default to debug)

utils/build-script

Expected behavior

Successful build

Environment

Ubuntu 22.04

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    LinuxPlatform: LinuxbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.build errorErrors when building the toolchain, not regular Swift codecompilerThe Swift compiler itselfcontributor experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions