Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portability to RHEL6 (CentOS6, SL6) #1053

Closed
solardiz opened this issue Jun 25, 2016 · 15 comments
Closed

Portability to RHEL6 (CentOS6, SL6) #1053

solardiz opened this issue Jun 25, 2016 · 15 comments
Labels
M-user-support User support issue O-linux Operating system: Linux portability

Comments

@solardiz
Copy link
Contributor

RHEL6 is still a widely used server distro, but trying to build on Scientific Linux 6.6 (a RHEL6 alike), I ran into the following issues:

Build failure 1: zcutil/fetch-params.sh fails to verify parameter file integrity, as follows:

Updating testnet3 symlinks to regtest parameters.
Verifying parameter file integrity via sha256sum...
shasum: -: No such file or directory

Checking with strace, I see it is literally trying to open a file named "-":

open("-", O_RDONLY)                     = -1 ENOENT (No such file or directory)

Editing the offending line from:

shasum -a 256 --check <<EOF

to:

shasum -a 256 --check /dev/stdin <<EOF

or:

sha256sum -c <<EOF

fixes the problem. (I prefer the latter version.) Here are the corresponding package versions:

$ rpm -qf `which shasum`
perl-Digest-SHA-5.47-141.el6.x86_64
$ rpm -qf `which sha256sum`
coreutils-8.4-37.el6.x86_64

Build failure 2: The next hurdle is libsnark doesn't build with RHEL6's default gcc 4.4.7:

cc1plus: error: unrecognized command line option "-std=c++11"
compilation terminated due to -Wfatal-errors.
make[1]: *** [src/algebra/curves/mnt/mnt4/mnt4_g2.o] Error 1
make[1]: *** [src/algebra/curves/mnt/mnt4/mnt4_g1.o] Error 1
make[1]: Leaving directory `/home/z/zcash/depends/work/build/x86_64-unknown-linux-gnu/libsnark/0.1-4b292e38415'

This is can be overcome by issuing:

scl enable devtoolset-3 bash

(indeed with devtoolset-3 installed first) and starting anew. This provides gcc 4.9.1 and other goodies, in a manner standard for these distros. (BTW, where are the instructions on doing an equivalent of "make clean" for the whole tree? zcutil/build.sh appears to only be able of building stuff, not cleaning between different builds.)

Build failure 3: Now the build fails anyway on:

cd /home/z/zcash-build/depends/work/build/x86_64-unknown-linux-gnu/libsodium/1.0.8-3241aed3009;   cd .; ./autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
configure.ac:1: error: Autoconf version 2.65 or higher is required
configure.ac:1: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: autom4te failed with exit status: 63
autoreconf: aclocal failed with exit status: 63
make: *** [/home/z/zcash-build/depends/work/build/x86_64-unknown-linux-gnu/libsodium/1.0.8-3241aed3009/.stamp_preprocessed] Error 63

Unfortunately, there's only autoconf 2.63 on this distro, and devtoolset-3 does not provide a replacement. But this repository does:

https://www.softwarecollections.org/en/scls/praiskup/autotools/

Download https://www.softwarecollections.org/en/scls/praiskup/autotools/epel-6-x86_64/download/praiskup-autotools-epel-6-x86_64.noarch.rpm and install it with "rpm -U", then install newer autotools with "yum install autotools-latest", as root indeed. Then, back as the zcash build user, issue:

scl enable autotools-latest bash

(from inside the shell that already has devtoolset-3 enabled). This provides autoconf 2.69, and the build continues successfully (I didn't bother to start over this time).

Build failure 4: Finally, this fails on needing Qt5 (RHEL6 normally has Qt4):

+ ./configure --prefix=/home/z/zcash-build/depends/x86_64-unknown-linux-gnu/ --with-gui=no '' 'CXXFLAGS=-Wno-deprecated-declarations -Wno-placement-new -Wno-terminate -Werror -Og -g'
./configure: line 21823: syntax error near unexpected token `QTPLATFORM,'
./configure: line 21823: `        PKG_CHECK_MODULES(QTPLATFORM, Qt5PlatformSupport, QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS")'

I wonder why it needs Qt despite of --with-gui=no?

There are some instructions on getting Qt5 onto RHEL6'ish distros, but I haven't tried that yet.

Overall, it might be some effort to achieve portability of zcash to RHEL6, so I am not sure if it's something this community will want to do, but some of these issues look like something to fix in zcash regardless (in particular, the shasum incompatibility, and needing Qt even for a GUI-less build).

@solardiz
Copy link
Contributor Author

In configure.ac, commented out line 525:

BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt4])

Then the build proceeded further, now failing at:

At global scope:
cc1plus: error: unrecognized command line option "-Wno-terminate" [-Werror]
cc1plus: error: unrecognized command line option "-Wno-placement-new" [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [libbitcoin_util_a-util.o] Error 1

gcc 4.9.1 considered too old to build this? I'd say that's unreasonable, and should be relaxed.

@solardiz
Copy link
Contributor Author

Manually removed -Wno-terminate -Wno-placement-new from a couple of generated Makefiles, then proceeded to build with make. Kept -Werror intact for now. Fails with:

In file included from util/env_posix.cc:26:0:
./util/posix_logger.h: In member function 'virtual void leveldb::PosixLogger::Logv(const char*, __va_list_tag*)':
./util/posix_logger.h:86:39: error: ignoring return value of 'size_t fwrite(const void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Werror=unused-result]
       fwrite(base, 1, p - base, file_);
                                       ^
util/env_posix.cc: In destructor 'leveldb::{anonymous}::PosixEnv::~PosixEnv()':
util/env_posix.cc:297:40: error: ignoring return value of 'size_t fwrite(const void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Werror=unused-result]
     fwrite(msg, 1, sizeof(msg), stderr);
                                        ^
cc1plus: all warnings being treated as errors
make[3]: *** [util/env_posix.o] Error 1
make[3]: Leaving directory `/home/z/zcash-build/src/leveldb'
make[2]: *** [leveldb/libleveldb.a] Error 2
make[2]: *** Waiting for unfinished jobs....
util.cpp: In function 'void ShrinkDebugFile()':
util.cpp:716:52: error: ignoring return value of 'size_t fwrite(const void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Werror=unused-result]
             fwrite(begin_ptr(vch), 1, nBytes, file);
                                                    ^
