Bug#848899: flint: Conflicting definition of count_leading_zeros in givaro affects flint

Tobias Hansen thansen at debian.org
Tue Dec 20 16:30:16 UTC 2016


Source: flint
Version: 2.5.2-13


Hi,

On arm64 and ppc64el sagemath fails to build while trying to compile
/«PKGBUILDDIR»/sage/src/build/cythonized/sage/matrix/matrix_mpolynomial_dense.cpp

This is the relevant error:

[sagelib-7.4] In file included from /usr/include/recint/recdefine.h:145:0,
[sagelib-7.4]                  from /usr/include/recint/ruruint.h:43,
[sagelib-7.4]                  from /usr/include/recint/rumanip.h:41,
[sagelib-7.4]                  from /usr/include/recint/ruconvert.h:43,
[sagelib-7.4]                  from /usr/include/gmp++/gmp++_int.h:26,
[sagelib-7.4]                  from /usr/include/gmp++/gmp++.h:56,
[sagelib-7.4]                  from /usr/include/givaro/givinteger.h:19,
[sagelib-7.4]                  from /usr/include/givaro/modular-int8.h:29,
[sagelib-7.4]                  from /usr/include/givaro/modular.h:21,
[sagelib-7.4]                  from
/«PKGBUILDDIR»/sage/src/build/cythonized/sage/matrix/matrix_modn_dense_double.cpp:532:
[sagelib-7.4] /usr/include/flint/flint.h: In function 'unsigned int
FLINT_BIT_COUNT(mp_limb_t)':
[sagelib-7.4] /usr/include/flint/flint.h:257:11: error: 'UWtype' was not
declared in this scope
[sagelib-7.4]     if (x) count_leading_zeros(zeros, x);
[sagelib-7.4]            ^
[sagelib-7.4] /usr/include/flint/flint.h:257:11: note: suggested
alternative:
[sagelib-7.4] In file included from /usr/include/recint/ruruint.h:43:0,
[sagelib-7.4]                  from /usr/include/recint/rumanip.h:41,
[sagelib-7.4]                  from /usr/include/recint/ruconvert.h:43,
[sagelib-7.4]                  from /usr/include/gmp++/gmp++_int.h:26,
[sagelib-7.4]                  from /usr/include/gmp++/gmp++.h:56,
[sagelib-7.4]                  from /usr/include/givaro/givinteger.h:19,
[sagelib-7.4]                  from /usr/include/givaro/modular-int8.h:29,
[sagelib-7.4]                  from /usr/include/givaro/modular.h:21,
[sagelib-7.4]                  from
/«PKGBUILDDIR»/sage/src/build/cythonized/sage/matrix/matrix_modn_dense_double.cpp:532:
[sagelib-7.4] /usr/include/recint/recdefine.h:127:22: note:  
'RecInt::UWtype'
[sagelib-7.4]      typedef uint64_t UWtype;
[sagelib-7.4]                       ^~~~~~


count_leading_zeros is defined in flints longlong.h. There are several
architecture specific implementations and then in the end this:

#ifndef count_leading_zeros
#define count_leading_zeros(count, x)    
...
and similar for count_trailing_zeros.

In our case it seems that count_leading_zeros was already defined in
givaros reclonglong.h so if there is not architecture specific
implementation in longlong.h, the fallback does not work. For the logic
to work we can put in the beginning of longlong.h:

#undef count_leading_zeros
#undef count_trailing_zeros

I didn't test it yet.

Best,
Tobias



More information about the debian-science-maintainers mailing list