From gantonaci at gmail.com  Wed Sep 27 16:46:15 2006
From: gantonaci at gmail.com (Giuseppe Antonaci)
Date: Wed, 27 Sep 2006 11:46:15 -0300
Subject: [Rd] Building R-2.3.1 for Windows with ATLAS
Message-ID: <41b60e190609270746s50090ae9o62cbaac5ce856859@mail.gmail.com>

Ok, moved to R-devel.

I tried to build R-2.3.1. Since I intent to distribute this tuned R to
all other who have a computer like mine here at work I thought it was
best to stay with the latest stable release.

About your suggestion, I could'n find xerblas.o file. And I don't know
how to edit libf77blas.a. I tried to open it with VIM
(http://vim.sf.net/) but there was a lot of strange symbols (expected,
I think), either way I found a reference to xerblas.o inside it but
didn't know what to do with this reference.
Thanks,
Giuseppe Antonaci

On 26/09/06, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Tue, 26 Sep 2006, Giuseppe Antonaci wrote:
>
> > I think this is not a R-devel question. Sorry to all if I'm wrong,
> > please let me know.
>
> In what sense is this not a programming question?
>
> > I managed to build R successfully with the default BLAS but when I
> > change the MKRULES to use ATLAS BLAS and set the path to
> > "C:/cygwin/home/Administrador/ATLAS/lib/WinNT_ATHLONSSE2" I got the
> > following error message (I'm posting only the final part, there was a
> > lot of compilation before this):
> >
> > cp R.dll ../../bin/
> > -------- Building ../../bin/Rblas.dll --------
> > gcc  -shared -s -o ../../bin/Rblas.dll blas00.o dllversion.o Rblas.def \
> >   -L../../bin -lR  -L"C:/WinNT_ATHLONSSE2" -lf77blas -latlas
>
> What version of R is this?  I get
>
> -------- Building ../../../bin/Rblas.dll --------
> gcc  -shared  -o ../../../bin/Rblas.dll blas00.o
> ../../gnuwin32/dllversion.o Rbl
> as.def \
>     -L../../../bin -lR  -L"/R/ATLAS/lib/WinNT_PM" -lf77blas -latlas -lg2c
>                                                                     ^^^^^
> in R-2.4.0 RC.
>
> You probably should not need it: you need to build ATLAS without xerbla (R
> has its own), so delete xerbla.o from libf77blas.a and all should be well.
>
> --
> 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
>

I managed to build R-2.3.1 successfully with the default BLAS but when I
change the MKRULES to use ATLAS BLAS and set the path to
"C:/WinNT_ATHLONSSE2" I got the
following error message (I'm posting only the final part, there was a
lot of compilation before this):

cp R.dll ../../bin/
-------- Building ../../bin/Rblas.dll --------
gcc  -shared -s -o ../../bin/Rblas.dll blas00.o dllversion.o Rblas.def \
  -L../../bin -lR  -L"C:/WinNT_ATHLONSSE2" -lf77blas -latlas
C:/WinNT_ATHLONSSE2/libf77blas.a(xerbla.o):xerbla.f:(.text+0xb): undefined refer
ence to `s_wsfe'
C:/WinNT_ATHLONSSE2/libf77blas.a(xerbla.o):xerbla.f:(.text+0x27): undefined refe
rence to `do_fio'
C:/WinNT_ATHLONSSE2/libf77blas.a(xerbla.o):xerbla.f:(.text+0x43): undefined refe
rence to `do_fio'
C:/WinNT_ATHLONSSE2/libf77blas.a(xerbla.o):xerbla.f:(.text+0x48): undefined refe
rence to `e_wsfe'
C:/WinNT_ATHLONSSE2/libf77blas.a(xerbla.o):xerbla.f:(.text+0x5c): undefined refe
rence to `s_stop'
collect2: ld returned 1 exit status
make[2]: *** [../../bin/Rblas.dll] Error 1
make[1]: *** [rbuild] Error 2
make: *** [all] Error 2

The ATLAS BLAS was build using Cygwin. AFTER building ATLAS BLAS I
changed the "Path" variable putting "C:\Rtools\tools\bin;C:\MinGW\bin"
before everything else.
To build R I followed "R Administration and Instalation" and Duncan
Murdoch's guide at http://www.murdoch-sutherland.com/Rtools/,
including the version of MinGW.

At ATLAS web page (http://math-atlas.sourceforge.net/errata.html) I
found the following:

Q: I'm linking with C, and getting missing symbols (such as w_wsfe,
do_fio, w_esfe or s_stop).
R: These kinds of symbols are Fortran library calls. The problem is
that the C linker does not automatically find the Fortran libraries.
The most common fix is to either link using your fortran linker, or to
rewrite your code so that Fortran routines are not called. If you know
where they are, you can also choose to link in the Fortran libraries
explicitly

Well, I think this answers my question but I didn't understand the
answer (and it was not because it is in English). Unfortunately I know
nothing of C or Fortran. Even if I
knew that I have these Fortran libraries I wouldn't know how to link
them. I tried to look at MinGW web page but found nothing.
Any help would be mostly welcome, please.
Giuseppe Antonaci




[Rd] Building R-2.3.1 for Windows with ATLAS
Giuseppe Antonaci