WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: gcc failing check for C89 while trying to compile gfortran  (Read 8755 times)

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
gcc failing check for C89 while trying to compile gfortran
« on: January 25, 2015, 11:53:26 PM »
I'm trying to compile gfortran in Corepure64 and am running into this problem with the make:

Code: [Select]
<snip>
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/bin/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/lib/ -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/include -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/sys-include  -m32 accepts -g... yes
checking for /home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/bin/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/lib/ -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/include -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/sys-include  -m32 option to accept ISO C89... unsupported
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/home/admin/tmp/gcc-4.7.2/x86_64-unknown-linux-gnu/32/libgcc':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/admin/tmp/gcc-4.7.2'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/admin/tmp/gcc-4.7.2'
make: *** [all] Error 2

The most recent ./configure which generated that output was:

Code: [Select]
./configure --prefix=$OUTPUT_DIR --enable-clocale=generic --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c
++,fortran --enable-c99 --enable-long-long

Does anyone know why this C89 failure is happening under Corepure64?  Under good ol' Core64 I have no problem compiling gfortran with the following sequence (and compiletc, etc):

Code: [Select]
GCC_VER=`gcc -dumpversion`
OUTPUT_DIR=~/tmp/gfortran-build/
 
mkdir -p ~/tmp
cd ~/tmp
wget http://gcc.parentingamerica.com/releases/gcc-$GCC_VER/gcc-$GCC_VER.tar.bz2
tar xjf gcc*
cd gcc*
./contrib/download_prerequisites
./configure --prefix=$OUTPUT_DIR --enable-clocale=generic --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --disable-libstdcxx-pch --enable-c99 --enable-long-long --disable-bootstrap
make

The exact same thing fails under Corepure64.  Was Corepure64's gcc compiled with some things disabled?  I thought gcc's compilation bootstrapping would prevent problems like this, but it doesn't in this case.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14801
Re: gcc failing check for C89 while trying to compile gfortran
« Reply #1 on: January 26, 2015, 01:22:09 AM »
Presumeably you're using corepure64 v5.x?

Why is gcc under /home/admin/tmp/gcc-4.7.2?

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: gcc failing check for C89 while trying to compile gfortran
« Reply #2 on: January 26, 2015, 02:03:15 AM »
Yes..  corepure64 v5.4.

I don't think that that path is the gcc in use, but is rather the new gcc that is being compiled with gfortran.  Or possibly something from one of gcc's 3-stage bootstrap layers? I don't know... for that particular build attempt I had removed -disable-bootstrap to see if bootstrapping would fix the issue.

Running compilation exactly as indicated in the script at the end of the original post (with -disable-bootstrap), I get the same problem, per below.  I've also shown the gcc in use:

Code: [Select]
admin@box:~/tmp/gcc-4.7.2$ which gcc
/usr/local/bin/gcc
admin@box:~/tmp/gcc-4.7.2$ ls -al `which cc`
lrwxrwxrwx    1 root     root            32 Jan 26 04:04 /usr/local/bin/cc -> /tmp/tcloop/gcc/usr/local/bin/cc
admin@box:~/tmp/gcc-4.7.2$
admin@box:~/tmp/gcc-4.7.2$ ./configure --prefix=$OUTPUT_DIR --enable-clocale=generic --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --disable-libstdcxx-pch --enable-c99 --enable-long-long --disable-bootstrap
<snip>
<snip>
<snip>
checking whether ln -s works... yes
checking for x86_64-unknown-linux-gnu-gcc... /home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/bin/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/lib/ -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/include -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/sys-include  -m32
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/bin/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/lib/ -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/include -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/sys-include  -m32 accepts -g... yes
checking for /home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/home/admin/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/bin/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/lib/ -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/include -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/sys-include  -m32 option to accept ISO C89... unsupported
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/home/admin/tmp/gcc-4.7.2/x86_64-unknown-linux-gnu/32/libgcc':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/home/admin/tmp/gcc-4.7.2'
make: *** [all] Error 2
admin@box:~/tmp/gcc-4.7.2$
admin@box:~/tmp/gcc-4.7.2$
admin@box:~/tmp/gcc-4.7.2$ which gcc
/usr/local/bin/gcc
admin@box:~/tmp/gcc-4.7.2$ ls -al `which cc`
lrwxrwxrwx    1 root     root            32 Jan 26 04:04 /usr/local/bin/cc -> /tmp/tcloop/gcc/usr/local/bin/cc

