Skip to content
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

Fix ifdef for android random api #3444

Merged
merged 2 commits into from
May 18, 2024

Conversation

bnason-nf
Copy link
Contributor

@bnason-nf bnason-nf commented May 16, 2024

This fixes an Android build failure because getrandom() is not declared. I was specifically using Android NDK 24, and getrandom() was not available in the NDK until version 28.

I am not an export on the Android platform, but based on the thread below it looks like the preferred preprocessor check for Android is __ANDROID__ instead of ANDROID:

https://groups.google.com/g/android-ndk/c/cf9_f1SLXls

However it looks like maybe there are cases where the one without underscores is necessary, so this change just checks for either one. This causes CONFIG_HAS_ARC4RANDOM_BUF to be set to 1 for either Android preprocessor define, and in turn to use arc4random_buf() instead of getrandom().

@bnason-nf
Copy link
Contributor Author

@wenyongh and @lum1n0us I'm tagging you on this because there was seeming a spurious check failure that I was able to get past with a second essentially no-op commit. Is that a known issue?

@wenyongh wenyongh merged commit 7744e84 into bytecodealliance:main May 18, 2024
377 checks passed
@bnason-nf bnason-nf deleted the fix-android-random-ifdef branch June 3, 2024 22:45
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.

None yet

2 participants