Auto merge of #4613 - str4d:claaaaaang, r=daira

Pin Clang for all compilation

fixes #2513, fixes #4697, fixes #4698, fixes #4699. refs #4607, #4292
This commit is contained in:
Homu 2020-10-20 11:15:47 +00:00
commit de5c28b4b7
28 changed files with 416 additions and 141 deletions

View File

@ -1,12 +1,12 @@
#!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Copyright (c) 2016-2019 The Zcash developers
# Copyright (c) 2016-2020 The Zcash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
'''
A script to check that the (Linux) executables produced by gitian only contain
allowed gcc, glibc and libstdc++ version symbols. This makes sure they are
still compatible with the minimum supported Linux distribution versions.
allowed gcc and glibc version symbols. This makes sure they are still compatible
with the minimum supported Linux distribution versions.
Example usage:
@ -18,55 +18,83 @@ import re
import sys
import os
# Debian 6.0.9 (Squeeze) has:
# Ubuntu 16.04 LTS (Xenial Xerus; End of Standard Support April 2021, EOL April 2022) has:
#
# - g++ version 4.4.5 (https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=g%2B%2B)
# - libc version 2.11.3 (https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=libc6)
# - libstdc++ version 4.4.5 (https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=libstdc%2B%2B6)
# - g++ version 4.5.3 (https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=g%2B%2B)
# - libc6 version 2.23 (https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=libc6)
#
# Ubuntu 10.04.4 (Lucid Lynx) has:
# Debian 9 (Stretch; EOL 2020-07-06, LTS EOL in 2022) has:
#
# - g++ version 4.4.3 (http://packages.ubuntu.com/search?keywords=g%2B%2B&searchon=names&suite=lucid&section=all)
# - libc version 2.11.1 (http://packages.ubuntu.com/search?keywords=libc6&searchon=names&suite=lucid&section=all)
# - libstdc++ version 4.4.3 (http://packages.ubuntu.com/search?suite=lucid&section=all&arch=any&keywords=libstdc%2B%2B&searchon=names)
# - g++ version 6.3.0 (https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=g%2B%2B)
# - libc6 version 2.24 (https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=libc6)
#
# Taking the minimum of these as our target.
# RedHat Enterprise Linux 8 (EOL: long and complicated) is based on Fedora 28 (EOL 2019-05-28) and uses the same base packages:
#
# According to GNU ABI document (http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) this corresponds to:
# GCC 4.4.0: GCC_4.4.0
# GCC 4.4.2: GLIBCXX_3.4.13, CXXABI_1.3.3
# (glibc) GLIBC_2_11
# - g++ version 8.0.1 (https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Everything/x86_64/os/Packages/g/ search for gcc-)
# - libc6 version 2.27 (https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Everything/x86_64/os/Packages/g/ search for glibc)
#
# CentOS 8 (Full update EOL May 2024, Maintenance EOL 2029-05-31) has:
#
# - g++ version 8.3.1 (http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/ search for libgcc)
# - libc6 version 2.28 (http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/ search for glibc)
#
# Fedora 31 (EOL ~November 2020) has:
#
# - g++ version 9.2.1 (https://dl.fedoraproject.org/pub/fedora/linux/releases/31/Everything/x86_64/os/Packages/g/ search for gcc-)
# - libc6 version 2.30 (https://dl.fedoraproject.org/pub/fedora/linux/releases/31/Everything/x86_64/os/Packages/g/ search for glibc)
#
# Arch is a rolling release, and as of October 2020 has packages for:
#
# - g++ version 8.4.0 / 9.3.0 / 10.2.0 (https://www.archlinux.org/packages/?q=gcc)
# - libc6 version 2.32 (https://www.archlinux.org/packages/?q=glibc)
#
# We take the minimum of these as our target. In practice, if we build on Xenial without
# upgrading GCC or libc, then we should get a binary that works for all these systems, and
# later ones.
#
# According to the GNU ABI document (http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) this corresponds to:
# GCC 4.5.3: GCC_4.5.0, GLIBCXX_3.4.14, CXXABI_1.3.4
# libc6: GLIBC_2_23
# We statically link libc++ and libc++abi in our builds. Set this to allow dynamic linking to libstdc++.
ALLOW_DYNAMIC_LIBSTDCXX = False
MAX_VERSIONS = {
'GCC': (4,4,0),
'CXXABI': (1,3,3),
'GLIBCXX': (3,4,13),
'GLIBC': (2,11)
'GCC': (4,5,0),
'GLIBC': (2,23),
}
if ALLOW_DYNAMIC_LIBSTDCXX:
MAX_VERSIONS.update({
'GLIBCXX': (3,4,14),
'CXXABI': (1,3,4),
})
# See here for a description of _IO_stdin_used:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634261#109
# Ignore symbols that are exported as part of every executable
IGNORE_EXPORTS = {
'_edata', '_end', '_init', '__bss_start', '_fini', '_IO_stdin_used'
'_edata', '_end', '_init', '__bss_start', '_fini', '_IO_stdin_used'
}
READELF_CMD = os.getenv('READELF', '/usr/bin/readelf')
CPPFILT_CMD = os.getenv('CPPFILT', '/usr/bin/c++filt')
# Allowed NEEDED libraries
ALLOWED_LIBRARIES = {
# zcashd
'libgcc_s.so.1', # GCC base support
'libc.so.6', # C library
'libstdc++.so.6', # C++ standard library
'libpthread.so.0', # threading
'libanl.so.1', # DNS resolve
'libm.so.6', # math library
'librt.so.1', # real-time (clock)
'libgomp.so.1', # OpenMP support library
'ld-linux-x86-64.so.2', # 64-bit dynamic linker
'ld-linux.so.2', # 32-bit dynamic linker
'libdl.so.2' # programming interface to dynamic linker
# zcashd
'libgcc_s.so.1', # GCC support library (also used by clang)
'libc.so.6', # C library
'libpthread.so.0', # threading
'libanl.so.1', # DNS resolver
'libm.so.6', # math library
'librt.so.1', # real-time (POSIX compatibility)
'ld-linux-x86-64.so.2', # 64-bit dynamic linker
'ld-linux.so.2', # 32-bit dynamic linker
'libdl.so.2' # programming interface to dynamic linker
}
if ALLOW_DYNAMIC_LIBSTDCXX:
ALLOWED_LIBRARIES.add('libstdc++.so.6') # C++ standard library
class CPPFilt(object):
'''
@ -138,6 +166,7 @@ if __name__ == '__main__':
cppfilt = CPPFilt()
retval = 0
for filename in sys.argv[1:]:
print("Checking %s..." % (filename,))
# Check imported symbols
for sym,version in read_symbols(filename, True):
if version and not check_version(MAX_VERSIONS, version):
@ -154,7 +183,12 @@ if __name__ == '__main__':
if library_name not in ALLOWED_LIBRARIES:
print('%s: NEEDED library %s is not allowed' % (filename, library_name))
retval = 1
print()
if retval == 0:
print("Everything OK")
else:
print("Note: this script is intended to ensure that Gitian builds meet our compatibility policy.")
print("The above warnings do not necessarily mean the program(s) will not work on your system.")
exit(retval)

