#10252: ecm does not compile on some 32-bit Linux systems
------------------------+---------------------------------------------------
   Reporter:  jdemeyer  |       Owner:  tbd             
       Type:  defect    |      Status:  needs_info      
   Priority:  major     |   Milestone:  sage-4.6.1      
  Component:  packages  |    Keywords:  ecm spkg-install
     Author:            |    Upstream:  N/A             
   Reviewer:            |      Merged:                  
Work_issues:            |  
------------------------+---------------------------------------------------
Changes (by leif):

  * status:  new => needs_info


Comment:

 So we at least still have the problem of adding `-m64` if `SAGE64=yes`
 (i.e., if we want a 64-bit build on systems that default to 32-bit
 builds):
 {{{
 #!sh
 ...
 # Note that GMP-ECM is written in C (and assembler) - no C++ sources.

 if [ "$SAGE64" = yes ]; then
     echo "Building a 64-bit version of GMP-ECM"
     if [ -z "$CFLAG64" ]; then
         CFLAG64=-m64
     fi
     CFLAGS="$CFLAGS $CFLAG64 -fPIC"
     LDFLAGS="$CFLAG64"; export LDFLAGS
 else
     CFLAGS="$CFLAGS -fPIC"
 fi

 # We add debug symbols by default;
 if [ "$SAGE_DEBUG" = yes ]; then
     # Disable optimization:
     CFLAGS="$CFLAGS -g -O0"
 else
     # Enable optimization, may be overridden by user settings:
     CFLAGS="-g -O3 $CFLAGS"
 fi

 export CFLAGS # usually redundant, but safe(r)
 ...
 }}}

 Of course I could add "our" (or worse, also ''any user-specified'')
 `CFLAGS` to `CC`, i.e. the C compiler command, and `unset CFLAGS` to make
 ECM's effective, but I wouldn't like that. (And some settings then would
 get overridden by ECM's `CFLAGS` anyway.)

 ----

 An IMHO better solution is to also add `-march=native` to `CFLAGS`, since
 this enables SSE (to be precise, allows SSE2 instructions) if supported by
 the processor (when `configure` defines `HAVE_SSE2`), ignoring
 `SAGE_FAT_BINARY` at least for the moment (unless ECM's `configure` has an
 option like `--disable-sse` or similar; I haven't really checked that yet,
 perhaps just `--enable-sse2=no` on ''32-bit'' x86).

 [[BR]]

 I'm not sure what happens if we configure with `CFLAGS` set and `--enable-
 gmp-cflags=no` (which seems to be more appropriate when using ECM with
 MPIR).

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