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

tinyformat.h porting problem? #13933

Closed
girishvg opened this issue Aug 10, 2018 · 4 comments
Closed

tinyformat.h porting problem? #13933

girishvg opened this issue Aug 10, 2018 · 4 comments

Comments

@girishvg
Copy link

Hi.
From a self-compiled bitcoin core from sources, getting the following error.

$ src/bitcoind --help
bitcoind: ./tinyformat.h:515: void tinyformat::detail::FormatArg::format(std::ostream&, const char*, const char*, int) const: Assertion `m_formatImpl' failed.
Aborted (core dumped)
$

It's a NULL pointer assertion on m_formatImpl from tinyformat.h at #515. This issue is reproducible across versions, have tried all the way down to version 0.9.0 & witnessing the same assertion failure.

Using tools: TileGx, Linux (3.4.61), GCC / G++ 4.9.2, Libboost 1.64.0.

Believe, the dependency environment is prepared with correct versions ( Ref: https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md ). The issue seems to be due to a combination of CPU (tilegx), GCC libraries. Tbh, can't get my head around when it comes to C++ code.

Can someone please help figure out the problem?
Thanks very much in advance.
Girish.

@maflcko
Copy link
Member

maflcko commented Aug 10, 2018

Please include exact steps to reproduce. (commit, os, every command line, ...)

@girishvg
Copy link
Author

girishvg commented Aug 11, 2018

Thanks @MarcoFalke for the follow-up. Actually the steps to reproduce crash are just not many. There's a core-dump right the --help command. Here below are the setup details, a run session & GDB trace as well. Can you please help figure out what's going wrong?

[Platform]
I have a couple of old tilegx (now defunct processor) servers & thought of putting it to good use. To begin with it had to be upgraded with toolchain for the dependencies mentioned here: ( https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md ). So here's the tools inventory:

  • CPU Tilera tilegex, 64bit, LE.
  • Linux kernel 3.4.61, tilegx GNU/Linux
  • GCC / G++ 4..9.2, Binutils 2.21
  • autoconf 2.69, automake 1.41.1, pkg-config 0.28
  • OpenSSL 1.0.1p
  • Python 2.7.10
  • Libevent 2.1.8, bzip2 1.0.6
    - Libboost 1.64

[ bitcoin-core]
The sources cloned from https://github.com/bitcoin & were checked for almost all tags down to 0.9.0 version. But the same crash is observed for all the versions, including master, v0.16.0 and so on. For example, the sources w/ v0.9.0 tag were build as follows:

bitcoin $ git worktree add ../v0.9.0 --no-checkout --detach && cd ../v0.9.0 && git checkout -b v0.9.0 --
v0.9.0 $ ./autogen
v0.9.0 $ ./configure --prefix=$HOME/usr CC=gcc CXX=g++ CXXFLAGS="-Wno-deprecated" --with-boost=$HOME/usr LDFLAGS="-Wl,-rpath=$HOME/usr/lib" --enable-hardening --enable-static --enable-wallet
...
Fixing libtool for -rpath problems.

Options used to compile and link:
with wallet = yes
with gui / qt = no
with zmq = yes
with test = yes
with bench = yes
with upnp = auto
use asm = yes
sanitizers =
debug enabled = no
gprof enabled = no
werror = no

target os = linux
build os =

CC = gcc
CFLAGS = -g -O2
CPPFLAGS = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS
CXX = g++ -std=c++11
CXXFLAGS = -Wstack-protector -fstack-protector-all -Wno-deprecated
LDFLAGS = -pthread -Wl,-z,relro -Wl,-z,now -pie -Wl,-rpath=/home/girish/usr/lib
ARFLAGS = cr
..
v0.9.0 $ make
Making all in src
make[1]: Entering directory ...
...
CXXLD bitcoind
CXXLD bench/bench_bitcoin
CXXLD test/test_bitcoin
make[2]: Leaving directory ...
v0.9.0 $
v0.9.0 $ ldd src/bitcoind
linux-vdso.so.1 => (0x000001fff7f10000)
libboost_system.so.1.64.0 => /home/girish/usr/lib/libboost_system.so.1.64.0 (0x000001fff5df0000)
libboost_filesystem.so.1.64.0 => /home/girish/usr/lib/libboost_filesystem.so.1.64.0 (0x000001fff5db0000)
libboost_thread.so.1.64.0 => /home/girish/usr/lib/libboost_thread.so.1.64.0 (0x000001fff5d70000)
libboost_chrono.so.1.64.0 => /home/girish/usr/lib/libboost_chrono.so.1.64.0 (0x000001fff5d50000)
libdb_cxx-4.8.so => /home/girish/usr/lib/libdb_cxx-4.8.so (0x000001fff5aa0000)
libpthread.so.0 => /lib/libpthread.so.0 (0x000001fff5a10000)
libstdc++.so.6 => /home/girish/usr/lib/libstdc++.so.6 (0x000001fff5870000)
libssl.so.1.0.0 => /home/girish/usr/lib/libssl.so.1.0.0 (0x000001fff57d0000)
libcrypto.so.1.0.0 => /home/girish/usr/lib/libcrypto.so.1.0.0 (0x000001fff5500000)
libevent_pthreads-2.1.so.6 => /home/girish/usr/lib/libevent_pthreads-2.1.so.6 (0x000001fff54e0000)
libevent-2.1.so.6 => /home/girish/usr/lib/libevent-2.1.so.6 (0x000001fff5430000)
librt.so.1 => /lib/librt.so.1 (0x000001fff5400000)
libm.so.6 => /lib/libm.so.6 (0x000001fff52c0000)
libgcc_s.so.1 => /home/girish/usr/lib/libgcc_s.so.1 (0x000001fff5280000)
libc.so.6 => /lib/libc.so.6 (0x000001fff5050000)
/lib/ld.so.1 (0x0000015555550000)
libdl.so.2 => /lib/libdl.so.2 (0x000001fff5020000)
libz.so.1 => /home/girish/usr/lib/libz.so.1 (0x000001fff4ff0000)
v0.9.0 $
v0.9.0 $ src/bitcoind --help
bitcoind: ./tinyformat.h:515: void tinyformat::detail::FormatArg::format(std::ostream&, const char*, const char*, int) const: Assertion m_formatImpl' failed. Aborted (core dumped) v0.9.0 $ v0.9.0 $ **v0.9.0 $** gdb --args src/bitcoind --help GNU gdb (GDB) Red Hat Enterprise Linux (7.6.1) .. GNU gdb (GDB) Red Hat Enterprise Linux (7.6.1) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "tilegx-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/girish/work/BITCOIN/v0.9.0/src/bitcoind...done. (gdb) r Starting program: /home/girish/work/BITCOIN/v0.9.0/src/bitcoind --help [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". bitcoind: ./tinyformat.h:515: void tinyformat::detail::FormatArg::format(std::ostream&, const char*, const char*, int) const: Assertion m_formatImpl' failed.

Program received signal SIGABRT, Aborted.
0x000001fff71fff80 in raise () from /lib/libc.so.6
(gdb)
(gdb) bt
#0 0x000001fff71fff80 in raise () from /lib/libc.so.6
#1 0x000001fff7202e50 in abort () from /lib/libc.so.6
#2 0x000001fff71f4550 in __assert_fail_base () from /lib/libc.so.6
#3 0x000001fff71f4690 in __assert_fail () from /lib/libc.so.6
#4 0x00000155555f7f48 in tinyformat::detail::FormatArg::format(std::ostream&, char const*, char const*, int) const ()
#5 0x00000155555fb400 in tinyformat::detail::formatImpl(std::ostream&, char const*, tinyformat::detail::FormatArg const*, int) ()
#6 0x00000155555fc108 in tinyformat::vformat(std::ostream&, char const*, tinyformat::FormatList const&) ()
#7 0x0000015555669b60 in void tinyformat::format(std::ostream&, char const*, unsigned int const&) ()
#8 0x0000015555633110 in std::string tinyformat::format(char const*, unsigned int const&) ()
#9 0x00000155555a8740 in SetupServerArgs() ()
#10 0x000001555559dc28 in AppInit(int, char**) ()
#11 0x000001555559f558 in main ()
(gdb)

Once again thanks for your help.
Girish.
(EDIT: Re-formatting highlights)

@girishvg
Copy link
Author

can somebody help?
thanks!

@maflcko
Copy link
Member

maflcko commented Apr 27, 2020

Is this still an issue with a recent version of Bitcoin Core? If yes, what are the steps to reproduce?

@maflcko maflcko closed this as completed Apr 27, 2020
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants