iden3/circom

cpp witness generation illegal instruction Fr_rawMMul

Closed this issue · 7 comments

multiplier2.circom (I also tried with another example proposed on the circom documentation):

pragma circom 2.0.0;

template Multiplier2() {
    signal input a;
    signal input b;
    signal output c;
    c <== a*b;
 }

component main = Multiplier2();

commands:

circom multiplier2.circom --c
cd multiplier2_cpp
#create input.json as {"a":"3", "b":"11"}
make
./multipler2 input.json witness.wtns

gdb error:

Program received signal SIGILL, Illegal instruction.
0x000055555555c91b in Fr_rawMMul ()

env:

OS: ubuntu 20.04.6LTS 64bit
processor: Intel® Core™ i5-4440 CPU @ 3.10GHz × 4 
gcc: 9.4.0
GMP: 6.2.0
nasm: 2.14.02-1
nlohmann-json3-dev 3.7.3-1

UPDATE
It works with another computer.
env:

OS: Fedora Linux 39 (Workstation Edition)
processor: Intel® Core™ i7-8550U × 8
gcc: 13.2.1
json-devel (nlohmann-json3-dev):3.11.2-3.fc39.x86_64
gmp-devel: 6.2.1-5.fc39.x86_64
nasm: 2.16.01-4.fc39.x86_64

These dependencies, compared to the ones I used on Ubuntu, are more recent. I did not further analyze it, but I think this is the reason. I'd suggest you to specify the right versions in the docs here

In particular, we use `nlohmann-json3-dev`, `libgmp-dev` and `nasm`.

I got exactly the same problem. The witness generation fails on Intel based CPU but succeeds on AMD (both using Ubuntu 22). Not sure if this has a link with CPU architecture.

Extra libs that I installed on: build-essential libgmp-dev libsodium-dev nasm nlohmann-json3-dev libssl-dev zlib1g-dev. I think these are libs needed for either compiling c++ or snarkjs.

Error:

Program received signal SIGILL, Illegal instruction.
0x000055555555d94b in Fr_rawMMul ()

In my case, all the main dependency libs between 2 machines are exactly the same.

Did you use the same version as mine with Fedora (the most recent, the working ones)?
@visopsys

@rickardomc Both of my machines are using Ubuntu 22.

I am trying to install different OS version on the machine that fails. Will let you know the result.

Sorry, I forgot the subject... I was referring to the dependencies' version.

gcc: 13.2.1
json-devel (nlohmann-json3-dev):3.11.2-3.fc39.x86_64
gmp-devel: 6.2.1-5.fc39.x86_64
nasm: 2.16.01-4.fc39.x86_64

Hello @rickardomc @visopsys! You need processor with the support of ADX instructions (Intel Broadwell from 2014 or newer). i5-4440 is older Haswell microarchitecture, which doesn't have it.

Thanks @OBrezhniev . This makes sense. The server that fails uses intel xeon e5-1650v3 chip which is based on Haswell architecture.

I think this issue can be closed