Skip to content

FoundationEssentials: make build on Android #705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

compnerd
Copy link
Member

This adjusts the API usage to account for differences on Android. The biggest source of difference is the nullability, particularly in the fts APIs. Unfortunately, MMAP_FAILED is not imported by the clang importer due to the casting involved so we manually inline the constant at the single site.

@compnerd compnerd requested review from parkera and jmschonfeld June 26, 2024 23:03
@compnerd
Copy link
Member Author

@swift-ci please test

@parkera
Copy link
Contributor

parkera commented Jun 27, 2024

Looks like it introduces some issues for Linux?

/build/swift-foundation/Sources/FoundationEssentials/FileManager/FileOperations+Enumeration.swift:308:51: error: value of optional type 'UnsafeMutablePointer<CChar>?' (aka 'Optional<UnsafeMutablePointer<Int8>>') must be unwrapped to a value of type 'UnsafeMutablePointer<CChar>' (aka 'UnsafeMutablePointer<Int8>')

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@parkera yeah, I didn't have a Linux machine handy - turns out that the nullability differences are in the FTS parameter not the structure! Trying to clean up the behavioural differences :(

@compnerd
Copy link
Member Author

@swift-ci please test

1 similar comment
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@parkera @jmschonfeld - okay, I expect this to pass the CI now, but this will not build for Android. I've dug through the issue and it appears to be a bug in Bionic. The declaration that they have in the Bionic header is misattributed with incorrect nullability. I am going to see if I can adjust this via APINotes, failing that, we might have to do some shims for fts_open.

This adjusts the API usage to account for differences on Android. The
biggest source of difference is the nullability, particularly in the
`fts` APIs. Unfortunately, `MMAP_FAILED` is not imported by the clang
importer due to the casting involved so we manually inline the constant
at the single site.
@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2024

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented Jul 1, 2024

@parkera @jmschonfeld - can we get this merged? The remaining failure requires an updated toolchain to build (I just merged the necessary changes into the compiler).

@jmschonfeld jmschonfeld merged commit 88d6a8d into swiftlang:main Jul 1, 2024
2 checks passed
@compnerd compnerd deleted the android branch July 1, 2024 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants