When running install.packages("sass")
in Rstudio, the download succeeds but an error occurs in the compilation :
...
g++ -std=gnu++14 -Wall -O2 -std=c++11 -I /usr/local/lib/libsass/include -fPIC -c -o src/ast.o src/ast.cpp
In file included from src/ast.cpp:3:
src/sass.hpp:72:43: error: ‘SASS_STYLE_TO_CSS’ was not declared in this scope; did you mean ‘SASS_STYLE_TO_SASS’?
72 | const static Sass_Output_Style TO_CSS = SASS_STYLE_TO_CSS;
| ^~~~~~~~~~~~~~~~~
| SASS_STYLE_TO_SASS
make[1]: Leaving directory '/tmp/RtmpvBnS6X/R.INSTALLd6174d82af25/sass/src/libsass'
make[1]: *** [Makefile:229: src/ast.o] Error 1
make: *** [Makevars:7: libsass/lib/libsass.a] Error 2
ERROR: compilation failed for package ‘sass’
...
I have tried to install earlier versions of rstudio/sass with install_github
, as advised here, encountering the same compilation error.
(I need this package as a dependency for other ones, notably rmarkdown)
Here is my machine’s information (output of sessionInfo()
) :
R version 4.2.3 (2023-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS
...
2
Answers
As described in these slides (from this blog), I was able to install the package running those commands :
Thanks to this PPA, I can now install (any other) packages from the cran mirror with
apt
.first make sure you have the necessary development tools and libraries installed on your system with
then remove the latest version of LibSass
sudo apt-get remove libsass
then install itnow Install the ‘sass’ package in R
install.packages("sass")
if that still dont work try directly on the github
You can also try by installing the ‘sass’ package using the ‘devtools’ package in R:
first install the
devtools
package if not alreadyinstall.packages("devtools")
then load itlibrary(devtools)
and we try to install sassdevtools::install_github("rstudio/sass")
if still not maybe reach them on github