2

I'm trying to install the markdown package from CRAN in my RStudio version "Spotted Wakerobin" that uses R version 4.2.1, but I get the following error:

C:\rtools42\usr\bin\gcc  -I"C:/PROGRA~1/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c Rbase64.c -o Rbase64.o
/bin/sh: line 1: C:rtools42usrbingcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.1/etc/x64/Makeconf:253: Rbase64.o] Error 127
ERROR: compilation failed for package 'markdown'
* removing 'C:/Program Files/RPackages/markdown'
Warning in install.packages :
  installation of package ‘markdown’ had non-zero exit status

Seems like it can't find something that's supposed to be there, which might be related to the gcc. This is my gcc version info:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/rtools42/x86_64-w64-mingw32.static.posix/bin/../libexec/gcc/x86_64-w64-mingw32.static.posix/10.4.0/lto-wrapper.exe
Target: x86_64-w64-mingw32.static.posix
Configured with: /root/mxe/tmp-gcc-host-x86_64-w64-mingw32.static.posix/gcc-10.4.0/configure --host=x86_64-w64-mingw32.static.posix --target=x86_64-w64-mingw32.static.posix --build=x86_64-pc-linux-gnu --prefix=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --with-native-system-header-dir=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include --enable-languages=c,c++,objc,fortran --enable-version-specific-runtime-libs --with-gcc --with-gnu-ld --with-gnu-as --disable-nls --without-libiconv-prefix --disable-shared --disable-multilib --without-x --disable-win32-registry --enable-threads=posix --enable-libgomp --with-gmp=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --with-isl=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --with-mpc=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --with-mpfr=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --enable-libstdcxx-time target_configargs=XCFLAGS=-Wno-format
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.4.0 (GCC)

I've already set the following environment variables:

Variable Value
Path C:\Program Files\R\R-4.0.5\bin;C:\rtools42\usr\bin;
BINPREF C:\rtools42\x86_64-w64-mingw32.static.posix\bin\
R_HOME C:\Program Files\R\R-4.0.5\library\base\R\Rprofile
R_LIBS_USER C:\Program Files\RPackages
R_USER C:\Program Files\R\R-4.0.5
RTOOLS42_HOME C:\rtools42

And I'm wondering what to try next?

jay.sf
  • 60,139
  • 8
  • 53
  • 110
  • 1
    Please note, that this is a follow-up on [this discussion](https://stackoverflow.com/q/74119678/6574038). – jay.sf Oct 21 '22 at 06:50
  • are you sure that the R_USER environment variable points to the R version 4.0.5? In the introduction, you mention R Version 4.2.1. – hyman Oct 21 '22 at 07:01
  • Why do you have R 4.0.5 in your environment variables? – Roland Oct 21 '22 at 07:29
  • My PATH looks like this: `"C:\\rtools42/x86_64-w64-mingw32.static.posix/bin;C:\\rtools42/usr/bin;C:\\rtools40\\usr\\bin;C:\\Program Files\\R\\R-4.2.0\\bin\\x64;c:\\Rtools\\bin;c:\\Rtools\\mingw_32\\bin; ` Note the first entry, which is where gcc.exe can be found. I have never modified the PATH manually, it has all been done by the installers. Have you installed RTools using an administrator account? – Roland Oct 21 '22 at 07:32

1 Answers1

0

From your output it's clear C:\rtools42\usr\bin\gcc gets converted to C:rtools42usrbingcc.

This is because backslashes (\) are treated as escape characters.

Try using slashes (/) instead of backslashes (\) in your paths.

Alternatively you could also use double backslashes (\\), as this specifies the backslash with escape code, but I prefer slashes, because it works equally well when no escape character processing is done.

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40