Remove gmp as a dependency since we don't actually use it

Long ago our code actually used gmp directly but that is no longer the case.
Our dependency secp256k1 has an optional dependency on gmp but the way we
configure and compile secp256k1 does not use it. So there is no reason
to download and compile gmp in our build system. This means we no longer
need to maintain three different forks of GMP (one for Darwin, one for Win and
one for Linux that supports gcc15). This also makes downloading and compiling
Hush faster. Joy to the world.
This commit is contained in:
Duke
2025-12-30 13:42:08 -05:00
parent 437a229c97
commit 55c3f78dca
4 changed files with 4 additions and 187 deletions

View File

@@ -716,7 +716,7 @@ if test x$use_pkgconfig = xyes; then
)
else
# BUG: Fix this:
echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++, gmp'
echo 'BUG: configure does not yet check for the following dependencies if pkg-config is not on the system: libcrypto++'
AC_CHECK_HEADER([wolfssl/wolfcrypt/sha512.h],,AC_MSG_ERROR(libwolfssl headers missing))
AC_CHECK_LIB([wolfssl], [wc_InitSha512],CRYPTO_LIBS=-lwolfssl, AC_MSG_ERROR(libwolfssl missing))
@@ -732,33 +732,9 @@ else
fi
fi
# These packages don't provide pkgconfig config files across all
# platforms, so we use older autoconf detection mechanisms:
if test x$TARGET_OS = xdarwin; then
AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
fi
#AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
#AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
#AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
#AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
fi
# These packages don't provide pkgconfig config files across all
# platforms, so we use older autoconf detection mechanisms:
AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
#AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
RUST_LIBS="-lrustzcash"
case $host in
*mingw*)
@@ -768,12 +744,12 @@ case $host in
;;
esac
# Additional Zcash internals flags
# Additional internals flags
AX_CHECK_COMPILE_FLAG([-fwrapv],[CXXFLAGS="$CXXFLAGS -fwrapv"])
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing],[CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"])
AX_CHECK_COMPILE_FLAG([-Wno-builtin-declaration-mismatch],[CXXFLAGS="$CXXFLAGS -Wno-builtin-declaration-mismatch"],,[[$CXXFLAG_WERROR]])
LIBZCASH_LIBS="-lgmp -lgmpxx $BOOST_SYSTEM_LIB -lwolfssl -lsodium $RUST_LIBS"
LIBZCASH_LIBS="$BOOST_SYSTEM_LIB -lwolfssl -lsodium $RUST_LIBS"
AC_MSG_CHECKING([whether to build hushd])
AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
@@ -902,8 +878,6 @@ AC_SUBST(CRYPTO_LIBS)
AC_SUBST(SSL_LIBS)
AC_SUBST(EVENT_LIBS)
AC_SUBST(EVENT_PTHREADS_LIBS)
AC_SUBST(GMP_LIBS)
AC_SUBST(GMPXX_LIBS)
AC_SUBST(LIBZCASH_LIBS)
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile src/test/buildenv.py])
AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])

View File

@@ -1,52 +0,0 @@
package=libgmp
ifeq ($(host_os),mingw32)
$(package)_download_path=https://github.com/radix42/$(package)/archive
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz
$(package)_sha256_hash=67df06ed50f288bd7b1ec6907973684fb7cf1196f2cb368b59d423e42b065e40
$(package)_git_commit=42ba95387cdfd67399f7aac52fddb8d6e1258ee6
$(package)_dependencies=
$(package)_config_opts=--enable-cxx --disable-shared
else
#else ifeq ($(build_os),darwin)
$(package)_version=6.1.1
$(package)_download_path=https://git.hush.is/attachments
$(package)_file_name=d613c855-cd92-4efb-b893-658496852019
$(package)_download_file=d613c855-cd92-4efb-b893-658496852019
$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
$(package)_config_opts=--enable-cxx --disable-shared
$(package)_patches=gcc-15.patch
endif
#else
#$(package)_version=6.1.1
#$(package)_download_path=https://ftp.gnu.org/gnu/gmp
#$(package)_file_name=gmp-$($(package)_version).tar.bz2
#$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
#$(package)_dependencies=
#$(package)_config_opts=--enable-cxx --disable-shared
#endif
define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/gcc-15.patch
endef
define $(package)_config_cmds
$($(package)_autoconf) --host=$(host) --build=$(build)
endef
ifeq ($(build_os),darwin)
define $(package)_build_cmds
$(MAKE)
endef
else
define $(package)_build_cmds
$(MAKE) CPPFLAGS='-fPIC'
endef
endif
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install ; echo '=== staging find for $(package):' ; find $($(package)_staging_dir)
endef

View File

@@ -1,4 +1,4 @@
zcash_packages := libgmp libsodium utfcpp
zcash_packages := libsodium utfcpp
rust_crates := \
crate_aes \
crate_aesni \

View File

@@ -1,105 +0,0 @@
diff --git a/acinclude.m4 b/acinclude.m4
index bcc6f52..53705e1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -602,24 +602,6 @@ int f ()
}
])
-GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 1],
-[/* The following provokes a segfault in the compiler on powerpc-apple-darwin.
- Extracted from tests/mpn/t-iord_u.c. Causes Apple's gcc 3.3 build 1640 and
- 1666 to segfault with e.g., -O2 -mpowerpc64. */
-
-#if defined (__GNUC__) && ! defined (__cplusplus)
-typedef unsigned long long t1;typedef t1*t2;
-void g(){}
-void h(){}
-static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
-{t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
-void f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
-for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
-#else
-int dummy;
-#endif
-])
-
GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 2],
[/* The following provokes an internal compiler error on powerpc-apple-darwin.
Extracted from mpz/cfdiv_q_2exp.c. Causes Apple's gcc 3.3 build 1640 and
diff --git a/configure b/configure
index b9abc1b..04ba451 100755
--- a/configure
+++ b/configure
@@ -6382,71 +6382,6 @@ fi
-if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
-/* The following provokes a segfault in the compiler on powerpc-apple-darwin.
- Extracted from tests/mpn/t-iord_u.c. Causes Apple's gcc 3.3 build 1640 and
- 1666 to segfault with e.g., -O2 -mpowerpc64. */
-
-#if defined (__GNUC__) && ! defined (__cplusplus)
-typedef unsigned long long t1;typedef t1*t2;
-void g(){}
-void h(){}
-static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
-{t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
-void f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
-for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
-#else
-int dummy;
-#endif
-
-int main () { return 0; }
-EOF
- echo "Test compile: long long reliability test 1" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
-
- ;;
- no)
- gmp_prog_cc_works="no, long long reliability test 1"
- ;;
- norun)
- gmp_prog_cc_works="no, long long reliability test 1, program does not run"
- ;;
- esac
-fi
-
-
-
-
if test "$gmp_prog_cc_works" = yes; then
# remove anything that might look like compiler output to our "||" expression
rm -f conftest* a.out b.out a.exe a_out.exe