iden3 / circom

zkSnark circuit compiler
GNU General Public License v3.0
1.28k stars 244 forks source link

Illegal hardware instruction on Mac OS if using C++ witness calculator #31

Closed alxkzmn closed 2 years ago

alxkzmn commented 2 years ago

I was trying to follow the example from the official documentation https://docs.circom.io/getting-started/computing-the-witness/#computing-the-witness-with-c. I was able to compile the C++ witness calculator on Mac OS thanks to https://github.com/iden3/circom/pull/12. However, when I tried to generate the witness I got an error:

zsh: illegal hardware instruction  ./circuit input.json witness.wtns

The code to reproduce the issue is in the repo: https://github.com/alxkzmn/factor/commit/5690ffc08a52c27f304966cb529bdbeab90c0daf

Steps to reproduce:

cd circuit_cpp
make
./circuit input.json witness.wtns
lispc commented 2 years ago

what is your CPU? both M1(even Rosetta2) and old x64 cpus are not supported. ADX and BMI2 cpu features needed in circom x64 assembly.

It is a tool used by myself to work with circom, here is the cpu detect part: https://github.com/fluidex/snarkit2/blob/70142d8bbc5ec79cfa6869205263ff77e8423975/src/witness_generator.ts#L119

alxkzmn commented 2 years ago

I'm on x64 i7.

alrubio commented 2 years ago

Are you still having this problem? I've been able to run circuits on a Mac with x86_64 using PR #12 without errors.

alrubio commented 2 years ago

If there are no further comments, I'll proceed to close the issue.