boostorg / system

Boost.org system module
http://boost.org/libs/system
35 stars 86 forks source link

When building 1.69.0 (develop, actually) with Intel ICC: expression must be a modifiable lvalue #29

Closed jeking3 closed 5 years ago

jeking3 commented 5 years ago

I am adding Intel ICC build support into boostorg/boost-ci and when I tried to build Boost.Uuid, it failed with this error:

intel-linux.compile.c++ ../../bin.v2/libs/timer/build/intel-linux/release/cxxstd-17-iso/link-static/threading-multi/visibility-hidden/cpu_timer.o
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(451): error #137: expression must be a modifiable lvalue
          val_ = val;
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(452): error #137: expression must be a modifiable lvalue
          failed_ = detail::failed_impl( val, cat );
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(453): error #137: expression must be a modifiable lvalue
          cat_ = &cat;
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(466): error #137: expression must be a modifiable lvalue
          val_ = 0;
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(467): error #137: expression must be a modifiable lvalue
          failed_ = false;
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(468): error #137: expression must be a modifiable lvalue
          cat_ = &generic_category();
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(587): error #137: expression must be a modifiable lvalue
          val_ = val;
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(588): error #137: expression must be a modifiable lvalue
          failed_ = detail::failed_impl( val, cat );
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(589): error #137: expression must be a modifiable lvalue
          cat_ = &cat;
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(602): error #137: expression must be a modifiable lvalue
          val_ = 0;
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(603): error #137: expression must be a modifiable lvalue
          failed_ = false;
          ^
In file included from ../../boost/chrono/detail/system.hpp(11),
                 from ../../boost/chrono/system_clocks.hpp(64),
                 from ../../boost/chrono/chrono.hpp(13),
                 from ../../libs/timer/src/cpu_timer.cpp(17):
../../boost/system/error_code.hpp(604): error #137: expression must be a modifiable lvalue
          cat_ = &system_category();
          ^
compilation aborted for ../../libs/timer/src/cpu_timer.cpp (code 2)

No further analysis has been done.

jeking3 commented 5 years ago

Additional Details:

The new file in Boost-CI: https://github.com/boostorg/boost-ci/blob/master/ci/travis/intelicc.sh

The pull request in Boost.Uuid (my fork): https://github.com/jeking3/uuid/pull/19

The version of Intel ICC provided by Boost.Config:

    __ICC                                   =1900
    __INTEL_COMPILER                        =1900
    __INTEL_COMPILER_BUILD_DATE             =20181018

This is part of an effort to integrate Intel ICC into Travis CI for the Boost Project. Nick Thompson made the original request and we were able to secure a license to use.

jeking3 commented 5 years ago

Note this may be a result of pre-C++17 support. I am going to see if it is limited to that, and cap the CI build so it only does C++11, C++14. If this is the case, it's likely not our issue, but if someone could take a look and confirm that would be great.

jeking3 commented 5 years ago

Scratch that, I think it's because libstdc++ is too old, fixing my work and will report...

jeking3 commented 5 years ago

Yep that was it, I forgot to update libstdc++ - issue resolved.

pdimov commented 5 years ago

I don't see how this could be caused by libstdc++. For one, Boost.System's Travis does test the default libstdc++ 4.8. For another, the error looks like the result of applying C++11's constexpr to the member function assign (in C++11 constexpr implies const), but it shouldn't, because assign should only be constexpr on C++14 and above. (https://github.com/boostorg/system/blob/develop/include/boost/system/detail/config.hpp#L32)

jeffhammond commented 5 years ago

If your default GCC is too old, you can tell ICC to use a newer one as follows. This is convenient if you don't want to override the default GCC from taking precedence in your path.

-gcc-name=<name>
          name and location of gcc if not where expected
-gxx-name=<name>
          name and location of g++ if not where expected
pdimov commented 5 years ago

I suppose it's possible that ICC sees libstdc++ 4.8 and turns on some sort of compatibility mode, as libstdc++ 4.8 is C++11 and doesn't work under C++14 (it [libstdc++ 4.8] assumes that constexpr implies const.)

jeffhammond commented 5 years ago

I would have to test to be sure, but I think there's a good chance that this is happening. ICC runs the associated GCC compiler as part of determining what it can/should support.

Was icpc -std=c++17 used here?

jeking3 commented 5 years ago

The issue was specifically that I forgot to update the libstdc++ in the build job so it remained at an older version (4.8). Once I revved it to 7.3, all was well.