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

iOS Build Error 'sys/random.h' file not found #92

Closed
Nailik opened this issue Oct 20, 2022 · 3 comments
Closed

iOS Build Error 'sys/random.h' file not found #92

Nailik opened this issue Oct 20, 2022 · 3 comments

Comments

@Nailik
Copy link

Nailik commented Oct 20, 2022

When building on Mac OS for an iOS device there is an error in sqlite3.c (amalgamation file).

sqlite3.c fatal error: 'sys/random.h' file not found
#include <sys/random.h>

After removing the line, it builds and works.

@utelle
Copy link
Owner

utelle commented Oct 20, 2022

The inclusion of the header file is guarded by the following preprocessor instruction:

#if defined(__APPLE__) && defined(__MAC_10_12)
#include <sys/random.h>
#endif

So, even though you are compiling for iOS both symbols seem to be defined, and the compiler therefore tries to include the header file sys/random.h.

You could try to modify the check as follows:

#if defined(__APPLE__) && defined(__MAC_10_12) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
#include <sys/random.h>
#endif

Most likely this will prevent the inclusion of the header file for the iOS build. Please let me know whether this works for you.

@Nailik
Copy link
Author

Nailik commented Oct 21, 2022

This fixed the issue!

utelle added a commit that referenced this issue Oct 21, 2022
Don't include `sys/random.h` if compiling for iOS
@utelle
Copy link
Owner

utelle commented Oct 21, 2022

Thanks for confirming. Commit a8c9e93 applies the fix.

@utelle utelle closed this as completed Oct 21, 2022
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

No branches or pull requests

2 participants