Raise boost baseline version check?

Stephan Bergmann sbergman at redhat.com
Thu May 4 07:11:38 UTC 2017


On 05/04/2017 07:59 AM, David Ostrovsky wrote:
> Building LO on OpenSUSE 42.2, against the latest available system
> boost library (1.54.0), is failing here with:
> 
> /home/davido/projects/libo/tools/source/generic/fract.cxx:183:25:
> error: ‘boost::integer’ has not been declared
>           T gcd1 = boost::integer::gcd(i.numerator(), den);
> 
> Looking into the most recent version:
> 
> http://www.boost.org/doc/libs/1_64_0/boost/rational.hpp
> 
> reveals, that this part of the code is consumed from:
> 
> #include <boost/integer/common_factor_rt.hpp> // for
> boost::integer::gcd, lcm
> 
> On 1.54 the similar line in rational.hpp read:
> 
> #include <boost/math/common_factor_rt.hpp>  // for boost::math::gcd,
> lcm
> 
> So that this diff fixed the problem here:
> 
> diff --git a/tools/source/generic/fract.cxx
> b/tools/source/generic/fract.cxx
> index bc9bef467e86..02fb711c0c84 100644
> --- a/tools/source/generic/fract.cxx
> +++ b/tools/source/generic/fract.cxx
> @@ -180,8 +180,8 @@ namespace
>           T den = r.denominator();
>   
>           // Avoid overflow and preserve normalization
> -        T gcd1 = boost::integer::gcd(i.numerator(), den);
> -        T gcd2 = boost::integer::gcd(num, i.denominator());
> +        T gcd1 = boost::math::gcd(i.numerator(), den);
> +        T gcd2 = boost::math::gcd(num, i.denominator());
>   
>           bool fail = false;
>           fail |= o3tl::checked_multiply(i.numerator() / gcd1, num /
> gcd2, num);

Looking at the most recent Boost 1.64 documentation, I don't find any 
documentation of boost::integer::gdc (at 
<http://www.boost.org/doc/libs/1_64_0/libs/integer/doc/html/index.html> 
"Boost.Integer", at least).  So it looks to me like client code should 
#include <boost/math/common_factor_rt.hpp> and use boost::math::gcd as 
documented at 
<http://www.boost.org/doc/libs/1_64_0/libs/math/doc/html/math_toolkit/run_time.html> 
"Run-time GCD & LCM Determination".


More information about the LibreOffice mailing list