Code Monkey home page Code Monkey logo

Comments (10)

jeroen avatar jeroen commented on August 30, 2024 1

You can override CC and CXX in your personal ~/.R/Makevars file. Maybe something like this:

CC=$(BINPREF)ccache $(BINPREF)gcc

Or from R:

dir.create("~/.R")
writeLines("CC=$(BINPREF)ccache $(BINPREF)gcc", "~/.R/Makevars")
writeLines("CXX=$(BINPREF)ccache $(BINPREF)g++", "~/.R/Makevars")
writeLines("CXX11=$(BINPREF)ccache $(BINPREF)g++", "~/.R/Makevars")
writeLines("CXX14=$(BINPREF)ccache $(BINPREF)g++", "~/.R/Makevars")
writeLines("CXX17=$(BINPREF)ccache $(BINPREF)g++", "~/.R/Makevars")

from rtools-packages.

jeroen avatar jeroen commented on August 30, 2024

It seems necessary to install in both {mingw32,mingw64}/{bin,lib}; installing via pacman -U puts it into /usr/{bin,lib},

You are confusing mingw-packages with msys-packages. The latter are only used for the msys build environment itself, they are not useful for building native windows software like R.

You probably want to port this one: https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-ccache

from rtools-packages.

krlmlr avatar krlmlr commented on August 30, 2024

I successfully ported the mingw package you pointed to, happy to submit a PR. The package gets installed in /usr though, I believe we need it to live in /c/rtools40/{mingw32,mingw64} so that it is used by makepkg-mingw .

from rtools-packages.

jeroen avatar jeroen commented on August 30, 2024

If you build with makepkg-mingw it will be installed in /mingw{32,64}

from rtools-packages.

krlmlr avatar krlmlr commented on August 30, 2024

Confirmed, I need to run pacman -U for both files created.

Will report with what is needed to enable ccache for building packages.

from rtools-packages.

krlmlr avatar krlmlr commented on August 30, 2024

I have now successfully taught makepkg-mingw to use ccache -- need to set PATH in makepkg*.conf. The instructions in the ArchLinux documentation at https://wiki.archlinux.org/index.php/Ccache didn't work for me.

What's the best way to instruct R to use ccache for building R packages? Per https://github.com/r-windows/docs/blob/master/faq.md#how-does-r-find-compilers it won't be picked up from the $PATH. Should we tweak etc/*/Makeconf in R's installation, is there a better way?

An alternative way of running ccache is to replace gcc, g++ etc. with symlinks to the ccache binary. Need to ensure that the correct symlinks are restored when uninstalling ccache.

from rtools-packages.

krlmlr avatar krlmlr commented on August 30, 2024

Thanks. Achieving great results with the following combo:

dir.create("~/.R")

vars <- c("CC", "CXX", "CXX11", "CXX14", "CXX17")
code <- paste0(vars, " := $(BINPREF)ccache $(", vars, ")")

writeLines(code, "~/.R/Makevars")

writeLines(
  c(
    'PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"',
    paste0('MAKEFLAGS="-O -j', parallel::detectCores() + 1, '"')
  ),
  con = "~/.Renviron"
)

PR follows.

from rtools-packages.

krlmlr avatar krlmlr commented on August 30, 2024

Can't install ccache on a fresh rtools40 install. pacman -Q doesn't list it. Any ideas?

from rtools-packages.

jeroen avatar jeroen commented on August 30, 2024

I haven't synced to CRAN yet. If you want to install now, edit the files c:/rtools40/etc/pacman.d/mingw{64,32}.conf and comment-out the cran mirrors, so that you use the bintray mirror, and then do pacman -Su.

from rtools-packages.

krlmlr avatar krlmlr commented on August 30, 2024

When do you plan to sync next?

from rtools-packages.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.