Opened 9 years ago

Closed 9 years ago

#13150 closed enhancement (fixed)

Create an optional GCC-4.7.2 package

Reported by: jdemeyer Owned by: tbd
Priority: major Milestone: sage-5.4
Component: packages: optional Keywords:
Cc: leif Merged in:
Authors: Jeroen Demeyer Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by leif)

For testing purposes, or just to have the latest GCC, some people might prefer GCC-4.7.2 over the Sage-shipped GCC-4.6.3.

spkg: http://boxen.math.washington.edu/home/jdemeyer/spkg/gcc-4.7.2.spkg (based on the gcc-4.6.3 spkg by just bumping the src/ directory version).

md5sum: ea1018aa0020d534b830d2952ea6c7cc gcc-4.7.2.spkg

This includes all of GCC, i.e. also Java, Go, Objective-C,... compilers in addition to C, C++ and Fortran in the Sage GCC spkg.

Change History (19)

comment:1 Changed 9 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 9 years ago by leif

  • Cc leif added

comment:3 follow-up: Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:4 in reply to: ↑ 3 Changed 9 years ago by leif

Replying to jdemeyer:

This includes all of GCC, i.e. also Java, Go, Objective-C,... compilers in addition to C, C++ and Fortran in the Sage GCC spkg.

Also

The following languages will be built: c,c++,fortran,java,lto,objc
...

(Ubuntu 10.04 x86_64)

Don't know whether that's intended.

comment:5 Changed 9 years ago by leif

FWIW, R 2.14.0 still fails to build (segfault when byte-compiling package "base") with GCC 4.7.1 and -O3, like it did with [FSF GCC] 4.7.0, at least on Ubuntu x86_64.


More related to this ticket (or the GCC spkg in general), ECL somehow gets confused if the "native" GCC has libffi, and fails to build because the spkg's GCC doesn't provide it (and ECL doesn't build its own either).

But maybe my installation is somehow "messed up", or at least untypical:

While ffi.h is located in /usr/lib/gcc/x86_64-linux-gnu/4.{6.3,7.0}/include/, the libraries (including unversioned .sos) are installed in /usr/{lib,lib32}/; the original Ubuntu GCC 4.4.3 doesn't come with libffi.

Ah, while writing, I did again take a closer look at the build logs... The following should certainly get fixed:

...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... cpp-4.7.0
...
checking for ffi_closure_alloc in -lffi... yes
checking ffi/ffi.h usability... no
checking ffi/ffi.h presence... no
checking for ffi/ffi.h... no
checking ffi.h usability... no
checking ffi.h presence... yes
configure: WARNING: ffi.h: present but cannot be compiled
configure: WARNING: ffi.h:     check for missing prerequisite headers?
configure: WARNING: ffi.h: see the Autoconf documentation
configure: WARNING: ffi.h:     section "Present But Cannot Be Compiled"
configure: WARNING: ffi.h: proceeding with the preprocessor's result
configure: WARNING: ffi.h: in the future, the compiler will take precedence
checking for ffi.h... yes
checking whether we can use the existing libffi library ... yes
...
gcc -DECLDIR="\"${SAGE_ROOT}/local/lib/ecl-11.1.1\"" -I. -I${SAGE_ROOT}/spkg/build/ecl-11.1.2.cvs20111120.p1/src/build -I${SAGE_ROOT}/spkg/build/ecl-11.1.2.cvs20111120.p1/src/src/c -I../ecl/gc -DECL_API -DECL_NO_LEGACY  -march=native -O3 -DHONORS_CPPFLAGS -I${SAGE_ROOT}/local/include -I${SAGE_ROOT}/local/include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -march=native -O3 -fno-strict-aliasing -DHONORS_CFLAGS -fPIC -Dlinux -c -o ffi.o ffi.o.c
In file included from ${SAGE_ROOT}/spkg/build/ecl-11.1.2.cvs20111120.p1/src/build/ecl/ecl.h:35:0,
                 from ${SAGE_ROOT}/spkg/build/ecl-11.1.2.cvs20111120.p1/src/src/c/ffi.d:18:
${SAGE_ROOT}/spkg/build/ecl-11.1.2.cvs20111120.p1/src/build/ecl/config.h:525:17: fatal error: ffi.h: No such file or directory
compilation terminated.
make[2]: *** [ffi.o] Error 1
make[2]: Leaving directory `${SAGE_ROOT}/spkg/build/ecl-11.1.2.cvs20111120.p1/src/build/c'
make[1]: *** [libeclmin.a] Error 2
make[1]: Leaving directory `${SAGE_ROOT}/spkg/build/ecl-11.1.2.cvs20111120.p1/src/build'
make: *** [all] Error 2
Error - Failed to build ECL ... exiting

(Note the CPP setting; gcc is $SAGE_ROOT/local/bin/gcc.)

It's rather luck that only the ECL spkg is affected; we should either set CPP properly or unset it (before sage-env is called) if we're using Sage's GCC.

Similar is probably true for FC, F77 etc.:

$ ./sage --sh -c 'env | egrep -w "CC|CPP|CXX|FC|F77"' 
CPP=cpp-4.7.0
F77=gfortran-4.7.0
CXX=g++
FC=gfortran-4.7.0
CC=gcc

(I don't set F95 and the like, others may perhaps.)

comment:6 follow-up: Changed 9 years ago by leif

Looks like we just have to extend the following part of spkg/bin/sage-env:

...

# Override CC and CXX if the gcc spkg was installed.
if [ -x "$SAGE_LOCAL/bin/gcc" ]; then
    CC=gcc
fi
if [ -x "$SAGE_LOCAL/bin/g++" ]; then
    CXX=g++
fi
export CC CXX

I'm not sure how to handle Java, Objective C/C++ etc. if compilers for these get also built by Sage's GCC spkg. (I only recall some Objective C was used on MacOS X by some spkg[s].)

comment:7 Changed 9 years ago by leif

P.S.:

More problems will arise if CFLAGS et al. have been set by the user, but Sage's compiler versions don't understand / support these. In that case we may have to make excessive use of testcflags (testcxxflags, testfflags, ...?) to sort out such options, or at least exit early with an appropriate error message.

comment:8 in reply to: ↑ 6 Changed 9 years ago by leif

Replying to leif:

Looks like we just have to extend the following part of spkg/bin/sage-env:

...

# Override CC and CXX if the gcc spkg was installed.
if [ -x "$SAGE_LOCAL/bin/gcc" ]; then
    CC=gcc
fi
if [ -x "$SAGE_LOCAL/bin/g++" ]; then
    CXX=g++
fi
export CC CXX

Something along these lines:

  • spkg/bin/sage-env

    diff --git a/spkg/bin/sage-env b/spkg/bin/sage-env
    a b  
    418418if [ -z "$CXX" ]; then
    419419    CXX=g++
    420420fi
     421# We may set CPP, FC, F77 (to sage_fortran?) etc. here as well;
     422# letting at least CPP have a default value ('cpp') probably makes sense.
    421423
    422424# An Objective-C compiler is needed for R on Darwin.
    423425# On Darwin, /usr/bin/cc supports Objective-C.  The gcc shipped with
     
    431433    fi
    432434fi
    433435
    434 # Override CC and CXX if the gcc spkg was installed.
     436# Override CC, CPP, CXX, FC, F77 and F95 if the GCC spkg was installed:
     437# (We *may* also just unset FC/F77/F95 in case $SAGE_LOCAL/bin/gfortran is
     438# present.)
    435439if [ -x "$SAGE_LOCAL/bin/gcc" ]; then
    436440    CC=gcc
    437441fi
     442if [ -x "$SAGE_LOCAL/bin/cpp" ]; then
     443    CPP=cpp
     444fi
    438445if [ -x "$SAGE_LOCAL/bin/g++" ]; then
    439446    CXX=g++
    440447fi
    441 export CC CXX
     448export CC CPP CXX
     449if [ -x "$SAGE_LOCAL/bin/gfortran" ]; then
     450    for var in FC F77 F95; do
     451        export ${var}=gfortran
     452    done
     453fi
    442454
    443455
    444456if [ "$LD" = "" ]; then

Don't know whether that interferes / is consistent with the SAGE_FORTRAN variable and/or the odd sage_fortran script (which should IMHO get removed anyway).

Setting / overriding OBJC etc. may not be necessary at the moment, but certainly would make sense, too, if we build compilers for more languages (as is currently the case with the GCC 4.7.x spkg).

comment:9 Changed 9 years ago by leif

I've opened #13287 for the issue with compiler-related environment variables (not [yet] addressing potential problems with *FLAGS).

comment:10 Changed 9 years ago by jdemeyer

ping

Can this be reviewed please? This is an optional package, so it should not cause much harm.

comment:11 Changed 9 years ago by jdemeyer

  • Description modified (diff)
  • Status changed from needs_review to needs_work
  • Summary changed from Create an optional GCC-4.7.1 package to Create an optional GCC-4.7.2 package

comment:12 Changed 9 years ago by jdemeyer

  • Status changed from needs_work to needs_review

comment:13 Changed 9 years ago by vbraun

  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

Looks good to me!

comment:14 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-5.4 to sage-5.5

comment:15 Changed 9 years ago by jhpalmieri

(Never mind, I did something silly.)

Last edited 9 years ago by jhpalmieri (previous) (diff)

comment:16 Changed 9 years ago by schilly

spkg is on server + mirrors

comment:17 follow-up: Changed 9 years ago by leif

  • Description modified (diff)

Since this is an optional spkg (rather independent from releases), and is on the servers now, can we close this ticket?

comment:18 in reply to: ↑ 17 Changed 9 years ago by jdemeyer

Replying to leif:

Since this is an optional spkg (rather independent from releases), and is on the servers now, can we close this ticket?

Yes.

comment:19 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-5.5 to sage-5.4
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.