bitshares / bitshares1-core

Software to run the old chain (before 2015-10-13). Code for current chain is https://github.com/bitshares/bitshares-core
https://bitshares.org/
The Unlicense
219 stars 174 forks source link

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

Open alexxy opened 9 years ago

alexxy commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

@dnotestein Should/can we remove this hardcoding?

dnotestein commented 9 years ago

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.