[config] Boost and the Intel (Linux) compiler

I am a developer on the Ethereum C++ client ( https://github.com/ethereum/webthree-umbrella) and have been working with an external developer on adding support to the codebase for building with the Intel Compiler on Ubuntu. Here is the full log of pain :-) https://github.com/ethereum/webthree-umbrella/issues/396 We've already merged various changes, and we appear to be getting down to the real hard ones, which are now mainly clustered around build issues with boost::multiprecision and seeming limitations with the Intel compiler and Like so: /home/libweb3core/libdevcore/Base64.h(48): error: no suitable conversion function from "boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<160U, 160U, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>, boost::multiprecision::et_off>" to "unsigned int" exists unsigned r = (unsigned)(a - a / 36 * 36); // boost's % is broken ^ detected during instantiation of "std::string dev::toBase36(const dev::FixedHash<N> &) [with N=20UL]" at line 114 of "/home/libethereum/libethcore/ICAP.cpp" This appears to be the key observation: https://github.com/ethereum/webthree-umbrella/issues/396#issuecomment-206590... "In summary, the intel platform supports this "convert_to" member function, but does not support implicit conversion of boost multiprecision types" Has anybody worked with Boost and the Intel compiler who might have some further insight into whether there is some way in which the Intel compiler "warts" can be handed within Boost? Or are we stuck with these nasty diffs/workarounds? https://github.com/ethereum/libethereum/pull/224/files https://github.com/ethereum/libweb3core/pull/68/files Cheers, Bob Summerwill Developer, Ethereum Foundation -- bob@summerwill.net

On 06/05/2016 20:17, Bob Summerwill wrote:
I am a developer on the Ethereum C++ client ( https://github.com/ethereum/webthree-umbrella) and have been working with an external developer on adding support to the codebase for building with the Intel Compiler on Ubuntu.
Here is the full log of pain :-)
https://github.com/ethereum/webthree-umbrella/issues/396
We've already merged various changes, and we appear to be getting down to the real hard ones, which are now mainly clustered around build issues with boost::multiprecision and seeming limitations with the Intel compiler and
Like so:
/home/libweb3core/libdevcore/Base64.h(48): error: no suitable conversion function from "boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<160U, 160U, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>, boost::multiprecision::et_off>" to "unsigned int" exists unsigned r = (unsigned)(a - a / 36 * 36); // boost's % is broken ^ detected during instantiation of "std::string dev::toBase36(const dev::FixedHash<N> &) [with N=20UL]" at line 114 of "/home/libethereum/libethcore/ICAP.cpp"
This appears to be the key observation: https://github.com/ethereum/webthree-umbrella/issues/396#issuecomment-206590...
"In summary, the intel platform supports this "convert_to" member function, but does not support implicit conversion of boost multiprecision types"
Has anybody worked with Boost and the Intel compiler who might have some further insight into whether there is some way in which the Intel compiler "warts" can be handed within Boost?
Or are we stuck with these nasty diffs/workarounds?
https://github.com/ethereum/libethereum/pull/224/files https://github.com/ethereum/libweb3core/pull/68/files
It depends which compilers you want to support, (plus probably which Boost version you're using). Your code depends on a C++11 feature - explicit conversion operators, and support for that is disabled when BOOST_MP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS is set. For Boost-1.60 and later, plus Intel 15 and later, the config for the Intel compiler is identical to the GCC version it's emulating which probably fixes the issue.... but: * Depending how Intel C++ is installed it can end up emulating antique GCC versions which don't support the features you're using, and * There is one compiler (Oracle C++) whose support for explicit conversion operators is too broken to use anyway (internal compiler errors if the feature is enabled for Multiprecision). * And of course, default compiler mode even for GCC is still C++03 not C++11 :( So.... if you want to support any of the above, then yes you will need to use the convert_to member via: #ifdef BOOST_MP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS myvar = bignum.template convert_to<int>(); #else myvar = static_cast<int>(bignum); #endif Hopefully that explains the situation? John.

* And of course, default compiler mode even for GCC is still C++03 not C++11 :(
Just to be a pedant, as of v6 the default is ‘gnu++14’, the gnu dialect of C++14 :) https://gcc.gnu.org/gcc-6/changes.html

On 08/05/2016 00:37, Soul Studios wrote:
* And of course, default compiler mode even for GCC is still C++03 not C++11 :(
Just to be a pedant, as of v6 the default is ‘gnu++14’, the gnu dialect of C++14 :) https://gcc.gnu.org/gcc-6/changes.html
I saw that yesterday as it happens, very cool too :)

Thanks a lot for your help on this, John, and for jumping onto the Github issue as well. It looks like we're now well on our way to being able to "officially support" the Intel compiler for our codebase. Which is nice :-) Best wishes! On Sat, May 7, 2016 at 12:09 AM, John Maddock <jz.maddock@googlemail.com> wrote:
On 06/05/2016 20:17, Bob Summerwill wrote:
I am a developer on the Ethereum C++ client ( https://github.com/ethereum/webthree-umbrella) and have been working with an external developer on adding support to the codebase for building with the Intel Compiler on Ubuntu.
Here is the full log of pain :-)
https://github.com/ethereum/webthree-umbrella/issues/396
We've already merged various changes, and we appear to be getting down to the real hard ones, which are now mainly clustered around build issues with boost::multiprecision and seeming limitations with the Intel compiler and
Like so:
/home/libweb3core/libdevcore/Base64.h(48): error: no suitable conversion function from
"boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<160U, 160U, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>, boost::multiprecision::et_off>" to "unsigned int" exists unsigned r = (unsigned)(a - a / 36 * 36); // boost's % is broken ^ detected during instantiation of "std::string dev::toBase36(const dev::FixedHash<N> &) [with N=20UL]" at line 114 of "/home/libethereum/libethcore/ICAP.cpp"
This appears to be the key observation:
https://github.com/ethereum/webthree-umbrella/issues/396#issuecomment-206590...
"In summary, the intel platform supports this "convert_to" member function, but does not support implicit conversion of boost multiprecision types"
Has anybody worked with Boost and the Intel compiler who might have some further insight into whether there is some way in which the Intel compiler "warts" can be handed within Boost?
Or are we stuck with these nasty diffs/workarounds?
https://github.com/ethereum/libethereum/pull/224/files https://github.com/ethereum/libweb3core/pull/68/files
It depends which compilers you want to support, (plus probably which Boost version you're using).
Your code depends on a C++11 feature - explicit conversion operators, and support for that is disabled when BOOST_MP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS is set. For Boost-1.60 and later, plus Intel 15 and later, the config for the Intel compiler is identical to the GCC version it's emulating which probably fixes the issue.... but:
* Depending how Intel C++ is installed it can end up emulating antique GCC versions which don't support the features you're using, and * There is one compiler (Oracle C++) whose support for explicit conversion operators is too broken to use anyway (internal compiler errors if the feature is enabled for Multiprecision). * And of course, default compiler mode even for GCC is still C++03 not C++11 :(
So.... if you want to support any of the above, then yes you will need to use the convert_to member via:
#ifdef BOOST_MP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
myvar = bignum.template convert_to<int>();
#else
myvar = static_cast<int>(bignum);
#endif
Hopefully that explains the situation?
John.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- bob@summerwill.net
participants (3)
-
Bob Summerwill
-
John Maddock
-
Soul Studios