autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use -### instead of -v to detect Fortran linker options


From: Jeroen Demeyer
Subject: Use -### instead of -v to detect Fortran linker options
Date: Thu, 12 Jul 2012 10:51:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120226 Thunderbird/10.0.1

The macro _AC_PROG_FC_V in lib/autoconf/fortran.m4 should first try -###
instead of -v to detect linker options. The attached patch fixes this.

The problem is that gfortran -v actually runs the compiler/linker which
might print warnings. Those warnings are harmless for compilation but
can confuse the _AC_PROG_FC_V script. The GCC manual also suggests that
-### should be used in shell scripts instead of -v.

This problem was observed when compiling the R statistics package
(http://www.r-project.org/) as 32-bit powerpc-unknown-linux-gnu
application with 64-bit powerpc64-unknown-linux-gnu kernel. The
userspace is a multilib installation. It has 32-bit libraries in
/usr/lib and 64-bit libraries in /usr/lib64. I am using a pure 32-bit
version of GCC which produces 32-bit code.

See https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14865
and http://trac.sagemath.org/sage_trac/ticket/12787

***** ./configure output of R: *****
checking build system type... powerpc-unknown-linux-gnu
checking host system type... powerpc-unknown-linux-gnu
[...]
checking how to get verbose linking output from gfortran... -v
checking for Fortran 77 libraries of gfortran...
-L/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib
-L/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib/gcc/powerpc-unknown-linux-gnu/4.6.3
-L/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib/gcc/powerpc-unknown-linux-gnu/4.6.3/../../..
-lgfortran -lm /usr/lib64/libm.a /usr/lib64/libc.a
[...]

***** Note *****
The "lib64" stuff should not be there, since there is nothing 64-bit
about this build. It is caused by ld warnings. With -###, ld is not
actually run and the problem disappears.

***** config.log fragment: *****
configure:22749: checking for Fortran 77 libraries of gfortran
configure:22772: gfortran -o conftest -g -O2 -v conftest.f
Using built-in specs.
Target: powerpc-unknown-linux-gnu
Thread model: posix
gcc version 4.6.3 (GCC)

/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/libexec/gcc/powerpc-unknown-linux-gnu/4.6.3/f951
conftest.f -ffixed-form -quiet -dumpb
ase conftest.f -auxbase conftest -g -O2 -version -fintrinsic-modules-path
/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib/gcc/power
pc-unknown-linux-gnu/4.6.3/finclude -o /tmp/ccoU4hEB.s
GNU Fortran (GCC) version 4.6.3 (powerpc-unknown-linux-gnu)
        compiled by GNU C version 4.6.3, GMP version 5.0.1, MPFR version
3.1.0,
MPC version 1.0.0dev
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (GCC) version 4.6.3 (powerpc-unknown-linux-gnu)
        compiled by GNU C version 4.6.3, GMP version 5.0.1, MPFR version
3.1.0,
MPC version 1.0.0dev
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 as -mppc -many -o /tmp/cc0sbQr1.o /tmp/ccoU4hEB.s
Reading specs from
/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib/libgfortran.spec
rename spec lib to liborig

/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/libexec/gcc/powerpc-unknown-linux-gnu/4.6.3/collect2
--eh-frame-hdr -V -m elf32ppclinu
x -dynamic-linker /lib/ld.so.1 -o conftest /usr/lib/crt1.o /usr/lib/crti.o
/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib/gcc/powe
rpc-unknown-linux-gnu/4.6.3/crtbegin.o
-L/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib
-L/home/jdemeyer/silius/sage-5.0.beta12-gc
c-32/local/lib/gcc/powerpc-unknown-linux-gnu/4.6.3
-L/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib/gcc/powerpc-unknown-linux-gnu/
4.6.3/../../.. /tmp/cc0sbQr1.o -lgfortran -lm -lgcc_s -lgcc -lm -lgcc_s
-lgcc
-lc -lgcc_s -lgcc /home/jdemeyer/silius/sage-5.0.beta12-gcc-
32/local/lib/gcc/powerpc-unknown-linux-gnu/4.6.3/crtend.o /usr/lib/crtn.o
GNU ld (GNU Binutils; SUSE Linux Enterprise 11) 2.20.0.20100122-0.7.9
  Supported emulations:
   elf64ppc
   elf32ppclinux
   elf32ppc
   elf32ppcsim
   elf32_spu/usr/bin/ld: skipping incompatible /usr/lib64/libm.so when
searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib64/libc.a when searching for -lc
configure:22947: result:
-L/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib
-L/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/li
b/gcc/powerpc-unknown-linux-gnu/4.6.3
-L/home/jdemeyer/silius/sage-5.0.beta12-gcc-32/local/lib/gcc/powerpc-unknown-linux-gnu/4.6.3/../../.
. -lgfortran -lm /usr/lib64/libm.a /usr/lib64/libc.a


Best wishes,
Jeroen Demeyer

Attachment: fortran_linker_flags.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]