#11246: flint-1.5.0.p5's extraneous #includes break typedef ulong in sys/types.h
-----------------------------------+----------------------------------------
   Reporter:  dimpase              |          Owner:  tbd           
       Type:  defect               |         Status:  needs_work    
   Priority:  major                |      Milestone:  sage-4.7.2    
  Component:  packages             |       Keywords:  cygwin        
Work_issues:                       |       Upstream:  N/A           
   Reviewer:  Karl-Dieter Crisman  |         Author:  Dima Pasechnik
     Merged:                       |   Dependencies:                
-----------------------------------+----------------------------------------
Description changed by jdemeyer:

Old description:

> flint-1.5.0.p5 does not build on a recent Cygwin (1.7.9)
> due to Cygwin having ulong defined as type in
> /usr/include/sys/types.h. This results in
> {{{
> gcc -std=c99 -I/home/dima/sage-4.7.alpha5/local/include/
> -I/home/dima/sage-4.7.a
> lpha5/local/include  -fPIC -funroll-loops   -O2 -c ZmodF_mul.c -o
> ZmodF_mul.o
> ZmodF_mul.c:1: warning: -fPIC ignored for target (all code is position
> independe
> nt)
> In file included from /usr/include/stdio.h:46,
>                  from ZmodF_poly.h:40,
>                  from ZmodF_mul.c:34:
> /usr/include/sys/types.h:101: error: duplicate `unsigned'
> make[2]: *** [ZmodF_mul.o] Error 1
> }}}
> note that
> /usr/include/sys/types.h:101
> is
> {{{
> typedef unsigned long   ulong;          /* System V compatibility */
> }}}
>
> ulong is a macro in flint, defined in two places, for some reason:
> in flint.h and in profiler.h
>
> The patched spkg is in
> http://boxen.math.washington.edu/home/dima/packages/flint-1.5.0.p6.spkg
>
> Cause:
>
> The header inclusion order in ZmodF_mul.c
> does #include ZmodF_poly.h (which includes stdio.h, which in turn
> includes sys/types.h containing the typedef for ulong)
> after ZmodF.h, which includes flint.h containing #define ulong
> Thus the typedef is nuked, and there is no way around it with the
> given header order.
>
> The 1st bug is in ZmodF_mul.c, which does not need to include ZmodF.h
> at all,
> as it is included in ZmodF_poly.h
>
> The 2nd bug like this is in mpn_extras.h, where the inclusion of
> flint.h is not needed
> ---and this nukes ZmodF_mul-tuning.c
>
> The 3rd bug like this is in ZmodF_poly.c, which needs to include
> neither flint.h nor memory-manager.h
>
> See http://groups.google.com/group/sage-
> windows/browse_thread/thread/294895626ba6faf1
>
> The patches in the spkg are as follows:
> {{{
> --- src/mpn_extras.h    2009-09-23 18:03:27.000000000 +0800
> +++ patches/mpn_extras.h        2011-04-25 22:36:33.000000000 +0800
> @@ -22,7 +22,6 @@
>  #ifndef MPN_EXTRAS_H
>  #define MPN_EXTRAS_H
>
> -#include "flint.h"
>  #include "ZmodF_poly.h"
>
>  #include "longlong_wrapper.h"
>
> --- src/ZmodF_poly.c    2009-09-23 18:03:27.000000000 +0800
> +++ patches/ZmodF_poly.c        2011-04-25 22:37:17.000000000 +0800
> @@ -29,8 +29,6 @@
>
> *****************************************************************************/
>
> -#include "flint.h"
> -#include "memory-manager.h"
>  #include "ZmodF_poly.h"
>  #include "ZmodF_mul.h"
>  #include "fmpz_poly.h"
>
> --- src/ZmodF_mul.c     2009-09-23 18:03:27.000000000 +0800
> +++ patches/ZmodF_mul.c 2011-04-25 22:32:40.000000000 +0800
> @@ -30,7 +30,6 @@
> ******************************************************************************/
>
>  #include <math.h>
> -#include "ZmodF.h"
>  #include "ZmodF_poly.h"
>  #include "ZmodF_mul.h"
>  #include "mpn_extras.h"
> }}}
>
> tested on Linux (x64-86), MacOSX 10.6, and Cygwin (1.7.9)

New description:

 flint-1.5.0.p5 does not build on a recent Cygwin (1.7.9)
 due to Cygwin having ulong defined as type in
 /usr/include/sys/types.h. This results in
 {{{
 gcc -std=c99 -I/home/dima/sage-4.7.alpha5/local/include/
 -I/home/dima/sage-4.7.a
 lpha5/local/include  -fPIC -funroll-loops   -O2 -c ZmodF_mul.c -o
 ZmodF_mul.o
 ZmodF_mul.c:1: warning: -fPIC ignored for target (all code is position
 independe
 nt)
 In file included from /usr/include/stdio.h:46,
                  from ZmodF_poly.h:40,
                  from ZmodF_mul.c:34:
 /usr/include/sys/types.h:101: error: duplicate `unsigned'
 make[2]: *** [ZmodF_mul.o] Error 1
 }}}
 note that
 /usr/include/sys/types.h:101
 is
 {{{
 typedef unsigned long   ulong;          /* System V compatibility */
 }}}

 ulong is a macro in flint, defined in two places, for some reason:
 in flint.h and in profiler.h

 Cause:

 The header inclusion order in ZmodF_mul.c
 does #include ZmodF_poly.h (which includes stdio.h, which in turn
 includes sys/types.h containing the typedef for ulong)
 after ZmodF.h, which includes flint.h containing #define ulong
 Thus the typedef is nuked, and there is no way around it with the
 given header order.

 The 1st bug is in ZmodF_mul.c, which does not need to include ZmodF.h
 at all,
 as it is included in ZmodF_poly.h

 The 2nd bug like this is in mpn_extras.h, where the inclusion of
 flint.h is not needed
 ---and this nukes ZmodF_mul-tuning.c

 The 3rd bug like this is in ZmodF_poly.c, which needs to include
 neither flint.h nor memory-manager.h

 See http://groups.google.com/group/sage-
 windows/browse_thread/thread/294895626ba6faf1

 New spkg:
 [http://boxen.math.washington.edu/home/jdemeyer/spkg/flint-1.5.0.p7.spkg]

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11246#comment:36>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to