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

Doesn't compile on Apple Silicon #20

Open
smessmer opened this issue Apr 27, 2022 · 2 comments
Open

Doesn't compile on Apple Silicon #20

smessmer opened this issue Apr 27, 2022 · 2 comments

Comments

@smessmer
Copy link

Trying to compile this crate on Apple M1 Silicon errors with

error[E0425]: cannot find function `__cpuid` in module `arch`
   --> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rdrand-0.8.2/src/lib.rs:163:33
    |
163 |     let cpuid0 = unsafe { arch::__cpuid(0) };
    |                                 ^^^^^^^ not found in `arch`

error[E0412]: cannot find type `CpuidResult` in module `arch`
   --> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rdrand-0.8.2/src/lib.rs:171:30
    |
171 | fn amd_family(cpuid1: &arch::CpuidResult) -> u32 {
    |                              ^^^^^^^^^^^ not found in `arch`

error[E0412]: cannot find type `CpuidResult` in module `arch`
   --> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rdrand-0.8.2/src/lib.rs:176:30
    |
176 | fn has_rdrand(cpuid1: &arch::CpuidResult) -> bool {
    |                              ^^^^^^^^^^^ not found in `arch`

error[E0425]: cannot find function `__cpuid` in module `arch`
   --> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/rdrand-0.8.2/src/lib.rs:184:20
    |
184 |     unsafe { arch::__cpuid(7).ebx & FLAG == FLAG }
    |                    ^^^^^^^ not found in `arch`
@smessmer
Copy link
Author

Oh thinking a bit further about it, is do those chips even have a rdrand instruction?

@nagisa
Copy link
Owner

nagisa commented Jan 18, 2023

Apple Silicon does not support the instruction, but it would still be nice to compile to a crate that does not have any functionality and just returns errors at runtime, just like they return errors when the instruction is not supported on x86_64, so that this kind of conditionality wasn’t necessary in the users’ code.

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