Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 497008 - fortran-2.eclass has problems to detect working fortran compilers if selected gcc has no fortran support although FC is set
Summary: fortran-2.eclass has problems to detect working fortran compilers if selected...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords:
: 507236 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-01-04 20:13 UTC by Walter
Modified: 2022-07-27 18:28 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_497008.txt,1.91 KB, text/plain)
2014-01-06 08:48 UTC, Walter
Details
emerge --info (file_497008.txt,4.88 KB, text/plain)
2014-01-06 09:16 UTC, Walter
Details
emerge --info (2) (emerge_info,6.88 KB, text/plain)
2022-07-27 18:28 UTC, yaogen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Walter 2014-01-04 20:13:19 UTC
As per the summary, the package doesn't emerge.

Ran in to this when emerging R for statistics purposes for a CI system I am building. (I don't usually use R)

There is a fix, namely:
export FC=gfortran-4.7.3
emerge blas-reference

This will force it to notice fortran.

I am guessing that probably there is some outdated/broken fortran interpreter checking code in the ebuild, since it has 2007 in its version.

Reproducible: Always

Steps to Reproduce:
1. emerge sci-libs/blas-reference

Actual Results:  
emerge fails with gcc missing fortran error, even though gcc includes fortran 

Expected Results:  
emerge succeeds
Comment 1 Justin Lecher (RETIRED) gentoo-dev 2014-01-06 07:55:19 UTC
Please attach full Build.log
Comment 2 Walter 2014-01-06 08:48:25 UTC
Created attachment 367152 [details]
build.log
Comment 3 Justin Lecher (RETIRED) gentoo-dev 2014-01-06 08:50:38 UTC
Could you please add the ouput of emerge --info ?
Comment 4 Justin Lecher (RETIRED) gentoo-dev 2014-01-06 08:53:30 UTC
(In reply to Walter from comment #0)
> export FC=gfortran-4.7.3

Why are you specifically using version 4.7.3?
Comment 5 Walter 2014-01-06 08:58:09 UTC
Dunno. My thought process was:
 'does this system even HAVE fortran? who the hell uses fortran?'
 'gcc --version'
 'eselect gcc list'
 'locate fortran |grep bin'

Then I came up with that number, since it was already installed.
Comment 6 Justin Lecher (RETIRED) gentoo-dev 2014-01-06 09:01:14 UTC
(In reply to Walter from comment #5)
> Dunno. My thought process was:
>  'does this system even HAVE fortran? who the hell uses fortran?'
>  'gcc --version'
>  'eselect gcc list'
>  'locate fortran |grep bin'
> 
> Then I came up with that number, since it was already installed.

you don't need to set it explicitly. Simply emerge gcc with USE=fortran.
Comment 7 Walter 2014-01-06 09:07:13 UTC
Of course I first went to 'well, do I have fortran enabled in gcc?' and yes I did (and do, but can replicate the bug 100% every time if I don't use the 'FC' workaround).

$ emerge -av gcc
This action requires superuser access...
Would you like to add --pretend to options? [Yes/No] 

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-devel/gcc-4.7.3-r1:4.7  USE="cxx fortran hardened mudflap (multilib) nls nptl openmp (-altivec) -awt -doc (-fixed-point) -gcj -go -graphite (-libssp) -multislot -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB
Comment 8 Justin Lecher (RETIRED) gentoo-dev 2014-01-06 09:11:46 UTC
What it the output of gfortran-4.7.3 -v ?
Comment 9 Walter 2014-01-06 09:13:51 UTC
gfortran-4.7.3 -v
Using built-in specs.
COLLECT_GCC=gfortran-4.7.3
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /pool/var-tmp-portage/portage/sys-devel/gcc-4.7.3-r1/work/gcc-4.7.3/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include/g++-v4 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.7.3-r1 p1.4, pie-0.5.5' --enable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --enable-libmudflap --disable-libssp --enable-lto --without-cloog --without-ppl
Thread model: posix
gcc version 4.7.3 (Gentoo Hardened 4.7.3-r1 p1.4, pie-0.5.5)
Comment 10 Justin Lecher (RETIRED) gentoo-dev 2014-01-06 09:15:34 UTC
Could you please attach

/pool/var-tmp-portage/portage/sci-libs/blas-reference-20070226/temp/_fortran_compile_test.log
Comment 11 Walter 2014-01-06 09:16:25 UTC
Created attachment 367154 [details]
emerge --info
Comment 12 Walter 2014-01-06 09:17:06 UTC
# cat /pool/var-tmp-portage/portage/sci-libs/blas-reference-20070226/temp/_fortran_compile_test.log 
/usr/portage/eclass/fortran-2.eclass: line 117: gfortran: command not found
Comment 13 Justin Lecher (RETIRED) gentoo-dev 2014-01-06 09:19:33 UTC
(In reply to Walter from comment #12)
> /usr/portage/eclass/fortran-2.eclass: line 117: gfortran: command not found

What does

type gfortran

say?

Probably you need to set your gcc again via gcc-config.
Comment 14 Walter 2014-01-06 09:29:26 UTC
$ type gfortran
bash: type: gfortran: not found

$ gcc-config -l
 [1] x86_64-pc-linux-gnu-4.6.3 *
 [2] x86_64-pc-linux-gnu-4.6.3-hardenednopie
 [3] x86_64-pc-linux-gnu-4.6.3-hardenednopiessp
 [4] x86_64-pc-linux-gnu-4.6.3-hardenednossp
 [5] x86_64-pc-linux-gnu-4.6.3-vanilla
 [6] x86_64-pc-linux-gnu-4.7.3
 [7] x86_64-pc-linux-gnu-4.7.3-hardenednopie
 [8] x86_64-pc-linux-gnu-4.7.3-hardenednopiessp
 [9] x86_64-pc-linux-gnu-4.7.3-hardenednossp
 [10] x86_64-pc-linux-gnu-4.7.3-vanilla

$ sudo gcc-config x86_64-pc-linux-gnu-4.7.3
 * Switching native-compiler to x86_64-pc-linux-gnu-4.7.3 ...
>>> Regenerating /etc/ld.so.cache...  [ ok ]

 * If you intend to use the gcc from the new profile in an already
 * running shell, please remember to do:
 *   . /etc/profile

$ . /etc/profile
$ sudo emerge blas-reference # now works as expected

Well that's weird. 

I am not the kind of person to go around tinkering with my gcc (not to say it didn't happen, but I think it's 95% likely to have been some package upgrade causing that change).

Given how rare the fortran issue is, perhaps the output could be made more useful or some ebuild modification could be made to make this process of gentoo compiler selection meets missing fortran meets failing builds more ... transparent.

It seems in my case, the ebuild goes:
 - got gcc with fortran? yup
 - i can't see fortran, die

In reality, the situation was more like:
 - got multiple gcc versions
 - some old one you happen to be using for god knows what reason maybe *doesn't* have the fortran use flag (was this the cause? i am assuming this was the problem)

Perhaps detecting the missing flag on the current compiler (good!), or attempting to use versioned symlinks of random alternate but installed gcc releases (hrrm, probably bad) would be a good change to the ebuild. I don't understand how to easily do that (is there syntax that supports 'for the current compiler' in an ebuild? probably not) but it's certainly possible to die with a more useful error once an ebuild has begun to run.

The problem with adding this logic to fortran-using ebuilds is that it has to be duplicated. In reality, the problem is probably one portage could solve or warn about in a more generic fashion.

It would be extremely disappointing if *no* change occurred as a result of this bug report.
Comment 15 Justin Lecher (RETIRED) gentoo-dev 2014-01-06 13:21:22 UTC
You are right we need to get some more useful debugging output instantly. I will work on. Though I don't know whether this is really something we can work around from the eclass side. The only thing which is weird, that there was gfortran and not x...gfortran.
Comment 16 Jeroen Roovers (RETIRED) gentoo-dev 2014-04-09 14:16:59 UTC
*** Bug 507236 has been marked as a duplicate of this bug. ***
Comment 17 yaogen 2022-07-27 18:28:45 UTC
Created attachment 795029 [details]
emerge --info (2)

Can confirm that this is still an issue.

Worked around it with "export FC=gfortran-12.1.1" for now.

I've attached an "emerge --info".

Below is the output of the emerge:


>>> Emerging (26 of 75) sci-libs/hdf5-1.12.2-r4::gentoo
 * hdf5-1.12.2.tar.bz2 BLAKE2B SHA512 size ;-) ...                       [ ok ]
 * 
 * Please install currently selected gcc version with USE=fortran.
 * If you intend to use a different compiler then gfortran, please
 * set FC variable accordingly and take care that the necessary
 * fortran dialects are supported.
 * 
 * ERROR: sci-libs/hdf5-1.12.2-r4::gentoo failed (setup phase):
 *   Currently no working fortran compiler is available (see /var/tmp/portage/sci-libs/hdf5-1.12.2-r4/temp/_fortran_compile_test.log for information)
 * 
 * Call stack:
 *               ebuild.sh, line 122:  Called pkg_setup
 *   hdf5-1.12.2-r4.ebuild, line  47:  Called fortran-2_pkg_setup
 *        fortran-2.eclass, line 292:  Called _fortran-2_pkg_setup
 *        fortran-2.eclass, line 273:  Called _fortran_test_function
 *        fortran-2.eclass, line 233:  Called _fortran_die_msg
 *        fortran-2.eclass, line 214:  Called die
 * The specific snippet of code:
 *   	die "Currently no working fortran compiler is available (see ${T}/_fortran_compile_test.log for information)"
 * 
 * If you need support, post the output of `emerge --info '=sci-libs/hdf5-1.12.2-r4::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sci-libs/hdf5-1.12.2-r4::gentoo'`.
 * The complete build log is located at '/var/log/portage/sci-libs:hdf5-1.12.2-r4:20220727-154858.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/sci-libs/hdf5-1.12.2-r4/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sci-libs/hdf5-1.12.2-r4/temp/die.env'.
 * Working directory: '/var/tmp/portage/sci-libs/hdf5-1.12.2-r4/empty'
 * S: '/var/tmp/portage/sci-libs/hdf5-1.12.2-r4/work/hdf5-1.12.2'