Also note that, with the script in the first post, intent is to compile the gfortran version that exactly matches the gcc in the tce repo used to compile other stuff.  Not sure if this is required, but it seems like the safest bet.

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: gcc failing check for C89 while trying to compile gfortran
« Reply #3 on: January 26, 2015, 02:18:56 AM »
In case it was affecting things, I tried stripping c and c++ from the enabled languages (leaving --enable-languages=fortran), in case they are contaminating somehow, but the exact same problem occurs.

I don't understand why this happens on corepure64 but not core64.

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: gcc failing check for C89 while trying to compile gfortran
« Reply #4 on: January 26, 2015, 09:45:22 AM »
Even weirder, I've just seen that the C89 check passes several times earlier in the make.  It fails quite late in the process:

Code: [Select]
admin@box:/mnt/sda1/tmp/gcc-4.7.2$ grep C89 /mnt/sda1/tmp/fortran_make_log
checking for gcc option to accept ISO C89... yes
checking for gcc option to accept ISO C89... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C89... checking for ANSI C header files... (cached) yes
checking for gcc option to accept ISO C89... yesa
checking for gcc option to accept ISO C89... config.status: creating config.h
checking for gcc option to accept ISO C89... /usr/local/bin/grep -E
checking for gcc option to accept ISO C89... checking fcntl.h usability... -1
checking for gcc option to accept ISO C89... yes
checking for gcc option to accept ISO C89... checking for table... if [ x"-fpic" != x ]; then \
checking for gcc option to accept ISO C89... config.status: linking ../.././gmp/mpn/generic/mu_divappr_q.c to mpn/mu_divappr_q.c
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C89... none needed
checking for /mnt/sda1/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/mnt/sda1/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/bin/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/lib/ -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/include -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/sys-include    option to accept ISO C89... none needed
checking for /mnt/sda1/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/mnt/sda1/tmp/gcc-4.7.2/host-x86_64-unknown-linux-gnu/gcc/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/bin/ -B/home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/lib/ -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/include -isystem /home/admin/tmp/gfortran-build/x86_64-unknown-linux-gnu/sys-include  -m32 option to accept ISO C89... unsupported

I'm even more confused now.  It looks like the gcc that the compilation process builds for itself is broken.  I'll check with the gcc people.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: gcc failing check for C89 while trying to compile gfortran
« Reply #5 on: January 26, 2015, 11:05:02 AM »
Hi qopit
Quote
-m32 option to accept ISO C89... unsupported
Maybe it's complaining about the flag for 32 bits?
Someone else built gcc though for Java, might contain some useful info anyway:
http://forum.tinycorelinux.net/index.php/topic,16590.0.html

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: gcc failing check for C89 while trying to compile gfortran
« Reply #6 on: January 26, 2015, 12:47:50 PM »
Thanks, Rich!  There are definitely several from that thread that I'm going to try out!!

While working through this I'm also going to ditch -jN, as that is confusing the outputs.  I'm not 100% certain that the problem is the C89 support anymore.

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: gcc failing check for C89 while trying to compile gfortran
« Reply #7 on: January 26, 2015, 02:47:02 PM »
Rich - you are a lifesaver... thanks!  I'm not sure which did the trick of the many things I did as a result of that thread you pointed me too, but I just got a successful make run.

Some of the things I did were:

  1. installed kernel headers (need them later anyway)
  2. carried all ./configure switches forward from Core's gcc (from gcc -v)
  3. installed all extensions the other script used (eg: I did not have glibc_apps)
  4. fixed the ld-linux-x86-64.so.2 path in linux64.h (lib64->lib)
  5. CONFIG_SHELL=`which bash`

Wow that burned a lot of hours.  Moving on... :)
 

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: gcc failing check for C89 while trying to compile gfortran
« Reply #8 on: January 26, 2015, 03:26:44 PM »
Hi qopit
Glad to hear you got it worked out.