View File

@ -32,7 +32,7 @@ export PKG_CONFIG_LIBDIR=$depends_prefix/lib/pkgconfig
export PKG_CONFIG_PATH=$depends_prefix/share/pkgconfig
CPPFLAGS="-I$depends_prefix/include/ $CPPFLAGS"
LDFLAGS="-L$depends_prefix/lib $LDFLAGS"
LDFLAGS="-L$depends_prefix/lib $LDFLAGS -static-libstdc++ -lc++abi"
CC="@CC@"
CXX="@CXX@"

View File

@ -46,9 +46,9 @@ $(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SU
final_build_id_long+=$($(package)_build_id_long)
#override platform specific files and hashes
$(eval $(1)_file_name=$(if $($(1)_exact_file_name),$($(1)_exact_file_name),$(if $($(1)_file_name_$(host_os)),$($(1)_file_name_$(host_os)),$($(1)_file_name))))
$(eval $(1)_sha256_hash=$(if $($(1)_exact_sha256_hash),$($(1)_exact_sha256_hash),$(if $($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash))))
$(eval $(1)_download_file=$(if $($(1)_exact_download_file),$($(1)_exact_download_file),$(if $($(1)_download_file_$(host_os)),$($(1)_download_file_$(host_os)),$(if $($(1)_download_file),$($(1)_download_file),$($(1)_file_name)))))
$(eval $(1)_file_name=$(if $($(1)_exact_file_name),$($(1)_exact_file_name),$(if $($(1)_file_name_$(host_arch)_$(host_os)),$($(1)_file_name_$(host_arch)_$(host_os)),$(if $($(1)_file_name_$(host_os)),$($(1)_file_name_$(host_os)),$($(1)_file_name)))))
$(eval $(1)_sha256_hash=$(if $($(1)_exact_sha256_hash),$($(1)_exact_sha256_hash),$(if $($(1)_sha256_hash_$(host_arch)_$(host_os)),$($(1)_sha256_hash_$(host_arch)_$(host_os)),$(if $($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash_$(host_os)),$($(1)_sha256_hash)))))
$(eval $(1)_download_file=$(if $($(1)_exact_download_file),$($(1)_exact_download_file),$(if $($(1)_download_file_$(host_arch)_$(host_os)),$($(1)_download_file_$(host_arch)_$(host_os)),$(if $($(1)_download_file_$(host_os)),$($(1)_download_file_$(host_os)),$(if $($(1)_download_file),$($(1)_download_file),$($(1)_file_name))))))
#compute package-specific paths
$(1)_build_subdir?=.

View File

@ -1,12 +1,22 @@
default_host_CC = $(host_toolchain)gcc
default_host_CXX = $(host_toolchain)g++
default_host_AR = $(host_toolchain)ar
default_host_RANLIB = $(host_toolchain)ranlib
default_host_STRIP = $(host_toolchain)strip
# Flag explanations:
#
# -B$(build_prefix)/bin
#
# Explicitly point to our binaries (e.g. cctools) so that they are
# ensured to be found and preferred over other possibilities.
#
default_host_CC = clang -target $(host) -B$(build_prefix)/bin
default_host_CXX = clang++ -target $(host) -B$(build_prefix)/bin -stdlib=libc++
default_host_AR = llvm-ar
default_host_RANLIB = llvm-ranlib
default_host_STRIP = llvm-strip
default_host_LIBTOOL = $(host_toolchain)libtool
default_host_INSTALL_NAME_TOOL = $(host_toolchain)install_name_tool
default_host_OTOOL = $(host_toolchain)otool
default_host_NM = $(host_toolchain)nm
default_host_NM = llvm-nm
$(host_os)_native_binutils?=native_clang
$(host_os)_native_toolchain?=native_clang
define add_host_tool_func
$(host_os)_$1?=$$(default_host_$1)

View File

@ -9,23 +9,12 @@ freebsd_debug_CXXFLAGS=$(freebsd_debug_CFLAGS)
freebsd_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
ifeq (86,$(findstring 86,$(build_arch)))
i686_freebsd_CC=gcc -m32
i686_freebsd_CXX=g++ -m32
i686_freebsd_AR=ar
i686_freebsd_RANLIB=ranlib
i686_freebsd_NM=nm
i686_freebsd_STRIP=strip
# Changes below have not been tested. If you try to build on FreeBSD,
# please let us know how it goes.
freebsd_LDFLAGS?=-fuse-ld=lld
x86_64_freebsd_CC=gcc -m64
x86_64_freebsd_CXX=g++ -m64
x86_64_freebsd_AR=ar
x86_64_freebsd_RANLIB=ranlib
x86_64_freebsd_NM=nm
x86_64_freebsd_STRIP=strip
else
i686_freebsd_CC=$(default_host_CC) -m32
i686_freebsd_CXX=$(default_host_CXX) -m32
x86_64_freebsd_CC=$(default_host_CC) -m64
x86_64_freebsd_CXX=$(default_host_CXX) -m64
endif

View File

@ -9,23 +9,17 @@ linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)
linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
ifeq (86,$(findstring 86,$(build_arch)))
i686_linux_CC=gcc -m32
i686_linux_CXX=g++ -m32
i686_linux_AR=ar
i686_linux_RANLIB=ranlib
i686_linux_NM=nm
i686_linux_STRIP=strip
linux_LDFLAGS?=-fuse-ld=lld
x86_64_linux_CC=gcc -m64
x86_64_linux_CXX=g++ -m64
x86_64_linux_AR=ar
x86_64_linux_RANLIB=ranlib
x86_64_linux_NM=nm
x86_64_linux_STRIP=strip
else
i686_linux_CC=$(default_host_CC) -m32
i686_linux_CXX=$(default_host_CXX) -m32
x86_64_linux_CC=$(default_host_CC) -m64
x86_64_linux_CXX=$(default_host_CXX) -m64
# Clang doesn't appear to find these multilib paths by default,
# so help it out if we are cross-compiling.
ifneq ($(canonical_host),$(build))
# CFLAGS is copied to CXXFLAGS after it is fully-evaluated.
linux_CFLAGS += -idirafter /usr/$(host)/include
linux_LDFLAGS += -L/usr/$(host)/lib
endif

