Missing library for RStudio package

I am using RStudio and have installed all the needed R packages through nix. Within RStudio I am able to install R packages with the exception of open SSL; it traces back to curl. Installing specifically curl, the following error appears in RStudio’s console:

  • installing source package ‘curl’ …
    ** package ‘curl’ successfully unpacked and MD5 sums checked
    ** using staged installation
    Using PKG_CFLAGS=
    Using PKG_LIBS=-lcurl
    ------------------------- ANTICONF ERROR ---------------------------
    Configuration failed because libcurl was not found. Try installing:
  • deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
  • rpm: libcurl-devel (Fedora, CentOS, RHEL)
  • csw: libcurl_dev (Solaris)
    If libcurl is already installed, check that ‘pkg-config’ is in your
    PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
    is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars=‘INCLUDE_DIR=… LIB_DIR=…’

ERROR: configuration failed for package ‘curl’

  • removing ‘/home/sandor/R/x86_64-pc-linux-gnu-library/4.1/curl’
    Warning in install.packages :
    installation of package ‘curl’ had non-zero exit status

In my various readings and searches, R is looking for the curl library in the system. I have installed the following: curl-7.79.1, curlcpp-1.4, openssl-1.1.1l, and r-openssl-1.4.5. None of these packages solves the above error. I have installed a number of R packages successfully, e.g. dplyr.

Does anyone have a suggestion? I am probably overlooking the obvious…

Sandor

Installing a library from nixpkgs has no effect. All compilation related tasks should be performed inside nix-shell, and only nix-shell can provide libraries. Try again inside nix-shell -p curl.

For more details, FAQ/I installed a library but my compiler is not finding it. Why? - NixOS Wiki