akosba / jsnark

A Java library for zk-SNARK circuits
MIT License
207 stars 85 forks source link

`make` fails for missing includes #7

Closed pirapira closed 6 years ago

pirapira commented 6 years ago

When I follow the README, ./prepare-depends.sh runs fine. After that,

make yields

g++ -o src/interface/run_libsnark.o   src/interface/run_libsnark.cpp -c -MMD -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-comment -Wfatal-errors -O2 -march=native -mtune=native -DUSE_ASM  -DCURVE_BN128 -Idepinst/include -Isrc -DBN_SUPPORT_SNARK -fPIC
In file included from src/common/data_structures/sparse_vector.hpp:77:0,
                 from src/common/data_structures/accumulation_vector.hpp:15,
                 from src/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp:52,
                 from src/zk_proof_systems/ppzksnark/r1cs_ppzksnark/examples/run_r1cs_ppzksnark.tcc:18,
                 from src/zk_proof_systems/ppzksnark/r1cs_ppzksnark/examples/run_r1cs_ppzksnark.hpp:33,
                 from src/interface/../interface/CircuitReader.hpp:10,
                 from src/interface/run_libsnark.cpp:7:
src/common/data_structures/sparse_vector.tcc: In constructor �libsnark::sparse_vector<T>::sparse_vector(std::vector<T>&&)�:
src/common/data_structures/sparse_vector.tcc:26:10: error: �iota� is not a member of �std�
     std::iota(indices.begin(), indices.end(), 0);
          ^~~~
compilation terminated due to -Wfatal-errors.
Makefile:230: recipe for target 'src/interface/run_libsnark.o' failed
make: *** [src/interface/run_libsnark.o] Error 1
pirapira commented 6 years ago

My compiler version is

 $ g++ --version
g++ (Ubuntu 7.3.0-14ubuntu1) 7.3.0
akosba commented 6 years ago

I think the old version of libsnark (the one jsnark uses) seems not to be compatible with most recent g++ compiler versions. I guess this was not visible before, as g++ <= 5.x was installed by default in the settings I tested.

I tried to fix the issue by adding few includes to the libsnark submodule. I tested it with g++ 7.1. Let me know if you are still facing issues.

pirapira commented 6 years ago

The fix worked for me! Thanks.