View File

@ -1,5 +1,7 @@
mingw32_CFLAGS=-pipe
mingw32_CXXFLAGS=$(mingw32_CFLAGS)
mingw32_CXXFLAGS=$(mingw32_CFLAGS) -isystem $(host_prefix)/include/c++/v1
mingw32_LDFLAGS?=-fuse-ld=lld
mingw32_release_CFLAGS=-O1
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)

View File

@ -6,6 +6,10 @@ $(package)_sha256_hash=47612c8991aa9ac2f6be721267c8d3cdccf5ac83105df8e50809daea2
$(package)_build_subdir=build_unix
$(package)_patches=winioctl-and-atomic_init_db.patch
ifneq ($(host_os),darwin)
$(package)_dependencies=libcxx
endif
define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication --enable-option-checking
$(package)_config_opts_mingw32=--enable-mingw
@ -15,7 +19,8 @@ ifneq ($(build_os),darwin)
$(package)_config_opts_darwin=--disable-atomicsupport
endif
$(package)_config_opts_aarch64=--disable-atomicsupport
$(package)_cxxflags=-std=c++11
$(package)_cxxflags+=-std=c++11
$(package)_ldflags+=-static-libstdc++ -lc++abi
endef
define $(package)_preprocess_cmds

View File

@ -3,7 +3,11 @@ $(package)_version=1_74_0
$(package)_download_path=https://dl.bintray.com/boostorg/release/1.74.0/source
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
$(package)_sha256_hash=83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1
$(package)_patches=signals2-noise.patch
$(package)_patches=iostreams-106.patch signals2-noise.patch
ifneq ($(host_os),darwin)
$(package)_dependencies=libcxx
endif
define $(package)_set_vars
$(package)_config_opts_release=variant=release
@ -16,17 +20,19 @@ $(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win3
$(package)_config_opts_x86_64_mingw32=address-model=64
$(package)_config_opts_i686_mingw32=address-model=32
$(package)_config_opts_i686_linux=address-model=32 architecture=x86
$(package)_toolset_$(host_os)=gcc
$(package)_toolset_$(host_os)=clang
$(package)_archiver_$(host_os)=$($(package)_ar)
$(package)_toolset_darwin=darwin
$(package)_archiver_darwin=$($(package)_libtool)
$(package)_config_libraries=chrono,filesystem,program_options,system,thread,test
$(package)_cxxflags=-std=c++11 -fvisibility=hidden
$(package)_cxxflags+=-std=c++11 -fvisibility=hidden
$(package)_cxxflags_linux=-fPIC
$(package)_cxxflags_freebsd=-fPIC
$(package)_ldflags+=-static-libstdc++ -lc++abi
endef
define $(package)_preprocess_cmds
patch -p2 < $($(package)_patch_dir)/iostreams-106.patch && \
patch -p2 < $($(package)_patch_dir)/signals2-noise.patch
endef
@ -42,3 +48,12 @@ endef
define $(package)_stage_cmds
./b2 -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install
endef
# Boost uses the MSVC convention of libboost_foo.lib as the naming pattern when
# compiling for Windows, even though we use MinGW which follows the libfoo.a
# convention. This causes issues with lld, so we rename all .lib files to .a.
ifeq ($(host_os),mingw32)
define $(package)_postprocess_cmds
for f in lib/*.lib; do mv -- "$$$$f" "$$$${f%.lib}.a"; done
endef
endif

View File

@ -5,10 +5,15 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_download_file=release-$($(package)_version).tar.gz
$(package)_sha256_hash=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
ifneq ($(host_os),darwin)
$(package)_dependencies=libcxx
endif
define $(package)_set_vars
$(package)_cxxflags+=-std=c++11
$(package)_cxxflags_linux=-fPIC
$(package)_cxxflags_freebsd=-fPIC
$(package)_ldflags+=-static-libstdc++ -lc++abi
endef
define $(package)_build_cmds

View File

@ -0,0 +1,73 @@
package=libcxx
$(package)_version=$(native_clang_version)
ifneq ($(canonical_host),$(build))
ifneq ($(host_os),mingw32)
# Clang is provided pre-compiled for a bunch of targets; fetch the one we need
# and stage its copies of the static libraries.
$(package)_download_path=https://releases.llvm.org/$($(package)_version)
$(package)_download_file_aarch64_linux=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_file_name_aarch64_linux=clang-llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_sha256_hash_aarch64_linux=998e9ae6e89bd3f029ed031ad9355c8b43441302c0e17603cf1de8ee9939e5c9
$(package)_download_file_linux=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz
$(package)_file_name_linux=clang-llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz
$(package)_sha256_hash_linux=9ef854b71949f825362a119bf2597f744836cb571131ae6b721cd102ffea8cd0
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/lib && \
cp lib/libc++.a $($(package)_staging_prefix_dir)/lib && \
cp lib/libc++abi.a $($(package)_staging_prefix_dir)/lib
endef
else
# For Windows cross-compilation, use the MSYS2 binaries.
$(package)_download_path=http://repo.msys2.org/mingw/x86_64
$(package)_download_file=mingw-w64-x86_64-libc++-9.0.1-1-any.pkg.tar.xz
$(package)_file_name=mingw-w64-x86_64-libcxx-9.0.1-1-any.pkg.tar.xz
$(package)_sha256_hash=04e77c5d0e3a9efc9cc8ca3b6549af9a9eef6e20d53076295efbdfba76c5f5de
$(package)_libcxxabi_download_file=mingw-w64-x86_64-libc++abi-9.0.1-1-any.pkg.tar.xz
$(package)_libcxxabi_file_name=mingw-w64-x86_64-libc++abi-9.0.1-1-any.pkg.tar.xz
$(package)_libcxxabi_sha256_hash=e8a38084dc05c9f6bd4ded4fe1cdbbe16f7280d66426a76b2c3c23d0575aad5c
$(package)_extra_sources += $($(package)_libcxxabi_file_name)
define $(package)_fetch_cmds
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_libcxxabi_download_file),$($(package)_libcxxabi_file_name),$($(package)_libcxxabi_sha256_hash))
endef
define $(package)_extract_cmds
mkdir -p $($(package)_extract_dir) && \
echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
echo "$($(package)_libcxxabi_sha256_hash) $($(package)_source_dir)/$($(package)_libcxxabi_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
mkdir -p libcxxabi && \
tar --no-same-owner --strip-components=1 -C libcxxabi -xf $($(package)_source_dir)/$($(package)_libcxxabi_file_name) && \
tar --no-same-owner --strip-components=1 -xf $($(package)_source)
endef
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/lib && \
mv include/ $($(package)_staging_prefix_dir) && \
cp lib/libc++.a $($(package)_staging_prefix_dir)/lib && \
cp libcxxabi/lib/libc++abi.a $($(package)_staging_prefix_dir)/lib
endef
endif
else
# For native compilation, use the static libraries from native_clang.
# We explicitly stage them so that subsequent dependencies don't link to the
# shared libraries distributed with Clang.
define $(package)_fetch_cmds
endef
define $(package)_extract_cmds
endef
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/lib && \
cp $(build_prefix)/lib/libc++.a $($(package)_staging_prefix_dir)/lib && \
cp $(build_prefix)/lib/libc++abi.a $($(package)_staging_prefix_dir)/lib
endef
endif

View File

@ -4,11 +4,8 @@ $(package)_download_path=https://github.com/tpoechtrager/cctools-port/archive
$(package)_file_name=$($(package)_version).tar.gz
$(package)_sha256_hash=e51995a843533a3dac155dd0c71362dd471597a2d23f13dff194c6285362f875
$(package)_build_subdir=cctools
$(package)_clang_version=8.0.0
$(package)_clang_download_path=https://releases.llvm.org/$($(package)_clang_version)
$(package)_clang_download_file=clang+llvm-$($(package)_clang_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz
$(package)_clang_file_name=clang-llvm-$($(package)_clang_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz
$(package)_clang_sha256_hash=9ef854b71949f825362a119bf2597f744836cb571131ae6b721cd102ffea8cd0
$(package)_dependencies=native_clang
$(package)_patches=ignore-otool.diff
$(package)_libtapi_version=3efb201881e7a76a21e0554906cf306432539cef
$(package)_libtapi_download_path=https://github.com/tpoechtrager/apple-libtapi/archive
@ -16,45 +13,41 @@ $(package)_libtapi_download_file=$($(package)_libtapi_version).tar.gz
$(package)_libtapi_file_name=$($(package)_libtapi_version).tar.gz
$(package)_libtapi_sha256_hash=380c1ca37cfa04a8699d0887a8d3ee1ad27f3d08baba78887c73b09485c0fbd3
$(package)_extra_sources=$($(package)_clang_file_name)
$(package)_extra_sources += $($(package)_libtapi_file_name)
define $(package)_fetch_cmds
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_clang_download_path),$($(package)_clang_download_file),$($(package)_clang_file_name),$($(package)_clang_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_libtapi_download_path),$($(package)_libtapi_download_file),$($(package)_libtapi_file_name),$($(package)_libtapi_sha256_hash))
endef
define $(package)_extract_cmds
mkdir -p $($(package)_extract_dir) && \
echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
echo "$($(package)_clang_sha256_hash) $($(package)_source_dir)/$($(package)_clang_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
echo "$($(package)_libtapi_sha256_hash) $($(package)_source_dir)/$($(package)_libtapi_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
mkdir -p toolchain/bin toolchain/lib/clang/$($(package)_clang_version)/include && \
mkdir -p libtapi && \
tar --no-same-owner --strip-components=1 -C libtapi -xf $($(package)_source_dir)/$($(package)_libtapi_file_name) && \
tar --no-same-owner --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \
rm -f toolchain/lib/libc++abi.so* && \
tar --no-same-owner --strip-components=1 -xf $($(package)_source)
endef
define $(package)_set_vars
$(package)_config_opts=--target=$(host) --with-libtapi=$($(package)_extract_dir)
$(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib
$(package)_config_opts+=--enable-lto-support --with-llvm-config=$($(package)_extract_dir)/toolchain/bin/llvm-config
$(package)_cc=$($(package)_extract_dir)/toolchain/bin/clang
$(package)_cxx=$($(package)_extract_dir)/toolchain/bin/clang++
$(package)_config_opts+=--enable-lto-support --with-llvm-config=$(build_prefix)/bin/llvm-config
$(package)_cc=$(build_prefix)/bin/clang
$(package)_cxx=$(build_prefix)/bin/clang++
endef
define $(package)_preprocess_cmds
CC=$($(package)_cc) CXX=$($(package)_cxx) INSTALLPREFIX=$($(package)_extract_dir) ./libtapi/build.sh && \
CC=$($(package)_cc) CXX=$($(package)_cxx) INSTALLPREFIX=$($(package)_extract_dir) ./libtapi/install.sh && \
sed -i.old "/define HAVE_PTHREADS/d" $($(package)_build_subdir)/ld64/src/ld/InputFiles.h
patch -p1 < $($(package)_patch_dir)/ignore-otool.diff && \
cd $($(package)_build_subdir); DO_NOT_UPDATE_CONFIG_SCRIPTS=1 ./autogen.sh
endef
define $(package)_config_cmds
$($(package)_autoconf)
rm -f $(build_prefix)/lib/libc++abi.so* && \
CC=$($(package)_cc) CXX=$($(package)_cxx) INSTALLPREFIX=$($(package)_extract_dir) ../libtapi/build.sh && \
CC=$($(package)_cc) CXX=$($(package)_cxx) INSTALLPREFIX=$($(package)_extract_dir) ../libtapi/install.sh && \
$($(package)_config_env) $($(package)_autoconf)
endef
define $(package)_build_cmds
@ -65,13 +58,5 @@ define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install && \
mkdir -p $($(package)_staging_prefix_dir)/lib/ && \
cd $($(package)_extract_dir) && \
cp lib/libtapi.so.6 $($(package)_staging_prefix_dir)/lib/ && \
cd $($(package)_extract_dir)/toolchain && \
mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include && \
mkdir -p $($(package)_staging_prefix_dir)/bin $($(package)_staging_prefix_dir)/include && \
cp bin/clang $($(package)_staging_prefix_dir)/bin/ &&\
cp -P bin/clang++ $($(package)_staging_prefix_dir)/bin/ &&\
cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \
cp -rf lib/clang/$($(package)_clang_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include/ && \
cp bin/dsymutil $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil
cp lib/libtapi.so.6 $($(package)_staging_prefix_dir)/lib/
endef

View File

@ -0,0 +1,37 @@
package=native_clang
$(package)_major_version=8
$(package)_version=8.0.0
$(package)_download_path=https://releases.llvm.org/$($(package)_version)
$(package)_download_file_linux=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz
$(package)_file_name_linux=clang-llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz
$(package)_sha256_hash_linux=9ef854b71949f825362a119bf2597f744836cb571131ae6b721cd102ffea8cd0
$(package)_download_file_darwin=clang+llvm-$($(package)_version)-x86_64-apple-darwin.tar.xz
$(package)_file_name_darwin=clang-llvm-$($(package)_version)-x86_64-apple-darwin.tar.xz
$(package)_sha256_hash_darwin=94ebeb70f17b6384e052c47fef24a6d70d3d949ab27b6c83d4ab7b298278ad6f
# Ensure we have clang native to the builder, not the target host
ifneq ($(canonical_host),$(build))
$(package)_exact_download_file=$($(package)_download_file_$(build_os))
$(package)_exact_file_name=$($(package)_file_name_$(build_os))
$(package)_exact_sha256_hash=$($(package)_sha256_hash_$(build_os))
endif
define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/bin && \
cp bin/clang-$($(package)_major_version) $($(package)_staging_prefix_dir)/bin && \
cp bin/lld $($(package)_staging_prefix_dir)/bin && \
cp bin/llvm-ar $($(package)_staging_prefix_dir)/bin && \
cp bin/llvm-config $($(package)_staging_prefix_dir)/bin && \
cp bin/llvm-nm $($(package)_staging_prefix_dir)/bin && \
cp bin/llvm-objcopy $($(package)_staging_prefix_dir)/bin && \
cp -P bin/clang $($(package)_staging_prefix_dir)/bin && \
cp -P bin/clang++ $($(package)_staging_prefix_dir)/bin && \
cp -P bin/ld.lld $($(package)_staging_prefix_dir)/bin && \
cp -P bin/ld64.lld $($(package)_staging_prefix_dir)/bin && \
cp -P bin/lld-link $($(package)_staging_prefix_dir)/bin && \
cp -P bin/llvm-ranlib $($(package)_staging_prefix_dir)/bin && \
cp -P bin/llvm-strip $($(package)_staging_prefix_dir)/bin && \
mv include/ $($(package)_staging_prefix_dir) && \
mv lib/ $($(package)_staging_prefix_dir) && \
mv libexec/ $($(package)_staging_prefix_dir)
endef

View File

@ -1,9 +1,14 @@
zcash_packages := libsodium utfcpp
packages := boost libevent zeromq $(zcash_packages) googletest
native_packages := native_ccache native_rust
native_packages := native_clang native_ccache native_rust
wallet_packages=bdb
ifneq ($(build_os),darwin)
darwin_native_packages=native_cctools
endif
# We use a complete SDK for Darwin, which includes libc++.
ifneq ($(host_os),darwin)
packages += libcxx
endif

View File

@ -3,6 +3,11 @@ $(package)_version=4.3.3
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=9d9285db37ae942ed0780c016da87060497877af45094ff9e1a1ca736e3875a2
$(package)_patches=windows-unused-variables.diff
ifneq ($(host_os),darwin)
$(package)_dependencies=libcxx
endif
define $(package)_set_vars
$(package)_config_opts=--without-docs --disable-shared --disable-curve --disable-curve-keygen --disable-perf
@ -11,7 +16,12 @@ define $(package)_set_vars
$(package)_config_opts += --disable-drafts --enable-option-checking
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic
$(package)_cxxflags=-std=c++11
$(package)_cxxflags+=-std=c++11
$(package)_ldflags+=-static-libstdc++ -lc++abi
endef
define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/windows-unused-variables.diff
endef
define $(package)_config_cmds

View File

@ -0,0 +1,25 @@
From 4e76f73826fd0a7067b837e4850a9051436f5ec5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?=
<jeanmichael.celerier+github@gmail.com>
Date: Sun, 22 Dec 2019 10:26:38 +0100
Subject: [PATCH] Fix build on windows with libc++
Proposed by @SquallATF in #67
---
include/boost/iostreams/detail/config/fpos.hpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/boost/iostreams/detail/config/fpos.hpp b/include/boost/iostreams/detail/config/fpos.hpp
index c5dc6cf59..a5835421f 100644
--- a/include/boost/iostreams/detail/config/fpos.hpp
+++ b/include/boost/iostreams/detail/config/fpos.hpp
@@ -26,7 +26,8 @@
# if (defined(_YVALS) || defined(_CPPLIB_VER)) && !defined(__SGI_STL_PORT) && \
!defined(_STLPORT_VERSION) && !defined(__QNX__) && !defined(_VX_CPU) && !defined(__VXWORKS__) \
- && !((defined(BOOST_MSVC) || defined(BOOST_CLANG)) && _MSVC_STL_VERSION >= 141)
+ && !((defined(BOOST_MSVC) || defined(BOOST_CLANG)) && _MSVC_STL_VERSION >= 141) \
+ && !defined(_LIBCPP_VERSION)
/**/
#include <boost/iostreams/detail/ios.hpp>

View File

@ -0,0 +1,24 @@
diff -ur cctools-port-55562e4073dea0fbfd0b20e0bf69ffe6390c7f97-orig/cctools/Makefile.am cctools-port-55562e4073dea0fbfd0b20e0bf69ffe6390c7f97/cctools/Makefile.am
--- cctools-port-55562e4073dea0fbfd0b20e0bf69ffe6390c7f97-orig/cctools/Makefile.am 2020-07-30 15:01:05.680000000 +0100
+++ cctools-port-55562e4073dea0fbfd0b20e0bf69ffe6390c7f97/cctools/Makefile.am 2020-07-30 15:01:34.900000000 +0100
@@ -1,7 +1,7 @@
if ISDARWIN
-SUBDIRS=libstuff libmacho ar as misc otool efitools ld64 man
+SUBDIRS=libstuff libmacho ar as misc efitools ld64 man
else
-SUBDIRS=libobjc2 libstuff libmacho ar as misc otool efitools ld64 man
+SUBDIRS=libobjc2 libstuff libmacho ar as misc efitools ld64 man
endif
ACLOCAL_AMFLAGS = -I m4
diff -ur cctools-port-55562e4073dea0fbfd0b20e0bf69ffe6390c7f97-orig/cctools/configure.ac cctools-port-55562e4073dea0fbfd0b20e0bf69ffe6390c7f97/cctools/configure.ac
--- cctools-port-55562e4073dea0fbfd0b20e0bf69ffe6390c7f97-orig/cctools/configure.ac 2020-07-30 15:01:05.680000000 +0100
+++ cctools-port-55562e4073dea0fbfd0b20e0bf69ffe6390c7f97/cctools/configure.ac 2020-07-30 15:01:47.330000000 +0100
@@ -466,7 +466,6 @@
AC_CONFIG_FILES([as/ppc64/Makefile])
AC_CONFIG_FILES([man/Makefile])
AC_CONFIG_FILES([misc/Makefile])
-AC_CONFIG_FILES([otool/Makefile])
AC_CONFIG_FILES([efitools/Makefile])
AC_CONFIG_FILES([libobjc2/Makefile])
AC_CONFIG_FILES([ld64/Makefile])

View File

@ -0,0 +1,17 @@
diff -ur zeromq-4.3.3-orig/src/clock.cpp zeromq-4.3.3/src/clock.cpp
--- zeromq-4.3.3-orig/src/clock.cpp 2020-10-13 13:44:04.190000000 +0100
+++ zeromq-4.3.3/src/clock.cpp 2020-10-13 13:47:04.170000000 +0100
@@ -126,9 +126,13 @@
init_compatible_get_tick_count64 ();
#endif
+#ifndef ZMQ_HAVE_WINDOWS
const uint64_t usecs_per_msec = 1000;
+#endif
const uint64_t usecs_per_sec = 1000000;
+#ifndef ZMQ_HAVE_WINDOWS
const uint64_t nsecs_per_usec = 1000;
+#endif
zmq::clock_t::clock_t () :
_last_tsc (rdtsc ()),

View File

@ -4,3 +4,21 @@ release-notes at release time)
Notable changes
===============
Migration to Clang and static libc++
------------------------------------
`zcashd` now builds its C++ (and C) dependencies entirely with a pinned version
of Clang, and statically links libc++ instead of dynamically linking libstdc++.
This migration enables us to reliably use newer C++ features while supporting
older LTS platforms, be more confident in the compiler's optimisations, and
leverage security features such as sanitisers and efficient fuzzing.
Additionally, because both Clang and rustc use LLVM as their backend, we can
optimise across the FFI boundary between them. This reduces the cost of moving
between C++ and Rust, making it easier to build more functionality in Rust
(though not making it costless, as we still need to work within the constraints
of the C ABI).
The system compiler is still used to compile a few native dependencies (used by
the build machine to then compile `zcashd` for the target machine). These will
likely also be migrated to use the pinned Clang in a future release.

