-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Nim fails to compile on MacOSX 10.10 because of sys/random.h header included in std/sysrand #17370
Comments
Rust implementation does it that way - it checks if https://github.com/rust-lang/rust/blob/master/library/std/src/sys/unix/rand.rs#L130 |
hope this issue is fixed |
It should be fixed, feel free to reopen if not. |
macOS 10.12 was born at June 13, 2016, and the end of support date is October 2019. This version introduces more useful features. For example, `getentropy`, `clock_gettime` which is benefit. However we don't have a reliable way to use different system apis for different system versions. More terribly, it makes it hard to register these apis in the VM because it causes building latest Nim to fail. see #17370 So maybe we should increase the support version requirement for MacOS
I just ran into this issue trying to install 1.6.0 on macOS 10.10.5. Yes, it's an old computer, but one I'd like to still use. If 10.10 should still be supported, I can look into submitting a patch. |
Got this bug report from my friend
Current Output
Expected Output
Successful compilation
Additional information
CPython seems to have hit the same problem before - https://bugs.python.org/issue29057.
If you check https://opensource.apple.com/source/xnu/xnu-4903.270.47/bsd/sys/random.h.auto.html you'll see that sys/random.h is available from macOS 10.12 and up.
One way to fix this would be to use the same iOS impl. for macOS (secRandomCopyBytes is available in macOS 10.10+).
Another way is to check if we have macOS 10.12 and up (via https://opensource.apple.com/source/xnu/xnu-4903.270.47/EXTERNAL_HEADERS/Availability.h.auto.html) and use generic urandom on older macOS versions.
As a temporary workaround it's possible to replace line 240 in
lib/sytd/sysrand.nim
withelif false
and on line 61batchImplOs = false
, then the compilation succeeds (because then the generic urandom impl. is used).Git hash - 7937aba
The text was updated successfully, but these errors were encountered: