0
votes

I am running into a strange compilation issue. Any help in resolving it would be greatly appreciated. I am linking my application against the boost libraries. I need to compile my app on both Centos and Ubuntu. Everything works fine on Ubuntu and the same code fails to compile on Centos 7. The location of the error is in boost. Not sure if the issue is actually in boost or if something else is causing the error to be show up in boost. I've come across this link when I searched the error. However, that issue was for an older version of boost. I've listed error output below:

        /usr/local/include/boost/chrono/duration.hpp: In function 'constexpr typename boost::enable_if<boost::mpl::and_<boost::is_convertible<Rep1, typename boost::common_type<Rep1, Rep2>::type>, boost::is_convertible<Rep2, typename boost::common_type<Rep1, Rep2>::type> >, boost::chrono::duration<typename boost::common_type<Rep1, Rep2>::type, Period> >::type boost::chrono::operator*(const boost::chrono::duration<Rep, Period>&, const Rep2&)':
In file included from /usr/local/include/boost/chrono/time_point.hpp:33:0,
                 from /usr/local/include/boost/thread/lock_types.hpp:22,
                 from /usr/local/include/boost/thread/lock_algorithms.hpp:11,
                 from /usr/local/include/boost/thread/locks.hpp:10,
    ...
    /usr/local/include/boost/chrono/duration.hpp:575:34: error: type/value mismatch at argument 1 in template parameter list for 'template<class Rep, class Period> class boost::chrono::duration'
           typedef duration<CR, Period> CD;
                                      ^
    /usr/local/include/boost/chrono/duration.hpp:575:34: error:   expected a type, got '13u'
    /usr/local/include/boost/chrono/duration.hpp:575:38: error: invalid type in declaration before ';' token
           typedef duration<CR, Period> CD;

Corresponding code from /usr/local/include/boost/chrono/duration.hpp:

    // Duration *

template <class Rep1, class Period, class Rep2>
inline BOOST_CONSTEXPR
typename boost::enable_if <
    mpl::and_ <
    boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>,
    boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>
    >,
    duration<typename common_type<Rep1, Rep2>::type, Period>
>::type
operator*(const duration<Rep1, Period>& d, const Rep2& s)
{
  typedef typename common_type<Rep1, Rep2>::type CR;
  typedef duration<CR, Period> CD;
  return CD(CD(d).count()*static_cast<CR>(s));
}

I get this error on Centos7. Does not happen on Ubuntu.

Centos Version:

Boost: 1.58.0, OS: Centos 7, C++: g++ 4.8.5

Ubuntu Versions:

Boost: 1.58.0, OS: Ubuntu 16.04, C++: g++ 5.4.0

Not sure if the C++ compiler difference is the issue. The default version of c++ compiler on Centos7 is 4.8.5. BTW, the default boost version on CentOS7 is 1.53.2. I compiled and installed boost 1.58.0 version to minimize the variables. Any help is greatly appreciated. Thanks.

1

1 Answers

0
votes

My guess (and that's all it is, a guess) based on the error message is that somewhere you've got:

#define CR 13u

and that's causing the compilation error.