Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

bitshares/libraries/fc/src/io/sstream.cpp cannot be build with gcc-5.1 #1540

Open
alexxy opened this issue May 9, 2015 · 3 comments
Open

Comments

@alexxy
Copy link

alexxy commented May 9, 2015

Hi all!

Seems like bitshares/libraries/fc/src/io/sstream.cpp cannot be compiled with gcc-5.1

[ 26%] Building CXX object libraries/fc/CMakeFiles/fc.dir/src/io/sstream.cpp.o
In file included from /home/alexxy/Src/bitshares/libraries/fc/src/io/sstream.cpp:2:0:
/home/alexxy/Src/bitshares/libraries/fc/include/fc/fwd_impl.hpp: In instantiation of 'void fc::check_size() [with long unsigned int RequiredSize = 392ul; long unsigned int ProvidedSize = 368ul]':
/home/alexxy/Src/bitshares/libraries/fc/include/fc/fwd_impl.hpp:63:43: required from 'fc::fwd<T, S, Align>::fwd(U&&) [with U = std::__cxx11::basic_string&; T = fc::stringstream::impl; unsigned int S = 368u; Align = double]'
/home/alexxy/Src/bitshares/libraries/fc/src/io/sstream.cpp:24:8: required from here
/home/alexxy/Src/bitshares/libraries/fc/include/fc/fwd_impl.hpp:58:25: error: static assertion failed: Failed to reserve enough space in fc::fwd<T,S>
void check_size() { static_assert( (ProvidedSize >= RequiredSize), "Failed to reserve enough space in fc::fwd<T,S>" ); }
^
libraries/fc/CMakeFiles/fc.dir/build.make:583: recipe for target 'libraries/fc/CMakeFiles/fc.dir/src/io/sstream.cpp.o' failed
make[2]: *** [libraries/fc/CMakeFiles/fc.dir/src/io/sstream.cpp.o] Error 1
CMakeFiles/Makefile2:263: recipe for target 'libraries/fc/CMakeFiles/fc.dir/all' failed
make[1]: *** [libraries/fc/CMakeFiles/fc.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2

@dnotestein
Copy link
Contributor

The error just means you need to increase the size allocated for the stream under gcc-5.1 in the fc header that wraps the stream class. Fc "hardcodes" the sizes of some objects (it's done to speed up compilation, don't ask...) and apparently the size has gone up under gcc-5.1. In this case, you need to change the allocated size from 368 to 392, from looking at the error message.

@vikramrajkumar
Copy link
Contributor

@dnotestein Should/can we remove this hardcoding?

@dnotestein
Copy link
Contributor

There's no way to remove it, it's a tradeoff BM chose to potentially speed up compilation time. Well, I take that back, we could just use the regular stream classes instead of the fc ones. It's the way I would have chosen, but I don't think it's worth the headache to debate it and make the necessary changes. This technique is used in a number of places for boost objects, for example.

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

3 participants