Update Issue - v4.2

Running into an issue when building to v4.2–issue with bellman dependency

RUSTC="/zcash/depends/x86_64-pc-linux-gnu/share/…/native/bin/rustc" TERM=dumb /zcash/depends/x86_64-pc-linux-gnu/share/…/native/bin/cargo build --lib --release --target x86_64-unknown-linux-gnu --locked --offline --manifest-path …/Cargo.toml
error: failed to select a version for the requirement bellman = "= 0.8.1"
candidate versions found which didn’t match: 0.7.0
location searched: directory source /zcash/depends/x86_64-unknown-linux-gnu/share/../vendored-sources (which is replacing registry https://github.com/rust-lang/crates.io-index)
required by package librustzcash v0.2.0 (/zcash)
perhaps a crate was updated and forgotten to be re-vendored?
As a reminder, you’re using offline mode (–offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
Makefile:8018: recipe for target ‘cargo-build’ failed
make[2]: *** [cargo-build] Error 101
make[2]: *** Waiting for unfinished jobs…
make[2]: Leaving directory ‘/zcash/src’
Makefile:7504: recipe for target ‘all-recursive’ failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory ‘/zcash/src’
Makefile:634: recipe for target ‘all-recursive’ failed
make: *** [all-recursive] Error 1

Consequently, my previous version is deprecated and I cannot start zcash. I tried to build to an old branch as well as beta—still getting the same error. Any help is greatly appreciated.

This usually indicates a caching problem. Try running ./zcutil/clean.sh and then the normal ./zcutil/build.sh.

1 Like

Thanks. That cleared the error that I was encountering.

Now, I’m getting the following when trying to start zcash:

EXCEPTION: N5boost10filesystem16filesystem_errorE
boost::filesystem::create_directory: File exists: “/root/.zcash”
Zcash in AppInit()

zcashd: chainparams.cpp:756: const CChainParams &Params(): Assertion `pCurrentParams’ failed.
Aborted (core dumped)

From Discord chat:

We don’t recommend running zcashd as root. In general running programs as root on Linux is fraught with problems: it is not the case that processes running as root can always do a superset of what processes running as non-root can do. (In fact some things just plain don’t work when running as root, and in particular it is still possible for root to get permission errors.)
I suggest that you move .zcash and .zcash-params into another user’s home directory, recursively chown them to that user (and check the file permissions), and run zcashd as that user

(People often assume that the only problem with running as root is that it’s a security hazard. No! It is a security hazard, but it will also cause you no end of hard-to-debug problems because a lot of Linux components behave in subtly different ways when running as root, so you’re running in a configuration that application developers have never tested and don’t want to test.)

The Discord reply above was in response to someone else having a similar issue, so despite our recommendation to not run zcashd as root, let’s see if we can at least figure out what change caused this.

The most obvious candidate is that we moved from Boost 1.74 to 1.75. @jogrgo please apply this patch (patch -p1 <this.patch) and then recompile and test to see if it fixes your problem:

From ca57f3bd23d269cc960960e90a98b59c4264d5c1 Mon Sep 17 00:00:00 2001
From: Jack Grigg <jack@z.cash>
Date: Sat, 26 Dec 2020 12:58:44 +0000
Subject: [PATCH] Revert "Update boost to 1.75, postpone other updates."

This reverts commit 8f4dd4460bcb6e43a21dd9deafe9ccebbf24c577.
 depends/packages/boost.mk                  | 12 ++++++++---
 depends/patches/boost/iostreams-106.patch  | 25 ++++++++++++++++++++++
 depends/patches/boost/signals2-noise.patch | 23 ++++++++++++++++++++
 qa/zcash/postponed-updates.txt             | 13 ++++++-----
 4 files changed, 63 insertions(+), 10 deletions(-)
 create mode 100644 depends/patches/boost/iostreams-106.patch
 create mode 100644 depends/patches/boost/signals2-noise.patch

diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk
index fedf13c12..c99846d0c 100644
--- a/depends/packages/boost.mk
+++ b/depends/packages/boost.mk
@@ -1,8 +1,9 @@
+$(package)_patches=iostreams-106.patch signals2-noise.patch
 ifneq ($(host_os),darwin)
@@ -30,6 +31,11 @@ $(package)_cxxflags_freebsd=-fPIC
 $(package)_ldflags+=-static-libstdc++ -lc++abi
+define $(package)_preprocess_cmds
+  patch -p2 < $($(package)_patch_dir)/iostreams-106.patch && \
+  patch -p2 < $($(package)_patch_dir)/signals2-noise.patch
 define $(package)_config_cmds
   ./bootstrap.sh --without-icu --with-libraries=$($(package)_config_libraries) && \
   sed -i -e "s|using gcc ;|using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\"$($(package)_cxxflags) $($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$(boost_archiver_$(host_os))\" <striper>\"$(host_STRIP)\"  <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;|" project-config.jam
diff --git a/depends/patches/boost/iostreams-106.patch b/depends/patches/boost/iostreams-106.patch
new file mode 100644
index 000000000..dcecd5d0d
--- /dev/null
+++ b/depends/patches/boost/iostreams-106.patch
@@ -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>
diff --git a/depends/patches/boost/signals2-noise.patch b/depends/patches/boost/signals2-noise.patch
new file mode 100644
index 000000000..e0a9ce48f
--- /dev/null
+++ b/depends/patches/boost/signals2-noise.patch
@@ -0,0 +1,23 @@
+From fd27423fea5537bc857c1fa14bb0c25b994f77b3 Mon Sep 17 00:00:00 2001
+From: Frank Mori Hess <fmh6jj@gmail.com>
+Date: Mon, 20 Jul 2020 14:17:05 -0400
+Subject: [PATCH] Fix warning about deprecated
+ boost/function_output_iterator.hpp
+ include/boost/signals2/detail/null_output_iterator.hpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+diff --git a/include/boost/signals2/detail/null_output_iterator.hpp b/include/boost/signals2/detail/null_output_iterator.hpp
+index 9e986959..dee4373c 100644
+--- a/include/boost/signals2/detail/null_output_iterator.hpp
++++ b/include/boost/signals2/detail/null_output_iterator.hpp
+@@ -11,7 +11,7 @@
+-#include <boost/function_output_iterator.hpp>
++#include <boost/iterator/function_output_iterator.hpp>
+ namespace boost
+ {
diff --git a/qa/zcash/postponed-updates.txt b/qa/zcash/postponed-updates.txt
index d09cbea63..0f31f20fa 100644
--- a/qa/zcash/postponed-updates.txt
+++ b/qa/zcash/postponed-updates.txt
@@ -7,21 +7,20 @@
 # Clang is pinned to a version that matches the Rust version.
 # This would be Clang 9, but for 4.1.0 we are using Clang 8 and postponing the upgrade.
 # libc++ is pinned to the same version as Clang.
-native_clang 8.0.1 2021-01-20
-native_clang 9.0.0 2021-01-20
-native_clang 9.0.1 2021-01-20
+native_clang 8.0.1 2020-12-01
+native_clang 9.0.0 2020-12-01
+native_clang 9.0.1 2020-12-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 2021-01-20
-libcxx 9.0.0 2021-01-20
-libcxx 9.0.1 2021-01-20
+libcxx 8.0.1 2020-12-01
+libcxx 9.0.0 2020-12-01
+libcxx 9.0.1 2020-12-01
 libcxx 10.0.0 2021-01-20
 libcxx 10.0.1 2021-01-20
 libcxx 11.0.0 2021-01-20
 native_ccache 4.0 2021-01-20
-native_ccache 4.1 2021-01-20
 bdb 18.1.40 2021-01-20

1 Like

Applying the patch and recompiling has allowed me to start zcashd without error. Thank you.

I’ll consider running with a non-elevated user. I’m running as a docker container, so I never really considered the security an issue—but the debug info makes sense.

I appreciate your assistance.

1 Like

Great, thanks! I can’t see anything obvious in the Boost 1.75 release notes that might be causing this, other than perhaps the move to using the statx system call…

1 Like

An interaction between statx and Docker is the culprit: https://github.com/JuliaLang/julia/issues/34918#issuecomment-593271396

The actual problem is in libseccomp, and is technically fixed in libseccomp 2.3.3 (tested with Docker 18.06.1 at https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1755250), but you probably have a too-old version of libseccomp and/or Docker.

1 Like

can you please release this patch as an official release?

we’re running a very popular wallet service and are unable to build 4.2 due to this error. we do not want to unofficially patch our release binary

please get back to me when available

We are getting this error still with these versions of docker and libseccomp

Can you please provide the exact versions that are expected to work?

libseccomp2/stable,now 2.3.3-4 amd64 [installed,automatic]

docker version
 Version:           18.06.1-ce
  Version:          18.06.1-ce

Hmm, that’s confusing. I’ve filed a ticket at https://github.com/zcash/zcash/issues/4945 .

What Linux distribution are you using? The report of it being fixed was on Ubuntu 18.10, and it could be that they have patches that are not in your distribution. Alternatively it could be significant that you’re using the -ce version of Docker.

thanks for the fast reply

we are using amazon linux rhel fedora version 2018.03

NAME="Amazon Linux AMI"
ID_LIKE="rhel fedora"
PRETTY_NAME="Amazon Linux AMI 2018.03"