Freetype not installed in Windows build

I'm updating the Github actions for the rgl package. My old actions were working, but didn't work in Ubuntu 20.x, so I started a new branch a while ago, but got distracted. I'm back to it today, and the new actions have lots of changes. It's working in Ubuntu-latest now, but the Windows build is broken: see Update actions to use Ubuntu 20.04 · dmurdoch/rgl@5d35c4b · GitHub . It appears that it isn't finding FreeType headers:

ext/ftgl/FTGL/ftgl.h:32:10: fatal error: ft2build.h: No such file or directory
   32 | #include <ft2build.h>
      |          ^~~~~~~~~~~~
compilation terminated.

My SystemRequirements field in DESCRIPTION looks like this:

SystemRequirements: OpenGL and GLU Library (Required for
    display in R.  See "Installing OpenGL support" in README.md.  
    Not needed if only browser displays using rglwidget() are wanted.),
    zlib (optional), libpng (>=1.2.9, optional), FreeType (optional),
    pandoc (>=1.14, needed for vignettes)

Does that need to change, or do I need to specifically mention FreeType in the action YAML?

Yes, your two choices are

  1. installing freetype manually on Windows, see here: actions/setup-r-dependencies at v2 · r-lib/actions · GitHub, or
  2. using Rtools42 by specifying
    rtools-version: 42
    
    for setup-r: actions/setup-r at v2 · r-lib/actions · GitHub

Thanks! The Rtools42 solution worked perfectly for r: 'release'. I guess I'll need the other solution for older versions.

Yes, for R 4.0 and 4.1 you need to install freetype manually, with pacman.

For earlier versions, you don't need to do anything, it is included in Rtools.

If you also use macOS, then you need to install freetype on that as well, manually, it is simplest with brew.

On Linux I think it should be installed automatically, and you don't need to do anything.

Linux and MacOS are easy, because the configure script works whether it is present or not. Windows is more trouble because it has a hard-coded configuration that requires it.