skip to Main Content

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


  1. Chosen as BEST ANSWER

    As described in these slides (from this blog), I was able to install the package running those commands :

    export DEBIAN_FRONTEND=noninteractive
    apt update && apt install -y software-properties-common
    add-apt-repository -y ppa:c2d4u.team/c2d4u4.0+
    echo ”deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/” > /etc/apt/sources.list.d/cran.list
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
    apt update && apt install -y r-cran-sass
    
    

    Thanks to this PPA, I can now install (any other) packages from the cran mirror with apt .


  2. first make sure you have the necessary development tools and libraries installed on your system with

    sudo apt-get update
    sudo apt-get install -y build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev
    

    then remove the latest version of LibSass sudo apt-get remove libsass then install it

    git clone https://github.com/sass/libsass.git
    cd libsass
    git checkout tags/3.6.5 # Replace '3.6.5' with the latest version, if necessary
    make -j4
    sudo make install
    

    now Install the ‘sass’ package in R install.packages("sass")

    if that still dont work try directly on the github

    if (!requireNamespace("remotes", quietly = TRUE))
      install.packages("remotes")
    remotes::install_github("rstudio/sass")
    

    You can also try by installing the ‘sass’ package using the ‘devtools’ package in R:

    first install the devtools package if not already install.packages("devtools") then load it library(devtools) and we try to install sass devtools::install_github("rstudio/sass")

    if still not maybe reach them on github

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search