From ripley at stats.ox.ac.uk  Mon Dec  1 13:34:19 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 1 Dec 2008 12:34:19 +0000 (GMT)
Subject: [Rd] Rtools28 - undefined references with gfortran
In-Reply-To: <OF6B6AE998.718395DA-ON8525750D.005F0106-8525750D.005F011D@american.edu>
References: <OF6B6AE998.718395DA-ON8525750D.005F0106-8525750D.005F011D@american.edu>
Message-ID: <alpine.LFD.2.00.0812011230060.10803@gannet.stats.ox.ac.uk>

On Wed, 26 Nov 2008, John Nolan wrote:

>
> I recently upgraded to Rtools28 to build a package under
> Windows.  I see that g77 is no longer in Rtools, but it
> does have gfortran, and it uses version:
>   GNU Fortran (GCC) 4.2.1-sjlj (mingw32-2)
>
> I am compiling some old fortran code as part of a larger
> project.  When I do that, I get undefined references:
>
> gcc.exe: s_cmp.o: No such file or directory
> gcc.exe: s_copy.o: No such file or directory
> gcc.exe: s_cat.o: No such file or directory
> gcc.exe: F77_aloc.o: No such file or directory
>
> I don't see these entry points in any of the accompanying
> library files.   I hunted around and found the above
> functions in an old MinGW library libg2c.lib

libg2c.a, perhaps?

> When I link them in, I get different undefined references:
>
> ilaenv.o:ilaenv.f:(.text+0x55): undefined reference to
> `_gfortran_compare_string
> dlamch.o:dlamch.f:(.text+0x3bf): undefined reference to
> `_gfortran_pow_r8_i4'
> dormlq.o:dormlq.f:(.text+0x281): undefined reference to
> `_gfortran_concat_string
>
>
> Any guidance on how to solve this problem?

Give a reproducible example (or at least all the steps you used) : see the 
posting guide.

At a guess you are using gcc.exe to link Fortran code, not gfortran.exe. 
You can sometimes do that by adding -lgfortran to the link line.  But 
don't expect your helpers to be prepared to guess ....

>
> John Nolan
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Rtools28 - undefined references with gfortran
Prof Brian Ripley