View File

@ -94,11 +94,13 @@ def check_security_hardening():
# NOTE: checksec.sh does not reliably determine whether FORTIFY_SOURCE
# is enabled for the entire binary. See issue #915.
ret &= test_fortify_source('src/zcashd')
ret &= test_fortify_source('src/zcash-cli')
ret &= test_fortify_source('src/zcash-gtest')
ret &= test_fortify_source('src/zcash-tx')
ret &= test_fortify_source('src/test/test_bitcoin')
# FORTIFY_SOURCE does mostly nothing for Clang before 10, which we don't
# pin yet, so we disable these tests.
# ret &= test_fortify_source('src/zcashd')
# ret &= test_fortify_source('src/zcash-cli')
# ret &= test_fortify_source('src/zcash-gtest')
# ret &= test_fortify_source('src/zcash-tx')
# ret &= test_fortify_source('src/test/test_bitcoin')
return ret

View File

@ -4,6 +4,23 @@
# bdb 18.1.40 2020-09-01
#
# Clang is pinned to a version that matches the Rust version.
# This will be Clang 9 intially, which we are postponing until after the
# initial Clang PR is merged.
# libc++ is pinned to the same version as Clang.
native_clang 8.0.1 2020-11-01
native_clang 9.0.0 2020-11-01
native_clang 9.0.1 2020-11-01
native_clang 10.0.0 2021-01-20
native_clang 10.0.1 2021-01-20
native_clang 11.0.0 2021-01-20
libcxx 8.0.1 2020-11-01
libcxx 9.0.0 2020-11-01
libcxx 9.0.1 2020-11-01
libcxx 10.0.0 2021-01-20
libcxx 10.0.1 2021-01-20
libcxx 11.0.0 2021-01-20
bdb 18.1.40 2021-01-20
# We currently pin Rust 1.44.1, and plan to re-evaluate this in 2021 if

