Skip to content

Failing to build for Android in SPI #1135

Open
@grynspan

Description

@grynspan

Looks like Swift Testing is failing to build for Android on Swift Package Index's site: https://swiftpackageindex.com/builds/875FEA40-0F76-47AF-A7E3-54A39616BA9C

/host/spi-builder-workspace/Sources/Testing/SourceAttribution/Backtrace.swift:70:56: error: cannot convert value of type 'UnsafeMutablePointer<UnsafeMutableRawPointer>' to expected argument type 'UnsafeMutablePointer<UnsafeMutableRawPointer?>'
 68 | #elseif os(Android)
 69 |       initializedCount = addresses.withMemoryRebound(to: UnsafeMutableRawPointer.self) { addresses in
 70 |         .init(clamping: backtrace(addresses.baseAddress!, .init(clamping: addresses.count)))
    |                                                        |- error: cannot convert value of type 'UnsafeMutablePointer<UnsafeMutableRawPointer>' to expected argument type 'UnsafeMutablePointer<UnsafeMutableRawPointer?>'
    |                                                        `- note: arguments to generic parameter 'Pointee' ('UnsafeMutableRawPointer' and 'UnsafeMutableRawPointer?') are expected to be equal
 71 |       }
 72 | #elseif os(Linux) || os(FreeBSD)

We have special-casing to convert the pointers here to remove optionality because, at one point, the signature of backtrace() was annotated such that the pointers were non-optional. This has either changed or is inconsistent across different Android versions.

Metadata

Metadata

Labels

android🤖 Android supportbug🪲 Something isn't workingissue-handlingRelated to Issue handling within the testing library

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions