Ticket #12765 (closed defect: duplicate)

Opened 14 months ago

Last modified 13 months ago

MPIR doesn't compile with GCC-4.7.0 on ia64

Reported by: jdemeyer Owned by: tbd
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: packages: standard Keywords:
Cc: Work issues:
Report Upstream: Reported upstream. Developers acknowledge bug. Reviewers: Jeroen Demeyer
Authors: Merged in:
Dependencies: Stopgaps:

Description (last modified by jdemeyer) (diff)

On Skynet iras (SUSE ES10 ia64):

Host system:
Linux iras 2.6.16.46-0.12-default #1 SMP Thu May 17 14:00:09 UTC 2007 ia64 ia64 ia64 GNU/Linux
****************************************************
C compiler: gcc
C compiler version:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7.0/ia64-Linux-suse/libexec/gcc/ia64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: ia64-unknown-linux-gnu
Configured with: /usr/local/gcc-4.7.0/src/gcc-4.7.0/configure --enable-languages=c,c++,fortran --with-gnu-as --with-as=/usr/local/binutils
-2.22/ia64-Linux-suse-gcc-4.6.2/bin/as --with-gnu-ld --with-ld=/usr/local/binutils-2.22/ia64-Linux-suse-gcc-4.6.2/bin/ld --with-gmp=/usr/l
ocal/mpir-2.5.1/ia64-Linux-suse-gcc-4.6.2 --with-mpfr=/usr/local/mpfr-3.1.0/ia64-Linux-suse-mpir-2.5.1-gcc-4.6.2 --with-mpc=/usr/local/mpc
-0.9/ia64-Linux-suse-mpir-2.5.1-mpfr-3.1.0-gcc-4.6.2 --prefix=/usr/local/gcc-4.7.0/ia64-Linux-suse
Thread model: posix
gcc version 4.7.0 (GCC)
****************************************************
Your compiler does not support '-m32' nor '-m64'.  Leaving ABI unset.
Checking what CFLAGS MPIR would use if they were empty...
Settings chosen by MPIR when configuring with CFLAGS unset:
  CC:      gcc
  CFLAGS:  -O2
Settings required to properly build MPIR, taking into account SAGE_DEBUG etc.:
  CFLAGS:
  LDFLAGS:  -Wl,-z,noexecstack
  ABI:
Settings from the "global" environment:
  CC:      gcc
  CFLAGS:
  (CPPFLAGS, CXX and CXXFLAGS are listed below; these don't get modified.)
Using MPIR's settings (plus mandatory ones).
Finally using the following settings:
  CC=gcc
  CFLAGS=-O2
  CPPFLAGS=
  CXX=g++
  CXXFLAGS=
  LDFLAGS= -Wl,-z,noexecstack
  ABI=
(These settings may still get overridden by 'configure' or Makefiles.)
Configuring MPIR with the following options:
    --prefix="/home/jdemeyer/iras/sage-5.0.beta8-gcc/local" --enable-shared --enable-static --enable-gmpcompat --enable-cxx=yes --libdir=/
home/jdemeyer/iras/sage-5.0.beta8-gcc/local/lib
[...]
/bin/sh ../libtool --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo divrem_eucl
idean_r_1 | sed 's/_$//'`    -O2   -c -o divrem_euclidean_r_1.lo divrem_euclidean_r_1.c
 gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_divrem_euclidean_r_1 -O2 -c divrem_euclidean_r_1.c  -fPIC -DP
IC -o .libs/divrem_euclidean_r_1.o
divrem_euclidean_r_1.c: In function '__gmpn_mod_1_k':
divrem_euclidean_r_1.c:157:5: error: 'asm' operand requires impossible reload
make[2]: *** [divrem_euclidean_r_1.lo] Error 1
make[2]: Leaving directory `/home/jdemeyer/iras/sage-5.0.beta8-gcc/spkg/build/mpir-2.1.3.p9/src/mpn'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jdemeyer/iras/sage-5.0.beta8-gcc/spkg/build/mpir-2.1.3.p9/src'
make: *** [all] Error 2
Error building MPIR.

This is likely a GCC bug, see  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496

There is a work-around (by essentially disabling all optimization) spkg at #11616.

See #12751 for the GCC-4.7.0 metaticket.

Change History

comment:1 Changed 14 months ago by jdemeyer

  • Description modified (diff)

comment:2 Changed 14 months ago by jdemeyer

  • Description modified (diff)
  • Report Upstream changed from N/A to Reported upstream. Little or no feedback.

comment:3 Changed 14 months ago by jdemeyer

  • Description modified (diff)
  • Report Upstream changed from Reported upstream. Little or no feedback. to Fixed upstream, but not in a stable release.

comment:4 follow-ups: ↓ 5 ↓ 20 Changed 14 months ago by leif

Doesn't look like they've already fixed this upstream, they only work around the problem in libffi.

Or did you test some svn version?

comment:5 in reply to: ↑ 4 Changed 14 months ago by jdemeyer

Replying to leif:

Doesn't look like they've already fixed this upstream, they only work around the problem in libffi.

Or did you test some svn version?

I haven't tested anything, I just believed the GCC Bugzilla.

comment:6 Changed 14 months ago by leif

The MPIR 2.4.0.p2 spkg at #11616 now includes a work-around for this bug (almost completely disabling optimization on Linux ia64 with GCC 4.7.x).

comment:7 follow-up: ↓ 10 Changed 14 months ago by leif

Looks like we'd have the same problem with NTL:

...
g++ -I../include -I.  -O2 -g -O3 -g -DHONORS_CXXFLAGS  -fPIC -c  FFT.c
In file included from ../include/NTL/ZZ.h:1804:0,
                 from ../include/NTL/FFT.h:7,
                 from FFT.c:3:
../include/NTL/SPMM_ASM.h: In function ‘void NTL::FFT(long int*, const long int*, long int, long int, const long int*)’:
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
make[3]: *** [FFT.o] Error 1
make[3]: Leaving directory `/home/leif/Sage/release/build/iras/sage-5.0.beta12-gcc-4.7.0/spkg/build/ntl-5.5.2/src/src'
make[2]: *** [libntl.so] Error 2
make[2]: Leaving directory `/home/leif/Sage/release/build/iras/sage-5.0.beta12-gcc-4.7.0/spkg/build/ntl-5.5.2/src/src'
Error creating ntl shared library.
...

comment:8 follow-up: ↓ 9 Changed 14 months ago by leif

... also zn_poly.

comment:9 in reply to: ↑ 8 ; follow-up: ↓ 11 Changed 14 months ago by leif

Replying to leif:

... also zn_poly.

And overrides -O0 ... in CFLAGS with -O3... >8(

comment:10 in reply to: ↑ 7 Changed 14 months ago by leif

Replying to leif:

Looks like we'd have the same problem with NTL:

...
g++ -I../include -I.  -O2 -g -O3 -g -DHONORS_CXXFLAGS  -fPIC -c  FFT.c
In file included from ../include/NTL/ZZ.h:1804:0,
                 from ../include/NTL/FFT.h:7,
                 from FFT.c:3:
../include/NTL/SPMM_ASM.h: In function ‘void NTL::FFT(long int*, const long int*, long int, long int, const long int*)’:
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
../include/NTL/SPMM_ASM.h:103:69: error: ‘asm’ operand requires impossible reload
make[3]: *** [FFT.o] Error 1
make[3]: Leaving directory `/home/leif/Sage/release/build/iras/sage-5.0.beta12-gcc-4.7.0/spkg/build/ntl-5.5.2/src/src'
make[2]: *** [libntl.so] Error 2
make[2]: Leaving directory `/home/leif/Sage/release/build/iras/sage-5.0.beta12-gcc-4.7.0/spkg/build/ntl-5.5.2/src/src'
Error creating ntl shared library.
...

Despite that, after a second try with -fno-strict-aliasing -O3 (and again at least parts of these errors), the spkg is reported to have successfully been installed... ?

comment:11 in reply to: ↑ 9 ; follow-up: ↓ 21 Changed 14 months ago by leif

Replying to leif:

Replying to leif:

... also zn_poly.

And overrides -O0 ... in CFLAGS with -O3... >8(

And that's not upstream. From spkg-install (which is a mess):

...
CFLAGS="$CFLAGS -g -fPIC -O3 -L."; export CFLAGS
LDFLAGS="$LDFLAGS"; export LDFLAGS
...

OMG.

comment:12 Changed 14 months ago by leif

Furthermore: GMP-ECM, FLINT, MPFR and PARI.

comment:13 follow-up: ↓ 14 Changed 14 months ago by leif

Jeroen, should I open separate (GCC 4.7 on ia64) tickets for these, or perhaps just one meta-ticket?

FLINT and zn_poly are currently "under construction" anyway; Andrew Ohana slightly fixed these just to respect CC and CXX for the clang port, so we could also do (little) changes on those open tickets.

(For FLINT there's also the ARM port ticket, which upgrades to 1.5.2 and thereby makes a couple of changes unnecessary, or at least different, with less effort. I also have an old, broadly cleaned-up FLINT 1.5.2 spkg, which I believe would need some work, at least some rebasing.)

[GMP-ECM, MPFR and PARI seem to build with -O0 [-finline-functions -fschedule-insns] in C/CPP/CXXFLAGS, without further changes to their spkg-install or Makefiles etc.; haven't yet tried with SAGE_CHECK=yes though.]

comment:14 in reply to: ↑ 13 Changed 14 months ago by jdemeyer

Replying to leif:

Jeroen, should I open separate (GCC 4.7 on ia64) tickets for these, or perhaps just one meta-ticket?

To be honest, I don't care too much about these issues... It makes more sense to open a ticket to blacklist GCC-4.7.0 on ia64, i.e. build Sage's GCC-4.6.3 in this case.

I'm currently building an svn version of GCC-4.7.x to see whether the problem is fixed.

comment:15 follow-up: ↓ 16 Changed 14 months ago by jdemeyer

MPFR though is a dependency for GCC, so that's more important.

comment:16 in reply to: ↑ 15 Changed 14 months ago by leif

Replying to jdemeyer:

MPFR though is a dependency for GCC, so that's more important.

Yep.

comment:17 follow-up: ↓ 19 Changed 14 months ago by leif

This one is more funny:

...
g++: error: unrecognized command line option ‘-m64’
make[2]: *** [gfan] Error 1
make[2]: Leaving directory `/home/leif/Sage/release/build/iras/sage-5.0.beta12-gcc-4.7.0/spkg/build/gfan-0.4plus.p2/src'
Error building gfan.
...

comment:18 Changed 14 months ago by jdemeyer

That's weird because GCC on ia64 never supported -m64 AFAIK. So it should fail with any GCC version.

comment:19 in reply to: ↑ 17 Changed 14 months ago by leif

Replying to leif:

This one is more funny:

...
g++: error: unrecognized command line option ‘-m64’
make[2]: *** [gfan] Error 1
make[2]: Leaving directory `/home/leif/Sage/release/build/iras/sage-5.0.beta12-gcc-4.7.0/spkg/build/gfan-0.4plus.p2/src'
Error building gfan.
...

The funniest thing being that that is my fault... B)

(since I made the p2, apparently without looking at the patched Makefile, and without testing on non-x86_64 systems)

comment:20 in reply to: ↑ 4 Changed 14 months ago by jdemeyer

  • Report Upstream changed from Fixed upstream, but not in a stable release. to Reported upstream. Developers acknowledge bug.

Replying to leif:

Doesn't look like they've already fixed this upstream, they only work around the problem in libffi.

You are right, it is not fixed upsteam (I tried the latest svn version of the 4.7 branch on cleo).

comment:21 in reply to: ↑ 11 Changed 13 months ago by leif

Replying to leif:

Replying to leif:

Replying to leif:

... also zn_poly.

And overrides -O0 ... in CFLAGS with -O3... >8(

And that's not upstream. From spkg-install (which is a mess):

...
CFLAGS="$CFLAGS -g -fPIC -O3 -L."; export CFLAGS
LDFLAGS="$LDFLAGS"; export LDFLAGS
...

OMG.

Forgot: A fixed zn_poly spkg (not yet taking care of GCC 4.7.0 on ia64 IIRC) is available at #12433, still needing review. (The main purpose of that ticket was to make zn_poly respect CC etc.; it now also does a major clean-up.)

comment:22 Changed 13 months ago by jdemeyer

  • Status changed from new to closed
  • Reviewers set to Jeroen Demeyer
  • Resolution set to duplicate
  • Description modified (diff)
  • Milestone changed from sage-5.0 to sage-duplicate/invalid/wontfix
Note: See TracTickets for help on using tickets.