#12830: Work around GCC 4.7.0 bug on ia64 and improve the GMP-ECM spkg
-------------------------------------------------------------------------------------------------------------------------------------------------+
       Reporter:  leif                                                          
                                                                 |         
Owner:  leif          
           Type:  enhancement                                                   
                                                                 |        
Status:  needs_review  
       Priority:  blocker                                                       
                                                                 |     
Milestone:  sage-5.0      
      Component:  packages                                                      
                                                                 |    
Resolution:                
       Keywords:  spkg -march=native assembler error Darwin MacOS __GMP_CFLAGS 
__MPIR_CFLAGS gmp.h GCC 4.7.0 ia64 Itanium bug impossible reload  |   Work 
issues:                
Report Upstream:  N/A                                                           
                                                                 |     
Reviewers:  Jeroen Demeyer
        Authors:  Leif Leonhardy                                                
                                                                 |     Merged 
in:                
   Dependencies:                                                                
                                                                 |      
Stopgaps:                
-------------------------------------------------------------------------------------------------------------------------------------------------+
Changes (by leif):

  * status:  needs_work => needs_review


Old description:

> GCC 4.7.0 is broken on ia64 (Itanium), which also affects the GMP-ECM
> spkg (cf. #12751).
>
> ----
>
> Adding `-march=native` to `CFLAGS` may lead to assembler errors, e.g. on
> MacOS X with newer GCCs on newer CPUs (e.g. such supporting AVX, which
> Apple's assembler currently doesn't).
>
> Newer versions of MPIR don't define `__GMP_CFLAGS` (in `gmp.h`) to a
> ''string literal'', but instead to a ''preprocessor macro''
> (`__MPIR_CFLAGS`), which in turn is defined to the string we want.
>
> ----
>
> '''New spkg:'''
> [http://boxen.math.washington.edu/home/leif/Sage/spkgs/ecm-6.3.p6.spkg]
>
> '''md5sum:''' `ef29a2f1a4165bc3efc37ae7981f2b90  ecm-6.3.p6.spkg`
>

> === ecm-6.3.p6 (Leif Leonhardy, April 16th 2012) ===
>  * #12830: Add a work-around for GCC 4.7.x on ia64 (Itanium), since GMP-
> ECM
>    currently won't build with that and anything but `-O0` on that
> platform.
>  * Use `\{1,\}` instead of `\+` in `sed` patterns, which is more
> portable.
>  * Also support newer system-wide MPIR installations for printing their
>    settings.
>  * Use `patch` to apply patches.  Since the pre-patched `configure` in
>    `patches/` was created with a newer version of autotools (or, rather,
> the
>    original `configure` was created with an outdated version), the patch
> would
>    have been almost as large as the patched `configure` file itself.
> Hence
>    I `autoreconf`ed the source tree with a patched `configure.in` (and
> almost
>    the latest versions of autotools), then created a patch to `configure`
>    from the resulting file(s).  Note that therefore `src/` isn't really
> vanilla
>    any more, although just the auto-generated files differ (which are
> still
>    made from vanilla upstream sources, including `configure.in`).
>    Add a "Patches" subsection and update "Special Update/Build
> Instructions".
>    Remove files in `patches/` from `.hgignore` (and also remove pre-
> patched
>    files from that directory); the patch to `configure` and the diff of
>    `configure.in` are [now] under revision control, which IMHO makes
> sense.
>  * Beautify (and simplify) the output with respect to options passed to
>    `configure`; print the settings of a few more environment variables
> that
>    GMP-ECM uses (in case they're set); add some messages, also mention
>    `--enable-assert` etc. if `SAGE_DEBUG=yes`.
>  * Remove unused test for GCC.
>
> === ecm-6.3.p5 (Leif Leonhardy, April 11th 2012) ===
>  * #12830: Don't add `-march=native` if the assembler doesn't understand
> the
>    instructions the compiler emits with that.  (E.g. the Apple/XCode
> assembler
>    on Darwin doesn't yet support AVX.)
>  * Fix extraction of `__GMP_CC` and `__GMP_CFLAGS` (from `gmp.h`) for
> newer
>    versions of MPIR, which define these to preprocessor macros rather
> than
>    strings.
>  * Redirect warnings and error messages to `stderr`; add some messages.
>  * Correct `SPKG.txt` w.r.t. applied patches.

New description:

 GCC 4.7.0 is broken on ia64 (Itanium), which also affects the GMP-ECM spkg
 (cf. #12751).

 ----

 Adding `-march=native` to `CFLAGS` may lead to assembler errors, e.g. on
 MacOS X with newer GCCs on newer CPUs (e.g. such supporting AVX, which
 Apple's assembler currently doesn't).

 Newer versions of MPIR don't define `__GMP_CFLAGS` (in `gmp.h`) to a
 ''string literal'', but instead to a ''preprocessor macro''
 (`__MPIR_CFLAGS`), which in turn is defined to the string we want.

 ----

 '''New spkg:'''
 [http://boxen.math.washington.edu/home/leif/Sage/spkgs/ecm-6.3.p7.spkg]

 '''md5sum:''' `f171b4e4ca52dccf8da4f24aabfce394  ecm-6.3.p7.spkg`


 === ecm-6.3.p7 (Leif Leonhardy, April 19th 2012) ===
  * #12830: Add `-m[no-]power*` to the processor-specific options
 recognized;
    these are used to enable/disable specific instruction set extensions of
 the
    POWER and PowerPC (PPC) CPUs.

 === ecm-6.3.p6 (Leif Leonhardy, April 16th 2012) ===
  * #12830: Add a work-around for GCC 4.7.x on ia64 (Itanium), since GMP-
 ECM
    currently won't build with that and anything but `-O0` on that
 platform.
  * Use `\{1,\}` instead of `\+` in `sed` patterns, which is more portable.
  * Also support newer system-wide MPIR installations for printing their
    settings.
  * Use `patch` to apply patches.  Since the pre-patched `configure` in
    `patches/` was created with a newer version of autotools (or, rather,
 the
    original `configure` was created with an outdated version), the patch
 would
    have been almost as large as the patched `configure` file itself.
 Hence
    I `autoreconf`ed the source tree with a patched `configure.in` (and
 almost
    the latest versions of autotools), then created a patch to `configure`
    from the resulting file(s).  Note that therefore `src/` isn't really
 vanilla
    any more, although just the auto-generated files differ (which are
 still
    made from vanilla upstream sources, including `configure.in`).
    Add a "Patches" subsection and update "Special Update/Build
 Instructions".
    Remove files in `patches/` from `.hgignore` (and also remove pre-
 patched
    files from that directory); the patch to `configure` and the diff of
    `configure.in` are [now] under revision control, which IMHO makes
 sense.
  * Beautify (and simplify) the output with respect to options passed to
    `configure`; print the settings of a few more environment variables
 that
    GMP-ECM uses (in case they're set); add some messages, also mention
    `--enable-assert` etc. if `SAGE_DEBUG=yes`.
  * Remove unused test for GCC.

 === ecm-6.3.p5 (Leif Leonhardy, April 11th 2012) ===
  * #12830: Don't add `-march=native` if the assembler doesn't understand
 the
    instructions the compiler emits with that.  (E.g. the Apple/XCode
 assembler
    on Darwin doesn't yet support AVX.)
  * Fix extraction of `__GMP_CC` and `__GMP_CFLAGS` (from `gmp.h`) for
 newer
    versions of MPIR, which define these to preprocessor macros rather than
    strings.
  * Redirect warnings and error messages to `stderr`; add some messages.
  * Correct `SPKG.txt` w.r.t. applied patches.

--

Comment:

 Replying to [comment:16 jdemeyer]:
 > In your `case` statement:
 > {{{
 > -march=*|-mcpu=*|-mtune*)
 > }}}
 > add `-mpower*` which MPIR also uses.

 Fixed in a p7.  (I've added `-mpower*` and `-mno-power*`.)

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12830#comment:18>
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