Skip to content

Instantly share code, notes, and snippets.

@p0n1
Last active January 9, 2020 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p0n1/4d7970314e3203464b22fc234fbd72fd to your computer and use it in GitHub Desktop.
Save p0n1/4d7970314e3203464b22fc234fbd72fd to your computer and use it in GitHub Desktop.
fix ethsnarks compiling error about 'gmp.h' file not found

Error log

ethsnarks/depends/libsnark/depends/libff/libff/algebra/fields/bigint.hpp:15:10: fatal error: 'gmp.h' file not found

Reference

HarryR/ethsnarks-miximus#12 (comment)

Thanks for responding with the information, I'm still unsure of why you can compile a single file and it finds gmp.h but when building it's unable to find it, but my thoughts are:

Could you modify ethsnarks/CMakeLists.txt quickly, just to see if the following fixes it?

Find line 256:

target_include_directories(ff PUBLIC
  ${DEPENDS_DIR_LIBSNARK} ${DEPENDS_DIR_LIBFF} ${DEPENDS_DIR_LIBFQFFT})

And add ${GMP_INCLUDE_DIR}

e.g.

target_include_directories(ff PUBLIC
  ${GMP_INCLUDE_DIR} ${DEPENDS_DIR_LIBSNARK} ${DEPENDS_DIR_LIBFF} ${DEPENDS_DIR_LIBFQFFT})

If that fixes it, but you get build errors elsewhere due to missing 'gmp.h', you would need to do the same on line 276 (ff INTERFACE)

ethsnarks version used

commit 05d01cc283e785a9674cc705445282cff967ee80 (HEAD)
Merge: a5ffb09 cf99138
Author: HaRold <303926+HarryR@users.noreply.github.com>
Date:   Tue Jan 29 18:26:15 2019 +0000

Already fixed in a newer release of ethsnarks library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment