Henrik Bengtsson
2002-Nov-11 06:24 UTC
[R] library() - Error: Package foo was built for Win32
>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 DESCRIPTION says 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. What should this something be for "unix" systems? Would this be an ok approach? Thank you! Henrik Bengtsson Home: 201/445 Royal Parade, 3052 Parkville Office: Bioinformatics, WEHI, Parkville +61 (0)412 269 734 (cell), +61 (0)3 9387 4791 (home), +61 (0)3 9345 2324 (lab), +1 (508) 464 6644 (global fax) hb at wehi.edu.au, http://www.maths.lth.se/~hb/ Time zone: +11h UTC (Sweden +1h UTC, Calif. -8h UTC) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
ripley@stats.ox.ac.uk
2002-Nov-11 11:46 UTC
[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 > DESCRIPTION says > > 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._