[R] CRLF-terminated Fortran files

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Nov 24 07:04:53 CET 2004


What did this have to do with GLMM?  I've changed the subject line.

On Wed, 24 Nov 2004, Richard A. O'Keefe wrote:

> I was trying to install some more packages and ran into a problem
> I hadn't seen before.

We've seen it for C, and test it for C in R CMD check.  I think we should 
check C++ and Fortran files too.

> Version:
>
>    platform sparc-sun-solaris2.9
>    arch     sparc
>    os       solaris2.9
>    system   sparc, solaris2.9
>    status
>    major    2
>    minor    0.1
>    year     2004
>    month    11
>    day      15
>    language R
>
> Fortran compilers available to me:
>
>    f77: Sun WorkShop 6 update 2 FORTRAN 77 5.3 2001/05/15
>    f90: Sun WorkShop 6 update 2 Fortran 95 6.2 2001/05/15
>    f95: Sun WorkShop 6 update 2 Fortran 95 6.2 2001/05/15
>
> Package:
>
>    gam
>
>    In fact I didn't ask for this one specifically, I had
>    "dependencies=TRUE" in a call to install.packages().
>
> Problem:
>
>    Following the installation instructions for R, I had selected F95
>    as my Fortran compiler.
>
>    The f95 compiler complained about nearly every line of
>    gam/src/bsplvd.f
>
>    From the error messages as displayed on the screen, I could see no
>    reason for complaint.  However, looking at the file with a text
>    editor immediately revealed the problem.  The files
>
> 	bsplvd.f	bvalue.f	bvalus.f	loessf.f
> 	qsbart.f	sgram.f		sinerp.f	sslvrg.f
> 	stxwx.f
>
>    all use CR-LF line termination.  The files
>
> 	linear.f	lo.f		splsm.f
>
>    all use LF line termination expected on UNIX.
>
>    It turns out that the g77 and f77 compilers don't mind CR at the
>    end of a line, but f90 and f95 hate them like poison.
>
>    Removing the CRs makes f90 and f95 happy again.

BTW, in that version of Sun Workshop f90 and f95 are the same compiler, 
and in later versions so is f77.  (I think these compilers are on version 
9 now.)  Even in version 7, there is no problem with line endings.

I did get a warning:

       call dchdc(a,p,p,work,jpvt,job,info)
                                      ^
"linear.f", Line = 408, Column = 38: WARNING: Procedure "DCHDC" is defined 
at line 194 (linear.f).  Illegal association of array actual argument with 
scalar dummy argument "INFO".

which seems genuine (make it info(1) in the call).


> Second-order problem:
>
>    I know how to fix the immediate problem.  What I don't know is how
>    to intervene in the installation process.  What I need to do is
> 	- get and unpack files (steps normally done by install.packages)
> 	- make changes (remove CR, edit configuration, whatever)
> 	- resume whatever install.packages normally does

- Use install.packages(destdir=) to retain the tarballs which are 
downloaded.

- Unpack the package tarball, make changes.

- Run R CMD INSTALL on the changed sources.

-- 
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




More information about the R-help mailing list