View File

@ -57,6 +57,11 @@ def get_dependency_list():
GithubTagReleaseLister("google", "googletest", "^release-(\d+)\.(\d+)\.(\d+)$",
{ "release-1.8.1": (1, 8, 1) }),
DependsVersionGetter("googletest")),
# libc++ matches the Clang version
Dependency("libcxx",
GithubTagReleaseLister("llvm", "llvm-project", "^llvmorg-(\d+)\.(\d+).(\d+)$",
{ "llvmorg-11.0.0": (11, 0, 0), "llvmorg-9.0.1-rc3": None}),
DependsVersionGetter("native_clang")),
Dependency("libevent",
GithubTagReleaseLister("libevent", "libevent", "^release-(\d+)\.(\d+)\.(\d+)-stable$",
{ "release-2.0.22-stable": (2, 0, 22), "release-2.1.9-beta": None }),
@ -69,6 +74,10 @@ def get_dependency_list():
GithubTagReleaseLister("ccache", "ccache", "^v?(\d+)\.(\d+)(?:\.(\d+))?$",
{ "v3.5.1": (3, 5, 1), "v3.6": (3, 6)}),
DependsVersionGetter("native_ccache")),
Dependency("native_clang",
GithubTagReleaseLister("llvm", "llvm-project", "^llvmorg-(\d+)\.(\d+).(\d+)$",
{ "llvmorg-11.0.0": (11, 0, 0), "llvmorg-9.0.1-rc3": None}),
DependsVersionGetter("native_clang")),
Dependency("native_rust",
GithubTagReleaseLister("rust-lang", "rust", "^(\d+)\.(\d+)(?:\.(\d+))?$",
{ "1.33.0": (1, 33, 0), "0.9": (0, 9) }),

View File

@ -35,6 +35,7 @@ bench_bench_bitcoin_LDADD = \
$(LIBLEVELDB_SSE42) \
$(LIBMEMENV) \
$(LIBSECP256K1) \
$(LIBUNIVALUE) \
$(LIBZCASH) \
$(LIBRUSTZCASH)

View File

@ -25,9 +25,9 @@ fi
AM_PROG_CC_C_O
AC_PROG_CC_C89
if test x"$ac_cv_prog_cc_c89" = x"no"; then
AC_MSG_ERROR([c89 compiler support required])
AC_PROG_CC_C99
if test x"$ac_cv_prog_cc_c99" = x"no"; then
AC_MSG_ERROR([c99 compiler support required])
fi
AM_PROG_AS
@ -65,7 +65,7 @@ esac
CFLAGS="$CFLAGS -W"
warn_CFLAGS="-std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings"
warn_CFLAGS="-std=c99 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings"
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $warn_CFLAGS"
AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}])

