I've compiled Swift for armv7 and have had success building the CxxStdlib module for versions since 5.10 up to 6.1.2. However, when I switch to a nightly 6.2 or development snapshot, I get this error when trying to compile a Swift package with Cxx interop enabled:
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Glibc.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface:92:44: error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
90 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt, _ ptr: Swift.UnsafeMutableRawPointer) -> Swift.CInt
91 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt) -> Swift.CInt
92 | public typealias sighandler_t = SwiftGlibc.__sighandler_t
| `- error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
93 | #if compiler(>=5.3) && $NonescapableTypes
94 | public var SIG_DFL: Glibc.sighandler_t? {
/src/sysroot-debian-bookworm/usr/include/signal.h:72:16: note: type alias declared here
70 |
71 | /* Type of a signal handler. */
72 | typedef void (*__sighandler_t) (int);
| `- note: type alias declared here
73 |
74 | /* The X/Open definition of `signal' specifies the SVID semantic. Use
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Glibc.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface:1:1: error: failed to build module 'Glibc' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
1 | // swift-interface-format-version: 1.0
| `- error: failed to build module 'Glibc' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
2 | // swift-compiler-version: Swift version 6.2-dev effective-5.10 (LLVM 367909f98241076, Swift 1aab25d9909cc47)
3 | // swift-module-flags: -target armv7-unknown-linux-gnueabihf -disable-objc-interop -autolink-force-load -enable-library-evolution -module-link-name swiftGlibc -static -swift-version 5 -O -library-level api -enforce-exclusivity=unchecked -disable-objc-interop -target-min-inlining-version min -enable-experimental-feature NoncopyableGenerics2 -enable-experimental-feature SuppressedAssociatedTypes -enable-experimental-feature SE427NoInferenceOnExtension -enable-experimental-feature NonescapableTypes -enable-experimental-feature LifetimeDependence -enable-experimental-feature InoutLifetimeDependence -enable-experimental-feature LifetimeDependenceMutableAccessors -enable-upcoming-feature MemberImportVisibility -module-name Glibc
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Glibc.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface:92:44: error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
90 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt, _ ptr: Swift.UnsafeMutableRawPointer) -> Swift.CInt
91 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt) -> Swift.CInt
92 | public typealias sighandler_t = SwiftGlibc.__sighandler_t
| `- error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
93 | #if compiler(>=5.3) && $NonescapableTypes
94 | public var SIG_DFL: Glibc.sighandler_t? {
/src/sysroot-debian-bookworm/usr/include/signal.h: 0:
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Glibc.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface:92:44: error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
90 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt, _ ptr: Swift.UnsafeMutableRawPointer) -> Swift.CInt
91 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt) -> Swift.CInt
92 | public typealias sighandler_t = SwiftGlibc.__sighandler_t
| `- error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
93 | #if compiler(>=5.3) && $NonescapableTypes
94 | public var SIG_DFL: Glibc.sighandler_t? {
/src/sysroot-debian-bookworm/usr/include/signal.h:72:16: note: type alias declared here
70 |
71 | /* Type of a signal handler. */
72 | typedef void (*__sighandler_t) (int);
| `- note: type alias declared here
73 |
74 | /* The X/Open definition of `signal' specifies the SVID semantic. Use
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Synchronization.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface: 0:
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Glibc.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface:92:44: error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
90 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt, _ ptr: Swift.UnsafeMutableRawPointer) -> Swift.CInt
91 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt) -> Swift.CInt
92 | public typealias sighandler_t = SwiftGlibc.__sighandler_t
| `- error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
93 | #if compiler(>=5.3) && $NonescapableTypes
94 | public var SIG_DFL: Glibc.sighandler_t? {
/src/sysroot-debian-bookworm/usr/include/signal.h: 0:
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Glibc.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface:92:44: error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
90 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt, _ ptr: Swift.UnsafeMutableRawPointer) -> Swift.CInt
91 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt) -> Swift.CInt
92 | public typealias sighandler_t = SwiftGlibc.__sighandler_t
| `- error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
93 | #if compiler(>=5.3) && $NonescapableTypes
94 | public var SIG_DFL: Glibc.sighandler_t? {
/src/sysroot-debian-bookworm/usr/include/signal.h: 0:
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Synchronization.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface: 0:
/src/sysroot-debian-bookworm/usr/lib/swift/linux/Glibc.swiftmodule/armv7-unknown-linux-gnueabihf.private.swiftinterface:92:44: error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
90 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt, _ ptr: Swift.UnsafeMutableRawPointer) -> Swift.CInt
91 | public func ioctl(_ fd: Swift.CInt, _ request: Swift.UInt) -> Swift.CInt
92 | public typealias sighandler_t = SwiftGlibc.__sighandler_t
| `- error: cannot use type alias '__sighandler_t' here; C++ types from imported module 'SwiftGlibc' do not support library evolution
93 | #if compiler(>=5.3) && $NonescapableTypes
94 | public var SIG_DFL: Glibc.sighandler_t? {
/src/sysroot-debian-bookworm/usr/include/signal.h: 0:
Any ideas where these error would come from? Is this an indication of maybe the CxxStdlib module not compiling correctly?
I’m not so sure it’s the same issue. I’m compiling with swift build and on Linux to boot. I found that just doing import Foundation and cross compiling with a 6.2 Swift SDK causes the issue above. I’ve created a bug on swift-package-manager: