Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fine-tune auto-detection of whether to install GCC #12825

Closed
jdemeyer opened this issue Apr 10, 2012 · 22 comments
Closed

Fine-tune auto-detection of whether to install GCC #12825

jdemeyer opened this issue Apr 10, 2012 · 22 comments

Comments

@jdemeyer
Copy link

  1. GCC-4.7.x on ia64 is very broken. We should install GCC in this case. Note that currently it won't actually work as MPIR and MPFR fail to build with gcc-4.7.x on ia64. For MPIR, see Upgrade MPIR to a more recent upstream release #11616; for MPFR, see MPFR doesn't compile with GCC-4.7.0 on ia64 #12837.

  2. When Debian multiarch is detected, do not install GCC. The stderr of "gcc -v -E -x c /dev/null" says:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) 
COLLECT_GCC_OPTIONS='-v' '-c' '-mtune=generic' '-march=x86-64'
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1 -quiet -v /dev/null -D_FORTIFY_SOURCE=2 -quiet -dumpbase null -mtune=generic -march=x86-64 -auxbase null -version -fstack-protector -o /tmp/ccPmIBIJ.s
GNU C (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu)
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9
warning: MPFR header version 3.0.0-p8 differs from library version 3.0.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.

We can detect the '/usr/include/x86_64-linux-gnu' line here.

  1. Sage currently doesn't build with GCC-4.7.x, see Allow building Sage with GCC-4.7.x #12751.

Apply to SAGE_ROOT repository:

  1. attachment: 12825_detect_gcc.patch
  2. attachment: 12825_change_include_grep.patch

Component: build

Author: Jeroen Demeyer

Reviewer: Dan Drake, Leif Leonhardy

Merged: sage-5.0.beta14

Issue created by migration from https://trac.sagemath.org/ticket/12825

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link
Author

Author: Jeroen Demeyer

@jdemeyer
Copy link
Author

Attachment: 12825_detect_gcc.patch.gz

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 11, 2012

comment:3

Your grep also matches e.g.

Configured with: ... --with-gxx-include-dir=/usr/include/c++/4.6 ...

which is unrelated to multi-arch, but probably not that uncommon.

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 11, 2012

comment:4

Replying to @nexttime:

Your grep also matches e.g.

Configured with: ... --with-gxx-include-dir=/usr/include/c++/4.6 ...

which is unrelated to multi-arch, but probably not that uncommon.

Maybe a leading space or grep '[^=]/usr/include/.' is sufficient?

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 11, 2012

comment:5

Perhaps rather grep '[^=]*/usr/include/.' ...

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 11, 2012

comment:6

P.S.: I've created new spkgs for all open GCC 4.7.0 issues (except ia64 brokenness), all still needing review... (see #12751)

I could also fix the MPFR spkg (adding -O0 ... on ia64), since it is also a prerequisite for building GCC. (Btw., R -- IIRC -- fails to build on ia64 without -O0, too, but not due to an "impossible reload". ptestlong gives a single doctest error related to Singular.)

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 13, 2012

comment:8

Replying to @dandrake:

The multiarch detection works on Ubuntu 11.10, x86-64, and Ubuntu 12.04, i386. I also tested this on Arch Linux, which just upgraded to gcc 4.7, and it correctly decided to install our gcc spkg.

Note that Ubuntu 11.04 (with gcc-4.5.2) uses the multiarch stuff, and your script misses that because it looks for version 4.6.*. However, the compilation seems to work properly. (That was Ubuntu's first multiarch release, so perhaps the "old method" still worked there?) Also, I don't think we need to prioritize support for that release.

So, positive review, unless someone objects to building our gcc if the system gcc is older than 4.4.

I'd still change the grep pattern to not match typical --with-gxx-include-dir configure options.

Btw., it seems Ubuntu / Debian changed the multi-arch stuff in 12.04 such that there only setting LIBRARY_PATH would be necessary (unless one created symbolic links for crt?.o); i.e., there's now a symbolic link from /usr/include/asm/ to (e.g.) x86_64-linux-gnu/asm/. (Dan, can you confirm that? In your case it would presumably be a link to i386-linux-gnu/asm/.)


According to GCC bugzilla, the two bugs referred to for [FSF] GCC 4.6.![01] are both fixed in 4.6.1, so I'm not sure whether 4.6.1 would be [too] broken for Sage, or on which platforms.

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link
Author

Changed reviewer from Dan Drake to Dan Drake, Leif Leonhardy

@jdemeyer
Copy link
Author

comment:10

Please review attachment: 12825_change_include_grep.patch

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 14, 2012

comment:11

Added a reference to the MPFR ticket (#12837, GCC 4.7.0 on ia64 issue).

@nexttime

This comment has been minimized.

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 14, 2012

comment:12

Replying to @jdemeyer:

Please review attachment: 12825_change_include_grep.patch

Hmmm, gcc should actually be $CC, since we tested the version of the latter (and would use that one to build GCC anyway).

The grep should be ok, although the safest way would probably be to search for (literally) multiarch, which is contained in the configure options (e.g. --enable-multiarch), and/or the command line of cc1 (-imultiarch <system triplet>).


Can you elaborate in which way GCC 4.6.1 is broken for Sage?

@nexttime
Copy link
Mannequin

nexttime mannequin commented Apr 14, 2012

comment:13

We might also move the multi-arch check further down, since it is not directly related to the version of GCC. (I'd prefer fixing the GCC spkg anyway, by setting one or two environment variables.)

@jdemeyer
Copy link
Author

comment:14

Replying to @nexttime:

Can you elaborate in which way GCC 4.6.1 is broken for Sage?

GCC 4.6.1 as released doesn't have these bugs, but pre-releases of GCC-4.6.1 do still have those bugs. Basically I provided a work-around for this GCC bug in some spkg but somebody still had problems because he had a pre-release of GCC 4.6.1 (I don't know whether it came with the system or whether he installed it himself).

@jdemeyer
Copy link
Author

comment:15

Attachment: 12825_change_include_grep.patch.gz

Replying to @nexttime:

Hmmm, gcc should actually be $CC, since we tested the version of the latter (and would use that one to build GCC anyway).

Fixed.

@jdemeyer
Copy link
Author

Merged: sage-5.0.beta14

@fchapoton

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@jdemeyer @fchapoton and others