This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"Why does my libgfortran build yield an error on kinds.h?"


Hi Bernhard, hi all,

[ I first wrote this message to Bernhard, and thought it was a nice summary of the cases where we get an error while building libgfortran/ kinds.h, so I send it to the list, with hopefully enough context for everyone to understand ]

I read the busybox thread you mentionned to me (http://busybox.net/ bugs/view.php?id=1164). I'm not sure this is a problem with autodetecting kinds... in fact, what I can say for sure is that every single time this exact error was reported by someone, it was simply a problem of the newly built gfortran compiler not working at all. The most common reasons for that have been:

- the f951 binary being linked to the shared mpfr library (or gmp), and LD_LIBRARY_PATH not being set so that running the compiler simply errors out because of the shared library not being found;

- the f951 binary being linked to GMP and MPFR libraries built for a different architecture than the *host* architecture (ie the one the compiler is executed on): including, but not limited to, 64bit GMP and/or MPFR libraries used in a 32bit compiler binary;

- the f951 binary being unable to run on the host, e.g. segfaulting every time it's called, because it's compiled with a bizarre -march value that doesn't match the host architecture.

I've recently (yesterday) commited a patch that explcitly checks if the compiler is working and gives a better error message. Right now, the best way for you to determine what's going wrong is to use the compiler indicated in the mk-kinds-h.sh command line (the failing one) to build a small test program. For example, when the failing command-line is:

/bin/sh /root/buildroot/toolchain_build_i686/gcc-4.2-20070110/ libgfortran/mk-kinds-h.sh '/root/buildroot/toolchain_build_i686/ gcc-4.2-final/./gcc/gfortran -B/root/buildroot/toolchain_build_i686/ gcc-4.2-final/./gcc/ -B/root/buildroot/build_i686/staging_dir/i686- linux-uclibc/bin/ -B/root/buildroot/build_i686/staging_dir/i686- linux-uclibc/lib/ -isystem /root/buildroot/build_i686/staging_dir/ i686-linux-uclibc/include -isystem /root/buildroot/build_i686/ staging_dir/i686-linux-uclibc/sys-include -I . -Wall -fno-repack- arrays -fno-underscoring ' > kinds.h || rm kinds.h

the compiler command is the first arg of mk-kinds-h.sh, that is:


/root/buildroot/toolchain_build_i686/gcc-4.2-final/./gcc/gfortran - B/root/buildroot/toolchain_build_i686/gcc-4.2-final/./gcc/ -B/root/ buildroot/build_i686/staging_dir/i686-linux-uclibc/bin/ -B/root/ buildroot/build_i686/staging_dir/i686-linux-uclibc/lib/ -isystem / root/buildroot/build_i686/staging_dir/i686-linux-uclibc/include - isystem /root/buildroot/build_i686/staging_dir/i686-linux-uclibc/ sys-include -I . -Wall -fno-repack-arrays -fno-underscoring

Create a small test.f90 file, containing simply integer :: i end

and try compiling it ("large-command-line -c test.f90") and see what the compiler says. If you have a version of gfortran more recent than my patch, it gives the name of log file that you can look into: it will contain the error message from the compiler.

Now, I hope that we can refer people to this post in the future!

FX


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]