View File

@ -41,22 +41,22 @@ TEST_DATA_DIR=test
test_unitester_SOURCES = test/unitester.cpp
test_unitester_LDADD = libunivalue.la
test_unitester_CXXFLAGS = -I$(top_srcdir)/include -DJSON_TEST_SRC=\"$(srcdir)/$(TEST_DATA_DIR)\"
test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS) -lpthread
test_test_json_SOURCES = test/test_json.cpp
test_test_json_LDADD = libunivalue.la
test_test_json_CXXFLAGS = -I$(top_srcdir)/include
test_test_json_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
test_test_json_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS) -lpthread
test_no_nul_SOURCES = test/no_nul.cpp
test_no_nul_LDADD = libunivalue.la
test_no_nul_CXXFLAGS = -I$(top_srcdir)/include
test_no_nul_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
test_no_nul_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS) -lpthread
test_object_SOURCES = test/object.cpp
test_object_LDADD = libunivalue.la
test_object_CXXFLAGS = -I$(top_srcdir)/include
test_object_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
test_object_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS) -lpthread
TEST_FILES = \
$(TEST_DATA_DIR)/fail10.json \

View File

@ -336,7 +336,6 @@ TEST(WalletZkeysTest, WriteViewingKeyDirectToDB) {
/**
* This test covers methods on CWalletDB to load/save crypted z keys.
*/
/* TODO: Uncomment during PR for #3388
TEST(WalletZkeysTest, WriteCryptedzkeyDirectToDb) {
SelectParams(CBaseChainParams::TESTNET);

View File

@ -1140,7 +1140,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_parameters)
}
try {
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy",1.0, "") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy", 1*COIN, "") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "INVALID", recipients, {}, 1) );
} catch (const UniValue& objError) {
BOOST_CHECK( find_error(objError, "Invalid from address"));
@ -1148,7 +1148,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_parameters)
// Testnet payment addresses begin with 'zt'. This test detects an incorrect prefix.
try {
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy",1.0, "") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy", 1*COIN, "") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "zcMuhvq8sEkHALuSU2i4NbNQxshSAYrpCExec45ZjtivYPbuiFPwk6WHy4SvsbeZ4siy1WheuRGjtaJmoD1J8bFqNXhsG6U", recipients, {}, 1) );
} catch (const UniValue& objError) {
BOOST_CHECK( find_error(objError, "Invalid from address"));
@ -1157,7 +1157,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_parameters)
// Note: The following will crash as a google test because AsyncRPCOperation_sendmany
// invokes a method on pwalletMain, which is undefined in the google test environment.
try {
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy",1.0, "") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient("dummy", 1*COIN, "") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, "ztjiDe569DPNbyTE6TSdJTaSDhoXEHLGvYoUnBU1wfVNU52TEyT6berYtySkd21njAeEoh8fFJUT42kua9r8EnhBaEKqCpP", recipients, {}, 1) );
} catch (const UniValue& objError) {
BOOST_CHECK( find_error(objError, "no spending key found for zaddr"));
@ -1204,7 +1204,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
// there are no utxos to spend
{
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, taddr1, {}, recipients, 1) );
operation->main();
BOOST_CHECK(operation->isFailed());
@ -1215,7 +1215,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
// minconf cannot be zero when sending from zaddr
{
try {
std::vector<SendManyRecipient> recipients = {SendManyRecipient(taddr1, 100.0, "DEADBEEF")};
std::vector<SendManyRecipient> recipients = {SendManyRecipient(taddr1, 100*COIN, "DEADBEEF")};
std::shared_ptr<AsyncRPCOperation> operation(new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 0));
BOOST_CHECK(false); // Fail test if an exception is not thrown
} catch (const UniValue& objError) {
@ -1226,7 +1226,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
// there are no unspent notes to spend
{
std::vector<SendManyRecipient> recipients = { SendManyRecipient(taddr1,100.0, "DEADBEEF") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient(taddr1, 100*COIN, "DEADBEEF") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
operation->main();
BOOST_CHECK(operation->isFailed());
@ -1236,7 +1236,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
// get_memo_from_hex_string())
{
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
TEST_FRIEND_AsyncRPCOperation_sendmany proxy(ptr);
@ -1287,7 +1287,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
// add_taddr_change_output_to_tx() will append a vout to a raw transaction
{
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1,100.0, "DEADBEEF") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 100*COIN, "DEADBEEF") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
TEST_FRIEND_AsyncRPCOperation_sendmany proxy(ptr);
@ -1296,14 +1296,14 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
BOOST_CHECK(tx.vout.size() == 0);
CReserveKey keyChange(pwalletMain);
CAmount amount = AmountFromValue(ValueFromString("123.456"));
CAmount amount = 12345600000;
proxy.add_taddr_change_output_to_tx(keyChange, amount);
tx = proxy.getTx();
BOOST_CHECK(tx.vout.size() == 1);
CTxOut out = tx.vout[0];
BOOST_CHECK_EQUAL(out.nValue, amount);
amount = AmountFromValue(ValueFromString("1.111"));
amount = 111100000;
proxy.add_taddr_change_output_to_tx(keyChange, amount);
tx = proxy.getTx();
BOOST_CHECK(tx.vout.size() == 2);
@ -1314,9 +1314,9 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
// add_taddr_outputs_to_tx() will append many vouts to a raw transaction
{
std::vector<SendManyRecipient> recipients = {
SendManyRecipient("tmTGScYwiLMzHe4uGZtBYmuqoW4iEoYNMXt",CAmount(1.23), ""),
SendManyRecipient("tmUSbHz3vxnwLvRyNDXbwkZxjVyDodMJEhh",CAmount(4.56), ""),
SendManyRecipient("tmYZAXYPCP56Xa5JQWWPZuK7o7bfUQW6kkd",CAmount(7.89), ""),
SendManyRecipient("tmTGScYwiLMzHe4uGZtBYmuqoW4iEoYNMXt", 123000000, ""),
SendManyRecipient("tmUSbHz3vxnwLvRyNDXbwkZxjVyDodMJEhh", 456000000, ""),
SendManyRecipient("tmYZAXYPCP56Xa5JQWWPZuK7o7bfUQW6kkd", 789000000, ""),
};
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, recipients, {}, 1) );
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
@ -1326,15 +1326,15 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals)
CTransaction tx = proxy.getTx();
BOOST_CHECK(tx.vout.size() == 3);
BOOST_CHECK_EQUAL(tx.vout[0].nValue, CAmount(1.23));
BOOST_CHECK_EQUAL(tx.vout[1].nValue, CAmount(4.56));
BOOST_CHECK_EQUAL(tx.vout[2].nValue, CAmount(7.89));
BOOST_CHECK_EQUAL(tx.vout[0].nValue, 123000000);
BOOST_CHECK_EQUAL(tx.vout[1].nValue, 456000000);
BOOST_CHECK_EQUAL(tx.vout[2].nValue, 789000000);
}
// Test the perform_joinsplit methods.
{
// Dummy input so the operation object can be instantiated.
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 0.0005, "ABCD") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 50000, "ABCD") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(boost::none, mtx, zaddr1, {}, recipients, 1) );
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);
@ -1436,7 +1436,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_taddr_to_sapling)
auto builder = TransactionBuilder(consensusParams, nextBlockHeight, pwalletMain);
mtx = CreateNewContextualCMutableTransaction(consensusParams, nextBlockHeight);
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 1 * COIN, "ABCD") };
std::vector<SendManyRecipient> recipients = { SendManyRecipient(zaddr1, 1*COIN, "ABCD") };
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(builder, mtx, taddr1, {}, recipients, 0) );
std::shared_ptr<AsyncRPCOperation_sendmany> ptr = std::dynamic_pointer_cast<AsyncRPCOperation_sendmany> (operation);

View File

@ -67,7 +67,6 @@ set -x
eval "$MAKE" --version
as --version
ld -v
HOST="$HOST" BUILD="$BUILD" "$MAKE" "$@" -C ./depends/