cc1plus: all warnings being treated as errors
make[2]: *** [libbitcoin_util_a-util.o] Error 1

So we at the same time ask to fail on any warnings, and have code that does produce warnings. I wonder whether/how this builds for others - are fwrite() attributes on this older distro actually stricter than on newer distros? Anyway, time to remove -Werror as well.

@daira
Copy link
Contributor

daira commented Jun 25, 2016

Re: build failure 1, sha256sum is also nonportable (#638), so the preferred option would be shasum -a 256 --check /dev/stdin <<EOF.

@daira
Copy link
Contributor

daira commented Jun 25, 2016

zcutil/build.sh was only intended to be a temporary workaround for Makefile problems; we should make the actual Makefile work.

@solardiz
Copy link
Contributor Author

Removed -Wno-placement-new -Wno-terminate -Werror from zcutil/build.sh, continued the build. Failed at linking:

libtool: link: /home/z/zcash-build/depends/x86_64-unknown-linux-gnu/native/bin/ccache g++ -m64 -std=c++11 -pipe -O2 -Wno-deprecated-declarations -Og -g -Wstack-protector -fstack-protector-all -fPIE -pthread -Wl,-z -Wl,relro -Wl,-z -Wl,now -pie -o zcashd zcashd-bitcoind.o -fopenmp  -L/home/z/zcash-build/depends/x86_64-unknown-linux-gnu/lib libbitcoin_server.a libbitcoin_common.a univalue/libbitcoin_univalue.a libbitcoin_util.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a secp256k1/.libs/libsecp256k1.a libbitcoin_wallet.a -lboost_filesystem-mt -lboost_program_options-mt -lboost_thread-mt -lboost_chrono-mt -ldb_cxx-4.8 -lminiupnpc libzcash.a crypto/libbitcoin_crypto.a -lsnark /home/z/zcash-build/depends/x86_64-unknown-linux-gnu/lib/libgmpxx.a /home/z/zcash-build/depends/x86_64-unknown-linux-gnu/lib/libgmp.a -lboost_system-mt /home/z/zcash-build/depends/x86_64-unknown-linux-gnu/lib/libsodium.a -lcrypto -lrt -lanl -fopenmp -pthread
zcashd-bitcoind.o: In function `do_init':
/home/z/zcash-build/depends/x86_64-unknown-linux-gnu/include/boost/asio/ssl/detail/impl/openssl_init.ipp:39: undefined reference to `SSL_library_init'
/home/z/zcash-build/depends/x86_64-unknown-linux-gnu/include/boost/asio/ssl/detail/impl/openssl_init.ipp:40: undefined reference to `SSL_load_error_strings'
libbitcoin_server.a(libbitcoin_server_a-rpcserver.o): In function `StartRPCThreads()':
/home/z/zcash-build/src/rpcserver.cpp:646: undefined reference to `SSL_CTX_set_cipher_list'
libbitcoin_server.a(libbitcoin_server_a-rpcserver.o): In function `boost::asio::ssl::detail::engine::do_accept(void*, unsigned long)':
/home/z/zcash-build/depends/x86_64-unknown-linux-gnu/include/boost/asio/ssl/detail/impl/engine.ipp:291: undefined reference to `SSL_accept'
libbitcoin_server.a(libbitcoin_server_a-rpcserver.o): In function `boost::asio::ssl::detail::engine::do_connect(void*, unsigned long)':
/home/z/zcash-build/depends/x86_64-unknown-linux-gnu/include/boost/asio/ssl/detail/impl/engine.ipp:296: undefined reference to `SSL_connect'

and so on. Manually added -lssl right before -lcrypto in Makefile and src/Makefile - no idea why this didn't happen automatically here. And it built!

$ ls -la depends/x86_64-unknown-linux-gnu/bin/
total 382724
drwx------. 2 z z      4096 Jun 25 12:24 .
drwx------. 7 z z      4096 Jun 25 12:24 ..
-rwxr-xr-x. 1 z z   7954951 Jun 25 12:24 GenerateParams
-rwxr-xr-x. 1 z z  23437840 Jun 25 12:24 bitcoin-tx
-rwxr-xr-x. 1 z z 146591322 Jun 25 12:24 test_bitcoin
-rwxr-xr-x. 1 z z   5380892 Jun 25 12:24 utilTest
-rwxr-xr-x. 1 z z  11751382 Jun 25 12:24 zcash-cli
-rwxr-xr-x. 1 z z 100519879 Jun 25 12:24 zcash-gtest
-rwxr-xr-x. 1 z z  96243994 Jun 25 12:24 zcashd

100+ MB binaries look pretty ridiculous to me, even if not stripped. Whatever. Now running tests.

@solardiz
Copy link
Contributor Author

Re: build failure 1, sha256sum is also nonportable (#638), so the preferred option would be shasum -a 256 --check /dev/stdin <<EOF.

I think neither is perfectly portable. Sure sha256sum is a GNU coreutils thing, so *BSD's usually won't have it installed by default. Yet another option could be to use openssl dgst -sha256, but I think it lacks the "check" mode. Maybe we should check for /usr/bin/sha256sum and if present use sha256sum, otherwise use shasum (with their respective options).

Meanwhile, qa/zcash/full-test-suite.sh mostly passed, but somehow failing the no-dot-so-in-depends test and returning non-zero exit code:

[z@super zcash-build]$ qa/zcash/full-test-suite.sh
===== BEGIN: /home/z/zcash-build/qa/zcash/ensure-no-dot-so-in-depends.py
libbitcoinconsensus.so.0.0.0
libbitcoinconsensus.so.0
libbitcoinconsensus.so
FAIL.
===== FAILED: /home/z/zcash-build/qa/zcash/ensure-no-dot-so-in-depends.py
===== BEGIN: /home/z/zcash-build/src/zerocash/tests/utilTest
Running 2 test cases...

*** No errors detected
===== PASSED: /home/z/zcash-build/src/zerocash/tests/utilTest
===== BEGIN: make check || { echo === ./src/test-suite.log === ; cat ./src/test-suite.log ; false ; }
Making check in src
make[1]: Entering directory `/home/z/zcash-build/src'
make[2]: Entering directory `/home/z/zcash-build/src'
make[3]: Entering directory `/home/z/zcash-build/src/secp256k1'
make[3]: Leaving directory `/home/z/zcash-build/src/secp256k1'
make  check-TESTS check-local
make[3]: Entering directory `/home/z/zcash-build/src'
make[4]: Entering directory `/home/z/zcash-build/src'
make[5]: Entering directory `/home/z/zcash-build/src/secp256k1'
make[5]: Leaving directory `/home/z/zcash-build/src/secp256k1'
PASS: test/test_bitcoin
PASS: zcash-gtest
============================================================================
Testsuite summary for Zcash 0.11.2.z5
============================================================================
# TOTAL: 2
# PASS:  2
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[4]: Leaving directory `/home/z/zcash-build/src'
Running test/bitcoin-util-test.py...
make[4]: Entering directory `/home/z/zcash-build/src/secp256k1'
  CC       src/tests-tests.o
  CCLD     tests
make  check-TESTS
make[5]: Entering directory `/home/z/zcash-build/src/secp256k1'
make[6]: Entering directory `/home/z/zcash-build/src/secp256k1'
PASS: tests
============================================================================
Testsuite summary for libsecp256k1 0.1
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[6]: Leaving directory `/home/z/zcash-build/src/secp256k1'
make[5]: Leaving directory `/home/z/zcash-build/src/secp256k1'
make[4]: Leaving directory `/home/z/zcash-build/src/secp256k1'
make[3]: Leaving directory `/home/z/zcash-build/src'
make[2]: Leaving directory `/home/z/zcash-build/src'
make[1]: Leaving directory `/home/z/zcash-build/src'
make[1]: Entering directory `/home/z/zcash-build'
make  check-local
make[2]: Entering directory `/home/z/zcash-build'
make[2]: Nothing to be done for `check-local'.
make[2]: Leaving directory `/home/z/zcash-build'
make[1]: Leaving directory `/home/z/zcash-build'
===== PASSED: make check || { echo === ./src/test-suite.log === ; cat ./src/test-suite.log ; false ; }
[z@super zcash-build]$ echo $?
1

@daira
Copy link
Contributor

daira commented Jun 25, 2016

Re: build failure 1, sha256sum is also nonportable (#638), so the preferred option would be shasum -a 256 --check /dev/stdin <<EOF.

I think neither is perfectly portable. Sure sha256sum is a GNU coreutils thing, so *BSD's usually won't have it installed by default. Yet another option could be to use openssl dgst -sha256, but I think it lacks the "check" mode. Maybe we should check for /usr/bin/sha256sum and if present use sha256sum, otherwise use shasum (with their respective options).

Definitely not OpenSSL. I still think shasum -a 256 --check /dev/stdin <<EOF is the simplest option; we can add the fallback logic complexity later if need be.

@solardiz
Copy link
Contributor Author

I'd be happy to provide zcash developers with access to the Scientific Linux 6.6 machine I am experimenting on, which already has devtoolset-3 and autotools-latest installed, so that the remaining portability issues (not avoided by installing of these extra software collections) can be resolved in the zcash tree. Then installing devtoolset-3 and autotools-latest may be part of the instructions we'd provide for building zcash on RHEL6-alikes.

@daira
Copy link
Contributor

daira commented Oct 25, 2016

The shasum issue is fixed by #1628.

@solardiz
Copy link
Contributor Author

solardiz commented Nov 4, 2016

Instructions for those building on RHEL6-alikes now (as tested today with @str4d's standalone-miner branch and with zogminer, but should be same for zcash master and releases):

  • In zcash (or standalone-miner) tree, make these edits:

    • In the top-level configure.ac, comment out the line BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt4]) (put a # before it).
    • Also in the top-level configure.ac, add -lssl right before -lcrypto on the LIBZCASH_LIBS line.
    • In zcutil/build.sh, remove -Werror. (Not needed for zogminer, which already has this removed.)
  • Install devtoolset-3 and autotools-latest (if not previously installed), then run:

    scl enable devtoolset-3 'scl enable autotools-latest bash'
    
  • From the shell just started above, proceed to build with zcutil/build.sh -j8 (or the like), just like you would on a newer distro.

@daira
Copy link
Contributor

daira commented Apr 25, 2017

The QT code has been removed so that should no longer be an issue. Could someone try building a recent version on RHEL, first without @solardiz' suggested workarounds and then with each in turn, to see which ones are still necessary?

@daira
Copy link
Contributor

daira commented Apr 25, 2017

In particular, please pay close attention to which packages you needed to install. (I suspect that they will be similar, but not necessarily identical, to the packages for Fedora listed in the 1.0 User Guide.)

@happygeorge01
Copy link

I'm using centos 6.7 and gcc 5.3 but still have the error during the build.

In file included from util/env_posix.cc:26:0:
./util/posix_logger.h: In member function ‘virtual void leveldb::PosixLogger::Logv(const char*, _va_list_tag*)’:
./util/posix_logger.h:86:39: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
fwrite(base, 1, p - base, file
);
^
util/env_posix.cc: In destructor ‘leveldb::{anonymous}::PosixEnv::~PosixEnv()’:
util/env_posix.cc:297:40: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
fwrite(msg, 1, sizeof(msg), stderr);
^
cc1plus: all warnings being treated as errors
make[3]: *** [util/env_posix.o] Error 1
make[3]: Leaving directory `/home/tairan/zcash/src/leveldb'
make[2]: *** [leveldb/libleveldb.a] Error 2
make[2]: *** Waiting for unfinished jobs....
mv -f test/.deps/test_test_bitcoin-Checkpoints_tests.Tpo test/.deps/test_test_bitcoin-Checkpoints_tests.Po
mv -f test/.deps/test_test_bitcoin-base64_tests.Tpo test/.deps/test_test_bitcoin-base64_tests.Po
mv -f test/.deps/test_test_bitcoin-base32_tests.Tpo test/.deps/test_test_bitcoin-base32_tests.Po
mv -f test/.deps/test_test_bitcoin-compress_tests.Tpo test/.deps/test_test_bitcoin-compress_tests.Po
mv -f test/.deps/test_test_bitcoin-allocator_tests.Tpo test/.deps/test_test_bitcoin-allocator_tests.Po
mv -f test/.deps/test_test_bitcoin-hash_tests.Tpo test/.deps/test_test_bitcoin-hash_tests.Po
mv -f test/.deps/test_test_bitcoin-bip32_tests.Tpo test/.deps/test_test_bitcoin-bip32_tests.Po
mv -f test/.deps/test_test_bitcoin-mruset_tests.Tpo test/.deps/test_test_bitcoin-mruset_tests.Po
util.cpp: In function ‘void ShrinkDebugFile()’:
util.cpp:777:52: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
fwrite(begin_ptr(vch), 1, nBytes, file);
^
cc1plus: all warnings being treated as errors
make[2]: *** [libbitcoin_util_a-util.o] Error 1

@happygeorge01
Copy link

happygeorge01 commented Jun 13, 2017

Follow the operations by @solardiz , I can build and pass full suit test on version 1.0.6. But failed on version 1.0.8 and 1.0.9. And full suit test log of failure is attached.

error.txt.txt

@mdr0id
Copy link
Contributor

mdr0id commented Apr 25, 2018

We won't be adding support for this version of CentOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-user-support User support issue O-linux Operating system: Linux portability
Projects
None yet
Development

No branches or pull requests

4 participants