ecm: Elliptic curve method for integer factorization


GMP-ECM - Elliptic Curve Method for Integer Factorization

Sources can be obtained from



Upstream Contact


  • GMP/MPIR (Note: Python is *not* required for ordinary builds.)

  • GNU patch

Special Update/Build Instructions

  • GMP-ECM comes with a self-tuning feature; we could support that as an option ($SAGE_TUNE_*=yes) in the future.

  • ECM currently does not (by itself) use the CC and CFLAGS settings from ‘gmp.h’ since we pass (other) options in CFLAGS, and CC is set by Sage and might got set by the user. We now at least partially fix that such that “optimized” code generation options (‘-mcpu=…’, ‘-mtune=…’) are used by gcc. Of course a user can also manually enable them by setting the “global” CFLAGS to e.g. ‘-march=native’ on x86[_64] systems, or ‘-mcpu=…’ and ‘-mtune=…’ on other architectures where “native” isn’t supported. Note that this doesn’t affect the packages’ selection of processor- specific optimized [assembly] code. ‘spkg-install’ already reads the settings from Sage’s and also a system-wide GMP / MPIR now, but doesn’t (yet) use all of them. If SAGE_FAT_BINARY=”yes”, we should avoid too specific settings of “-mcpu=…”, and perhaps pass a more generic “–host=…” to ‘configure’. (MPIR honors ‘–enable-fat’ to some extent, but this option isn’t used on anything other than x86 / x86_64.)

  • We currently work around a linker bug on MacOS X 10.5 PPC (with GCC 4.2.1) which breaks ‘configure’ if debug symbols are enabled. This *might* get fixed in later upstream releases.

  • We could save some space by removing the src/build.vc10/ directory which isn’t used in Sage. (It gets probably more worth in case also directories / files for later versions of Microsoft Visual C get added.)



Version Information



Equivalent System Packages


$ conda install ecm-devel


$ sudo apt-get install  ecm-devel


$ sudo yum install  ecm-devel


$ sudo pkg install ecm-devel

macports: install the following packages: ecm-devel nix:

$ nix-env --install ecm-devel


$ sudo xbps-install  ecm-devel


If the system package is installed, ./configure will check whether it can be used.