fluidex / snarkit

A toolkit to compile and debug circom circuit.
23 stars 1 forks source link

Testdata doens't compile as per readme instructions #7

Closed orbmis closed 3 years ago

orbmis commented 3 years ago

Hello,

The test data doesn't seem to compile for me for some reason. Hopefully you can help by pointing out something obvious that I'm missing.

I tried to run snarkit as per the readme file, by cloning the repo, installing the dependencies with sudo apt install nlohmann-json3-dev nasm g++, changing into the testdata folder and running the following command:

$ npx snarkit compile num2bits --backend native

I received the following error:

compile /home/user/snarkit-test/snarkit/testdata/num2bits
In file included from /home/user/snarkit-test/snarkit/testdata/num2bits/calcwit.hpp:4,
                 from /home/user/snarkit-test/snarkit/testdata/num2bits/main.cpp:17:
/home/user/snarkit-test/snarkit/testdata/num2bits/circom.hpp:4:10: fatal error: gmp.h: No such file or directory
    4 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.
In file included from /home/user/snarkit-test/snarkit/testdata/num2bits/calcwit.hpp:4,
                 from /home/user/snarkit-test/snarkit/testdata/num2bits/calcwit.cpp:10:
/home/user/snarkit-test/snarkit/testdata/num2bits/circom.hpp:4:10: fatal error: gmp.h: No such file or directory
    4 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.
In file included from /home/user/snarkit-test/snarkit/testdata/num2bits/utils.hpp:4,
                 from /home/user/snarkit-test/snarkit/testdata/num2bits/utils.cpp:7:
/home/user/snarkit-test/snarkit/testdata/num2bits/circom.hpp:4:10: fatal error: gmp.h: No such file or directory
    4 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.
In file included from /home/user/snarkit-test/snarkit/testdata/num2bits/fr.cpp:1:
/home/user/snarkit-test/snarkit/testdata/num2bits/fr.hpp:6:10: fatal error: gmp.h: No such file or directory
    6 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.
In file included from /home/user/snarkit-test/snarkit/testdata/num2bits/circuit.cpp:1:
/home/user/snarkit-test/snarkit/testdata/num2bits/circom.hpp:4:10: fatal error: gmp.h: No such file or directory
    4 | #include <gmp.h>
      |          ^~~~~~~
compilation terminated.

I'm using an AWS c5.24xlarge instance, running Ubuntu 20.04 on an x86_64 architecture.

node version: v14.16.1 npm version: 6.14.12

$ git log -1
commit f5e22133c7c0e8de6f1b81b51d6610962c27ca79 (HEAD -> master, origin/master, origin/HEAD)
Author: 张卓 <mycinbrin@gmail.com>
Date:   Thu Apr 8 14:33:43 2021 +0800

    better log msgs

Can you see what I may be missing?

lispc commented 3 years ago

You can try

sudo apt install libgmp-dev
orbmis commented 3 years ago

Perfect, that worked:

$ node node_modules/snarkit/dist/cli.js check ./snarkit/testdata/num2bits/

test /home/user/snarkit-test/snarkit/testdata/num2bits/data/case01
Up to loadJson 0.02537899999999999878
Items : 1
Total 0.02558399999999999910

test /home/user/snarkit-test/snarkit/testdata/num2bits/data/case01 done

I see the readme has already been updated: you guys work fast! :-)

Thanks for your help!!