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

error: inline assembly requires more registers than available #1243

Open
pgrinaway opened this issue Apr 30, 2024 · 2 comments
Open

error: inline assembly requires more registers than available #1243

pgrinaway opened this issue Apr 30, 2024 · 2 comments

Comments

@pgrinaway
Copy link

Hi all,

Thanks for the great project. I'm trying to compile it on a 2018 Macbook Pro, and I keep getting the following error:

error: inline assembly requires more registers than available

error: could not compile `halo2curves` (lib) due to 1 previous error

even when I try cargo build --release --features portable. Interestingly, debug mode does not cause this problem and everything succeeds. Is there something else I should do to prevent emission of unsupported assembly?

At the same time, trying to compile on a linux box, compilation succeeds, but the lurk repl immediately fails with an illegal instruction. I suspect I am failing to disable some kind of unsupported optimization, but does anyone have any pointers? In this second case, even debug mode results in the illegal instruction. Any thoughts?

@huitseeker
Copy link
Contributor

even when I try cargo build --release --features portable. Interestingly, debug mode does not cause this problem and everything succeeds. Is there something else I should do to prevent emission of unsupported assembly?

This is about halo2curves' assembly generation: https://github.com/privacy-scaling-explorations/halo2curves/blob/main/Cargo.toml#L49

This is only activated if one imports arecibo with the non-default asm feature:
https://github.com/lurk-lab/arecibo/blob/5268c2084821955c5953c29c7e179b2052523b5d/Cargo.toml#L116

Which happens here in your case because your 2018 Mac is on x86_64:
https://github.com/lurk-lab/lurk-rs/blob/8802da5c85d26129167c3ba7ef4e7ed22f56707a/Cargo.toml#L72-L73

So I guess this is about modifying the flag
[target.'cfg(target_arch = "x86_64")'.dependencies]
into
[target.'cfg(and(target_arch = "x86_64", not(target_os = "macos")))'.dependencies]

Can you try that and tell me if it works for you?

@pgrinaway
Copy link
Author

Hi, thanks for the fix. I changed the line you mentioned to these two:

[target.'cfg(all(target_arch = "x86_64", not(target_os = "macos")))'.dependencies]
nova = { workspace = true, features = ["asm"] }
[target."cfg(all(target_arch = \"x86_64\", target_os = \"macos\"))".dependencies]
nova = { workspace = true }

And the build works. I think the syntax uses all rather than and and I needed to add another target for x86 + macos.

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