Dear Stackflow Community,
I’m trying to install the R "curl" package from source using a specialized R CMD INSTALL script on Debian 11 x86_64 machine. The source package downloads and build fine but when the linker tries to link libcurl to the source package, the linker can’t seem to find my libcurl package and the build fails. I’ve read others have had similar issues with not being able to local the libcurl package and have followed all prior suggested solutions (including ensuring I have the appropriate libcurl developement files downloaded from Debian distribution as noted in the resultant error message). R itself is installed and runs fine and can install packages from CRAN, but I need a source build for a special project.
Any suggestions? Thanks!
Here is the output of my attempt to build libcurl from source:
2
Answers
It’s arguably tricky, but it helps to step back:
There is an CRAN package called
curl
. If you look at its CRAN page you will notice the hintSystemRequirements: libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb)
Because on Unix / Linux system there is an (extremely popular, widely used) library called
curl
and on Debian you get it as a run-time via thelibcurl*
package (with different ssl implementations).And to build against the (C language)
curl
library (as opposed to the R package) you need (as the package says) the development packagelibcurl4-openssl-dev
Because this is hard, "we" (as Debian developers) also try to give you binary Debian package of the key CRAN packages. I think we up to a bit over 1000 of thousand of those (out of 18.7 thousand CRAN packages). So do
and you will get a pre-compiled
curl
package for CRAN along with whatever run-time dependencies your system does not (yet) have (R, the libcurl* I mentioned etc)Edit Full log in a Docker session using Debian testing (as that is how I build Rocker’s r-base image that is also the officual r-base):
I understand you are compiling R packages to WASM using webR. The R
curl
package is a wrapper for the libcurl C library. So in order to build a wasm version of this package, you probably first need to figure out how to get a wasm port of libcurl.This won’t be an easy task because WASM doesn’t have IO capabilities. I think the only networking that a wasm module can do by interacting with the JavaScript code that it was loaded from, and that limits you to fetch/websockets. I don’t see right now how libcurl could be ported to wasm, but maybe I am wrong.
But in short: I’m afraid it is impossible currently to compile the curl package, or other R packages requiring advanced networking, in webR right now. The webR port itself is patched to use XHR (ajax requests) for
download.file()
in order to supportinstall.packages()
and so on, but this is only a small subset of the capabilities of libcurl.