Opened 2 years ago

Last modified 2 years ago

#27714 closed defect

Sagelib build error on Cygwin using system GMP — at Version 6

Reported by: embray Owned by:
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: porting: Cygwin Keywords: cygwin sagelib gmp flint
Cc: jdemeyer Merged in:
Authors: Reviewers:
Report Upstream: Fixed upstream, but not in a stable release. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by embray)

Since #27212 I get an error building sagelib:

[sagelib-8.8.beta3] gcc -shared -Wl,--enable-auto-image-base -L/home/embray/src/sagemath/sage/local/lib -Wl,-rpath,/home/embray/src/sagemath/sage/local/lib -L/home/embray/src/sagemath/sage/local/lib -Wl,-rpath,/home/embray/src/sagemath/sage/local/lib build/temp.cygwin-2.9.0-x86_64-2.7/build/cythonized/sage/ext/fast_callable.o -L/home/embray/src/sagemath/sage/local/lib -L/home/embray/src/sagemath/sage/local/lib/python2.7/config -L/home/embray/src/sagemath/sage/local/lib -lpython2.7 -o build/lib.cygwin-2.9.0-x86_64-2.7/sage/ext/fast_callable.dll
[sagelib-8.8.beta3] build/cythonized/sage/data_structures/bounded_integer_sequences.c:3442:29: error: conflicting types for ‘__pyx_f_4sage_15data_structures_25bounded_integer_sequences_limb_one_set_bit’
[sagelib-8.8.beta3]  static CYTHON_INLINE mp_limb_t __pyx_f_4sage_15data_structures_25bounded_integer_sequences_limb_one_set_bit(mp_bitcnt_t __pyx_v_n) {
[sagelib-8.8.beta3]                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[sagelib-8.8.beta3] build/cythonized/sage/data_structures/bounded_integer_sequences.c:3170:29: note: previous declaration of ‘__pyx_f_4sage_15data_structures_25bounded_integer_sequences_limb_one_set_bit’ was here
[sagelib-8.8.beta3]  static CYTHON_INLINE mp_limb_t __pyx_f_4sage_15data_structures_25bounded_integer_sequences_limb_one_set_bit(mp_bitcnt_t); /*proto*/
[sagelib-8.8.beta3]                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

followed by a long string of similar errors in the same module.

This is probably similar to the error fixed in #27713 but a different manifestation thereof:

In sage/libs/gmp/types.pxd we have:

    ctypedef unsigned long mp_limb_t
    ctypedef long mp_limb_signed_t

when in fact the definitions of these types can be platform-dependent. Not sure what best to do about this.

Upstream PR: https://github.com/wbhart/flint2/pull/557

Change History (6)

comment:1 Changed 2 years ago by embray

  • Cc jdemeyer added
  • Description modified (diff)

comment:2 Changed 2 years ago by embray

Hmm, changing these ctypedefs to what I actually have in my gmp.h does not seem to fix it. If my reading of the Cython docs is correct this actually should't matter anyways: It's still going to output literally mp_limb_t to the C code and does not redefine it in any way.

The "conflicting types" error first appears just after

/* Late includes */
#include "macros.h"
#include "string_impl.h"
#include "flint/flint.h"
#include "flint/fmpz.h"
#include "cython_metaclass.h"

so I wonder if one of these is somehow responsible.

comment:3 Changed 2 years ago by embray

  • Keywords flint added

I traced the problem to this line in flint.h:

#define mp_bitcnt_t ulong

I have no idea why it would do this, but it's almost certainly wrong.

comment:4 Changed 2 years ago by embray

Added 10 years ago for no readily apparent reason in https://github.com/wbhart/flint2/commit/f988d3eaab92ad477fe73cb346060fc0b700c566

Later it was changed to #define mp_bitcnt_t ulong in a mass rename. But flint's ulong type is defined in terms of mp_limb_t hence the breakage.

comment:5 Changed 2 years ago by embray

  • Description modified (diff)
  • Report Upstream changed from N/A to Reported upstream. No feedback yet.

comment:6 Changed 2 years ago by embray

  • Description modified (diff)
Note: See TracTickets for help on using tickets.