Auto merge of #3127 - str4d:2688-mandatory-rust, r=ebfull

Make Rust compilation mandatory

The temporary integration check in CheckEquihashSolution() remains, until we
have "real" Rust code to integrate.

Closes #2688.
This commit is contained in:
Homu 2018-03-30 12:58:34 -07:00
commit 1a9caa6ac1
4 changed files with 6 additions and 43 deletions

View File

@ -96,12 +96,6 @@ AC_ARG_ENABLE([mining],
[enable_mining=$enableval], [enable_mining=$enableval],
[enable_mining=yes]) [enable_mining=yes])
AC_ARG_ENABLE([rust],
[AS_HELP_STRING([--enable-rust],
[enable rust (default is yes)])],
[enable_rust=$enableval],
[enable_rust=yes])
AC_ARG_ENABLE([proton], AC_ARG_ENABLE([proton],
[AS_HELP_STRING([--disable-proton], [AS_HELP_STRING([--disable-proton],
[disable Proton (AMQP messaging)])], [disable Proton (AMQP messaging)])],
@ -728,10 +722,7 @@ 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_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)]) AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
RUST_LIBS="" RUST_LIBS="-lrustzcash"
if test x$enable_rust != xno; then
RUST_LIBS="-lrustzcash"
fi
dnl Check for OpenMP support dnl Check for OpenMP support
AX_OPENMP( AX_OPENMP(
@ -815,16 +806,6 @@ else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
dnl enable rust
AC_MSG_CHECKING([if rust should be enabled])
if test x$enable_rust != xno; then
AC_MSG_RESULT(yes)
AC_DEFINE(ENABLE_RUST, 1, [Define to 1 to enable Rust language dependent functions])
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"]) AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
AM_CONDITIONAL([ENABLE_PROTON], [test "x$use_proton" = "xyes"]) AM_CONDITIONAL([ENABLE_PROTON], [test "x$use_proton" = "xyes"])
@ -854,7 +835,6 @@ AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin])
AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes]) AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
AM_CONDITIONAL([ENABLE_MINING],[test x$enable_mining = xyes]) AM_CONDITIONAL([ENABLE_MINING],[test x$enable_mining = xyes])
AM_CONDITIONAL([ENABLE_RUST],[test x$enable_rust = xyes])
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
@ -947,7 +927,6 @@ esac
echo echo
echo "Options used to compile and link:" echo "Options used to compile and link:"
echo " with wallet = $enable_wallet" echo " with wallet = $enable_wallet"
echo " with rust = $enable_rust"
echo " with proton = $use_proton" echo " with proton = $use_proton"
echo " with zmq = $use_zmq" echo " with zmq = $use_zmq"
echo " with test = $use_tests" echo " with test = $use_tests"

View File

@ -72,11 +72,10 @@ include builders/$(build_os).mk
include builders/default.mk include builders/default.mk
include packages/packages.mk include packages/packages.mk
rust_packages_$(NO_RUST) = $(rust_packages)
wallet_packages_$(NO_WALLET) = $(wallet_packages) wallet_packages_$(NO_WALLET) = $(wallet_packages)
proton_packages_$(NO_PROTON) = $(proton_packages) proton_packages_$(NO_PROTON) = $(proton_packages)
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(rust_packages_) $(proton_packages_) $(wallet_packages_) packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(rust_packages) $(proton_packages_) $(wallet_packages_)
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
all_packages = $(packages) $(native_packages) all_packages = $(packages) $(native_packages)

View File

@ -16,9 +16,7 @@
#include "sodium.h" #include "sodium.h"
#ifdef ENABLE_RUST
#include "librustzcash.h" #include "librustzcash.h"
#endif // ENABLE_RUST
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{ {
@ -100,13 +98,11 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param
// H(I||V||... // H(I||V||...
crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size()); crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size());
#ifdef ENABLE_RUST
// Ensure that our Rust interactions are working in production builds. This is // Ensure that our Rust interactions are working in production builds. This is
// temporary and should be removed. // temporary and should be removed.
{ {
assert(librustzcash_xor(0x0f0f0f0f0f0f0f0f, 0x1111111111111111) == 0x1e1e1e1e1e1e1e1e); assert(librustzcash_xor(0x0f0f0f0f0f0f0f0f, 0x1111111111111111) == 0x1e1e1e1e1e1e1e1e);
} }
#endif // ENABLE_RUST
bool isValid; bool isValid;
EhIsValidSolution(n, k, state, pblock->nSolution, isValid); EhIsValidSolution(n, k, state, pblock->nSolution, isValid);

View File

@ -54,7 +54,7 @@ Usage:
$0 --help $0 --help
Show this help message and exit. Show this help message and exit.
$0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --disable-rust ] [ --enable-proton ] [ --disable-libs ] [ MAKEARGS... ] $0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --enable-proton ] [ --disable-libs ] [ MAKEARGS... ]
Build Zcash and most of its transitive dependencies from Build Zcash and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Zcash itself. source. MAKEARGS are applied to both dependencies and Zcash itself.
@ -65,12 +65,9 @@ $0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --disable-rust ]
If --disable-mining is passed, Zcash is configured to not build any mining If --disable-mining is passed, Zcash is configured to not build any mining
code. It must be passed after the test arguments, if present. code. It must be passed after the test arguments, if present.
If --disable-rust is passed, Zcash is configured to not build any Rust language
assets. It must be passed after test/mining arguments, if present.
If --enable-proton is passed, Zcash is configured to build the Apache Qpid Proton If --enable-proton is passed, Zcash is configured to build the Apache Qpid Proton
library required for AMQP support. This library is not built by default. library required for AMQP support. This library is not built by default.
It must be passed after the test/mining/Rust arguments, if present. It must be passed after the test/mining arguments, if present.
If --disable-libs is passed, Zcash is configured to not build any libraries like If --disable-libs is passed, Zcash is configured to not build any libraries like
'libzcashconsensus'. 'libzcashconsensus'.
@ -103,14 +100,6 @@ then
shift shift
fi fi
# If --disable-rust is the next argument, disable Rust code:
RUST_ARG=''
if [ "x${1:-}" = 'x--disable-rust' ]
then
RUST_ARG='--enable-rust=no'
shift
fi
# If --enable-proton is the next argument, enable building Proton code: # If --enable-proton is the next argument, enable building Proton code:
PROTON_ARG='--enable-proton=no' PROTON_ARG='--enable-proton=no'
if [ "x${1:-}" = 'x--enable-proton' ] if [ "x${1:-}" = 'x--enable-proton' ]
@ -135,7 +124,7 @@ eval "$CXX" --version
as --version as --version
ld -v ld -v
HOST="$HOST" BUILD="$BUILD" NO_RUST="$RUST_ARG" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1 HOST="$HOST" BUILD="$BUILD" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1
./autogen.sh ./autogen.sh
CC="$CC" CXX="$CXX" ./configure --prefix="${PREFIX}" --host="$HOST" --build="$BUILD" "$RUST_ARG" "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" "$LIBS_ARG" $CONFIGURE_FLAGS --enable-werror CXXFLAGS='-g' CC="$CC" CXX="$CXX" ./configure --prefix="${PREFIX}" --host="$HOST" --build="$BUILD" "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" "$LIBS_ARG" $CONFIGURE_FLAGS --enable-werror CXXFLAGS='-g'
"$MAKE" "$@" V=1 "$MAKE" "$@" V=1