[R] library() - Error: Package foo was built for Win32

Henrik Bengtsson hb at maths.lth.se
Tue Nov 12 03:35:36 CET 2002

Thanks. I've got some other off-line comments about distributing a
source package instead. The reason for not doing this is that I wanted
to make life as simple as possible for people using my packages. For
instance, I can not rely on the fact that Windows users all have perl
etc installed, which is is required for an installation from source (I
believe this is why there is the option to create binary
packages/bundles for Windows (Rcmd build --binary) in the first place.
What you and others imply(?) is that it is quite certain that
(non-advanced computer) users on other operating systems than Windows,
i.e. Unix clones (Linux, Solaris, OSX) and MacOS. If this is correct, I
will from now on do

 1) 'Rcmd build --binary foo' to build a *binary* package/bundle for
Windows (*.zip)
 2) 'Rcmd build foo' to build a *source* package/bundle for everything
else (*.tar.gz)

(I do check my package with 'Rcmd check'). My guess and concern is that
some MacOS users might have problem installing from source. Also, is it
correct that a *.zip file should be assumed to be a *binary Windows*
package/bundle and any *tar.gz file should be assumed to be a *source*
package/bundle and never a *binary* distribution?

BTW: Jari Oksanen kindly replied to me that replacing "Win32" with "-"
in the Built: line of (the binary) DESCRIPTION file would indeed prevent
library() to report the error "Error: Package foo was built for Win32"
and a pure R library would load fine on a Unix system too. However, this
solution is very ad hoc and is probably not in line with the purpose of
the test. (I've already noticed the problem with line-endings and I
assert that any "\r" characters are removed from DESCRIPTION).

Thanks again.

Henrik Bengtsson

> -----Original Message-----
> From: ripley at stats.ox.ac.uk [mailto:ripley at stats.ox.ac.uk] 
> Sent: den 11 november 2002 22:46
> To: Henrik Bengtsson
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] library() - Error: Package foo was built for Win32
> One good reason is line endings for information files, which 
> need to be different on Windows, Mac and Unix.
> Your package should be able to be *installed* anywhere, so 
> why don't you do that?  Build a source package (like all 
> those on CRAN) and test is with Rcmd check on Windows.
> On Mon, 11 Nov 2002, Henrik Bengtsson wrote:
> > >From R v1.6.0 there has been a new test added to the 
> library() code.
> > This test is performed when library() is ran on a "unix" 
> system and it 
> > verifies that the "Built" platform (from the DESCRIPTION file) is 
> > "compatible" with the current platform. Here is the code 
> extract from 
> > the local function testRversion() of library() that I am talking 
> > about:
> >
> >             if (.Platform$OS.type == "unix") {
> >                 platform <- builtFields[2]
> >                 m <- agrep(platform, R.version$platform)
> >                 if (!length(m))
> >                   stop(paste("package", fields[1, "Package"],
> >                     "was built for", platform), call. = FALSE)
> >             }
> >
> > For example, I have built a package using pure (100%) R code, which 
> > should be able to run anywhere. However, since the "Built" 
> line in my 
> >
> >   Built: R 1.5.1;  Win32;  2002-11-11 10:44:35
> >
> > It won't pass this test on a unix machine, e.g. OSX. 
> Unfortunately, at 
> > the place I am the next few months I have no way of testing 
> > compatibility issues under Unix etc and learning more about this 
> > myself. However, I can not see the reason for this test at 
> this step 
> > in the loading of a package? I would understand the test if the 
> > package loaded relies on native code etc, but not for 
> packages written 
> > in pure R. An answer would most likely enlighten me or 
> maybe suggest a 
> > less "brutal" test.
> >
> > My current idea for a workaround of this problem is simply 
> to replace 
> > the "Win32" string in  "Built: R 1.5.1;  Win32;  2002-11-11 
> 10:44:35" 
> > with something else for the *.tar.gz package.
> DESCRIPTION files in source packages should not have that line at all.
> -- 
> 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 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list