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

invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false> #6113

Closed
itoffshore opened this issue May 6, 2015 · 10 comments

Comments

@itoffshore
Copy link
Contributor

Since 0.10 I've been seeing segfaults in Alpine Linux. I first checked the permissions were correctly set in ~/.bitcoin & set ~/.bitcoin/bitcoin.conf to chmod 0600 . This didn't make any difference, running bitcoind as a normal user still gave a segfault.

To trace the segfault with gdb I tried building with debug symbols included --enable-debug & this is the error thrown:

(with boost-1.58 & gcc-4.9.2 )

In file included from /usr/include/boost/move/detail/type_traits.hpp:34:0,
                 from /usr/include/boost/move/core.hpp:54,
                 from /usr/include/boost/move/utility_core.hpp:29,
                 from /usr/include/boost/move/utility.hpp:28,
                 from /usr/include/boost/thread/detail/move.hpp:27,
                 from /usr/include/boost/thread/lock_types.hpp:11,
                 from /usr/include/boost/thread/pthread/mutex.hpp:16,
                 from /usr/include/boost/thread/mutex.hpp:16,
                 from allocators.h:14,
                 from key.h:9,
                 from base58.h:18,
                 from rpcrawtransaction.cpp:7:
/usr/include/boost/variant/get.hpp: In instantiation of 'typename boost::add_reference<T>::type boost::strict_get(boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>&) [with U = const CScriptID&; T0 = CNoDestination; T1 = CKeyID; T2 = CScriptID; T3 = boost::detail::variant::void_; T4 = boost::detail::variant::void_; T5 = boost::detail::variant::void_; T6 = boost::detail::variant::void_; T7 = boost::detail::variant::void_; T8 = boost::detail::variant::void_; T9 = boost::detail::variant::void_; T10 = boost::detail::variant::void_; T11 = boost::detail::variant::void_; T12 = boost::detail::variant::void_; T13 = boost::detail::variant::void_; T14 = boost::detail::variant::void_; T15 = boost::detail::variant::void_; T16 = boost::detail::variant::void_; T17 = boost::detail::variant::void_; T18 = boost::detail::variant::void_; T19 = boost::detail::variant::void_; typename boost::add_reference<T>::type = const CScriptID&]':
/usr/include/boost/variant/get.hpp:284:33:   required from 'typename boost::add_reference<T>::type boost::get(boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>&) [with U = const CScriptID&; T0 = CNoDestination; T1 = CKeyID; T2 = CScriptID; T3 = boost::detail::variant::void_; T4 = boost::detail::variant::void_; T5 = boost::detail::variant::void_; T6 = boost::detail::variant::void_; T7 = boost::detail::variant::void_; T8 = boost::detail::variant::void_; T9 = boost::detail::variant::void_; T10 = boost::detail::variant::void_; T11 = boost::detail::variant::void_; T12 = boost::detail::variant::void_; T13 = boost::detail::variant::void_; T14 = boost::detail::variant::void_; T15 = boost::detail::variant::void_; T16 = boost::detail::variant::void_; T17 = boost::detail::variant::void_; T18 = boost::detail::variant::void_; T19 = boost::detail::variant::void_; typename boost::add_reference<T>::type = const CScriptID&]'
rpcrawtransaction.cpp:291:77:   required from here
/usr/include/boost/variant/get.hpp:178:5: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>'
     BOOST_STATIC_ASSERT_MSG(
     ^
Makefile:3654: recipe for target 'libbitcoin_server_a-rpcrawtransaction.o' failed
make[2]: *** [libbitcoin_server_a-rpcrawtransaction.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/stuart/aports/testing/bitcoin/src/bitcoin-0.10.1/src'
Makefile:6247: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/stuart/aports/testing/bitcoin/src/bitcoin-0.10.1/src'
Makefile:568: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
>>> ERROR: bitcoin: all failed
>>> bitcoin: Uninstalling dependencies...

Bitcoin builds successfully if I don't --enable-debug & set CXXFLAGS="$CXXFLAGS -DBOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT=1" (but still segfaults)

@theuni
Copy link
Member

theuni commented May 6, 2015

Ugh. Looks like #6076 has runtime implications as well. This is fixed in master.
@laanwj If we're going to do a quick follow-up release for #6093, It'd make sense to include this fix too.

@theuni
Copy link
Member

theuni commented May 6, 2015

Mmm, I might've read a bit too quickly. @itoffshore could you please try cherry-picking 8b08d95 into 0.10, building without BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT, and seeing if that fixes the crash?

@itoffshore
Copy link
Contributor Author

Yes building with the latest master.zip without setting BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT works without issue - many thx

(it wasn't possible to cherry pick the patch as there is no src/wallet in 0.10 or0.10.1)

@theuni
Copy link
Member

theuni commented May 6, 2015

Thanks for testing. In 0.10, it's just src/rpcwallet.cpp. The change is trivial if you'd like to apply it by hand.

Probably safe to conclude that 8b08d95 is enough to fix the problem, though.

@itoffshore
Copy link
Contributor Author

I looked at rpcwallet.cpp but it is completely different & did not have:
const CScriptID& hash = boost::get<const CScriptID&>(address); to patch

@theuni
Copy link
Member

theuni commented May 6, 2015

@itoffshore I went ahead and PR'd the backport as #6114. Thank you very much for reporting the issue and testing.

@itoffshore
Copy link
Contributor Author

@theuni - yes #6114 works with 0.10.1 - many thx

@laanwj laanwj closed this as completed May 10, 2015
bitspill added a commit to bitspill/ieccoin that referenced this issue Nov 1, 2015
Quick manual copy over of bitcoin/bitcoin#6114 which is necessary to compile with boost 1.58, the default with Ubuntu 15.10

Relevant: bitcoin/bitcoin#6113
icook added a commit to icook/zmark that referenced this issue Jan 5, 2016
icook added a commit to icook/bitmark that referenced this issue Jan 5, 2016
tigusoft-vm pushed a commit to tigusoft-vm/emercoin that referenced this issue Jan 13, 2016
According to the same issue on bitcoin:
bitcoin/bitcoin#6113
Helped and working well on my Ubuntu 15.10 with boost version 1.58
@GameKyuubi
Copy link

Getting this when building on 16.04.

@lacksfish
Copy link

lacksfish commented Apr 30, 2017

Have a look at

rpcrawtransaction.cpp

and search for this line

const CScriptID& hash = boost::get<const CScriptID&>(address);

It should work after changed to

const CScriptID& hash = boost::get<CScriptID>(address);

as seen in 8b08d95.

@aatheus
Copy link

aatheus commented May 18, 2017

Thank you lacksfish ! This is also impacting devcoin and making the change resolved my build issue as well.

campuscoindev added a commit to campuscoindev/CampusCoin-Source that referenced this issue Dec 12, 2017
Updated rpcrawtransactions.cpp to allow for compiling of CLI client on Ubuntu 16.04 (per bitcoin/bitcoin#6113) Credit: recklessop
nuggetbram added a commit to nuggetbram/bitcoin that referenced this issue Dec 17, 2017
Fixes building in newer linux distros
Based on: bitcoin#6113
pelletiermaxime added a commit to pelletiermaxime/PIONEERCOIN that referenced this issue Jan 4, 2018
OracolXor added a commit to OracolXor/Oracol-XOR-Coin that referenced this issue Jan 20, 2018
Have a look at

rpcrawtransaction.cpp

and search for this line

const CScriptID& hash = boost::get<const CScriptID&>(address);
 Changed as per    
bitcoin/bitcoin#6113
It should work after changed to

const CScriptID& hash = boost::get<CScriptID>(address);
sunnyking pushed a commit to primecoin/primecoin that referenced this issue Jul 9, 2018
Fixes building in newer linux distros
Based on: bitcoin#6113
mhirki pushed a commit to mikaelh2/primecoin that referenced this issue Jan 6, 2019
Fixes building in newer linux distros
Based on: bitcoin#6113
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants