Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling on Windows #10

Closed
wants to merge 1 commit into from
Closed

Compiling on Windows #10

wants to merge 1 commit into from

Conversation

CGMossa
Copy link
Member

@CGMossa CGMossa commented Aug 20, 2020

Compiling on windows doesn't work.. Attempting to fix that.

Added language annotations to code-blocks.

Added language annotations to code-blocks.
@andy-thomason
Copy link
Contributor

Look forward to seeing this...

@CGMossa
Copy link
Member Author

CGMossa commented Aug 23, 2020

Yeah. It's a draft for a reason.

I'm sorry but I played around with it and tried your suggestions, and it didn't really match exactly what I was seeing. I'll look deeper into it.

@andy-thomason
Copy link
Contributor

Good luck. Building on windows is definitely a challenge, it seems. We will also need a way to install Rust in the CRAN package.

@CGMossa
Copy link
Member Author

CGMossa commented Aug 26, 2020 via email

@andy-thomason
Copy link
Contributor

Those do look promising. There is an AppVeyor script in Dirk's package.

I know quite a few people (mostly at pharmas) who use R on windows, so this is quite important.

@CGMossa
Copy link
Member Author

CGMossa commented Sep 2, 2020 via email

@andy-thomason
Copy link
Contributor

andy-thomason commented Sep 4, 2020 via email

@clauswilke
Copy link
Member

Hello, I only just saw this project and this issue/PR. Not sure what the status is, but I'm very excited about any additional effort bringing R and Rust together. Further development of my sinab package depends on this, and I'd rather not have to do everything by myself.

To compile on Windows, the installation instructions that come with sinab have worked for a number of people:
https://clauswilke.com/sinab/

I also have a working appveyor setup: https://github.com/clauswilke/sinab/blob/master/appveyor.yml

You need an appropriate Makevars.win file in your R package: https://github.com/clauswilke/sinab/blob/master/src/Makevars.win

To get a package containing Rust onto CRAN, you need to precompile the Windows library and download on the fly as you build the package on Windows on CRAN. See the discussion here and see an example here:
https://github.com/cran/gifski/blob/master/src/Makevars.win
https://github.com/cran/gifski/blob/master/tools/winlibs.R

Note: The gifski package is entirely written in Rust and it's available on CRAN, so this is definitely possible: https://cran.r-project.org/web/packages/gifski/index.html

@andy-thomason
Copy link
Contributor

Hi @clauswilke I was hoping to avoid the two-stage gifski approach of building a
static library and linking to a DLL by using a Makefile directly, reducing the file count in
examples. Ultimately we should only need a single rust file in addition to the R
package skeleton. But for convenience we may need to do it. The current file count is 11
files.

I don't currently have a windows or mac machine to try a windows build
and hence this has stalled.

I am working (rather slowly at the moment) on a Rust package skeleton generator
that will do this and would appreciate some help.

If anyone can contribute a simple example (less than 20 files) of a windows build on Appveyor,
it would be useful and act as a starting point. Likewise for the Mac.

@clauswilke
Copy link
Member

Keep in mind though that the two-stage approach is only needed for CRAN submission, because their servers currently lack the cargo toolchain. Otherwise installation from source is pretty straightforward.

A minimal example with a working appveyor build is available here: https://github.com/r-rust/hellorust

One other issue I realized is that there are two distinct compilation scenarios and we need to be clear which one we're talking about: 1. Build an R package that calls Rust code. 2. Build a standalone Rust binary that calls R code. The second scenario is substantially more complex than the first. I'm only talking about the first at this time.

@clauswilke
Copy link
Member

@CGMossa I'm closing this PR since things now compile on Windows (as far as I understand). If you want to merge the changes to the README, I suggest you make a new PR with a corresponding title. There's other fixes the README needs (e.g., somewhere code and regular text blocks get switched), so such a PR would make a lot of sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants