Hi, is it possible to make install.packages install a source package by compiling it on Unix, but skip compilation and use a pre-built windows binary (shipped in exec/) if installing on Windows? The package should be installable on Windows machines that do not have Rtools installed. This is to make the update process easier for users, because the C++ code does not change often, meaning that I can just send source packages built on Linux, with a binary executable built once in a while on win-builder. Note that this is for a package that is not meant for CRAN, so no policy issue here. Thank you. Bests, Renaud
Is it possible to make install.packages compile source code on Unix but use shipped binary on Windows?
7 messages · Renaud Gaujoux, Brian Ripley, Martyn Plummer
On 13/06/2014 11:10, Renaud Gaujoux wrote:
Hi, is it possible to make install.packages install a source package by compiling it on Unix, but skip compilation and use a pre-built windows binary (shipped in exec/) if installing on Windows?
A 'pre-built windows binary' of what? You can easily ship a DLL or .exe for use on Windows: just make use of configure.win and/or Makefile.win. If you have a Makefile.win it will override the normal procedures for directory src. OTOH, shipping something in exec will be installed everwhere. Watch out for sub-architectures: 'Windows' is in fact two platforms. We have over the years seen a lot of problem with people shipping 64-bit Windows binaries: 32-bit Windows does not recognize those.
The package should be installable on Windows machines that do not have Rtools installed. This is to make the update process easier for users, because the C++ code does not change often, meaning that I can just send source packages built on Linux, with a binary executable built once in a while on win-builder. Note that this is for a package that is not meant for CRAN, so no policy issue here. Thank you. Bests, Renaud
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
4 days later
Thank you for the replies and hints.
A 'pre-built windows binary' of what?
Sorry this was not clear, src/ contains source code for a binary executable, which produces no .lib or .dll. It is all fine in a R development environment: * On Linux, the executable is compiled and copied to R_PACKAGE_DIR/binR_ARCH using a custom install.libs.R script. * Same thing on Windows, if Rtools is installed, install.packages compiles and installs both 32 and 64 bits .exe.
You can easily ship a DLL or .exe for use on Windows: just make use of configure.win and/or Makefile.win. If you have a Makefile.win it will override the normal procedures for directory src.
I have tried using Makevars.win, but this requires make to be installed (as by Rtools). So I guess using Makefile.win would also not work, on a classic non-development geared Windows host. Would using configure.win work without Rtools?
OTOH, shipping something in exec will be installed everwhere.
True, although it seems that sub-directories of exec/ are actually not installed though. Is this intentional?
Watch out for sub-architectures: 'Windows' is in fact two platforms. We have over the years seen a lot of problem with people shipping 64-bit Windows binaries: 32-bit Windows does not recognize those.
Indeed, and I think I properly take care of this in install.libs.R. @Grabriel: the package is provided as a source package. This one is installable locally from file, although in may case users actually get it through a personal CRAN-like repository, using argument type='both'. Thank you. Bests, Renaud
On 18/06/2014 09:11, Renaud Gaujoux wrote:
Thank you for the replies and hints.
A 'pre-built windows binary' of what?
Sorry this was not clear, src/ contains source code for a binary executable, which produces no .lib or .dll. It is all fine in a R development environment: * On Linux, the executable is compiled and copied to R_PACKAGE_DIR/binR_ARCH using a custom install.libs.R script. * Same thing on Windows, if Rtools is installed, install.packages compiles and installs both 32 and 64 bits .exe.
You can easily ship a DLL or .exe for use on Windows: just make use of configure.win and/or Makefile.win. If you have a Makefile.win it will override the normal procedures for directory src.
I have tried using Makevars.win, but this requires make to be installed (as by Rtools). So I guess using Makefile.win would also not work, on a classic non-development geared Windows host. Would using configure.win work without Rtools?
Maybe. Read the documentation and sources for yourself (see below).
OTOH, shipping something in exec will be installed everywhere.
True, although it seems that sub-directories of exec/ are actually not installed though. Is this intentional?
Yes, *and documented* (including that it should not be used for Windows executables). Neither I nor R-devel is a documentation-reading service: do read http://www.r-project.org/posting-guide.html very carefully.
Watch out for sub-architectures: 'Windows' is in fact two platforms. We have over the years seen a lot of problem with people shipping 64-bit Windows binaries: 32-bit Windows does not recognize those.
Indeed, and I think I properly take care of this in install.libs.R. @Grabriel: the package is provided as a source package. This one is installable locally from file, although in may case users actually get it through a personal CRAN-like repository, using argument type='both'. Thank you. Bests, Renaud
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
Maybe. Read the documentation and sources for yourself (see below).
Not working, at least in my hands, as it requires `sh`.
Yes, *and documented*
True. I overlooked the beginning of the NB point.
(including that it should not be used for Windows executables).
Yes, that's why I use the suggested procedure that uses src/install.libs.R to copy compiled .exe files into bin<R_ARCH>/. So, eventually, I guess the answer to the original question is: no, one cannot make install.packages skip compilation of a source package, only if on Windows, without having Rtools installed -- and in PATH. Renaud
On Wed, 2014-06-18 at 16:10 +0200, Renaud Gaujoux wrote:
Maybe. Read the documentation and sources for yourself (see below).
Not working, at least in my hands, as it requires `sh`.
Yes, *and documented*
True. I overlooked the beginning of the NB point.
(including that it should not be used for Windows executables).
Yes, that's why I use the suggested procedure that uses src/install.libs.R to copy compiled .exe files into bin<R_ARCH>/. So, eventually, I guess the answer to the original question is: no, one cannot make install.packages skip compilation of a source package, only if on Windows, without having Rtools installed -- and in PATH.
But why would you want to? I don't understand why you are making life so hard for yourself. It isn't hard to set up Rtools on Windows and you only need to do it once. Then you build a binary package on your development system to distribute to your users. Without even considering any technical details there is a purely strategic issue here. If a system has been set up that is robust and widely tested, like the R packaging system, you are much better off working with it than trying to subvert it. Martyn
Renaud
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}
Hi Martyn,
It isn't hard to set up Rtools on Windows and you only need to do it once. Then you build a binary package on your development system to distribute to your users.
Yes, but since I am working on Linux, it is slightly more steps involved in order to generate a windows binary (even using a virtual machine), compared to build and push source packages to my repository, for which I have shell scripts and make files that do that in seconds and in batch mode. When working in a fast bug fix-test cycle with windows users testing things out often times a day, these extra steps take much time overall.
Without even considering any technical details there is a purely strategic issue here. If a system has been set up that is robust and widely tested, like the R packaging system, you are much better off working with it than trying to subvert it.
Agreed completely. I really like R cross-platform packaging and checking system, and was just wondering if this conditional compilation option was possible using the flexibility of this very system. Renaud