Error when installing stringfish in R/4.4.0
Hello, I am running into an issue when installing via install.packages("stringfish", type="source", configure.args="--with-simd=AVX2"):
** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location Error: package or namespace load failed for ‘stringfish’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/root/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-stringfish/00new/stringfish/libs/stringfish.so': /root/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-stringfish/00new/stringfish/libs/stringfish.so: undefined symbol: ZN2sf19pcre2_match_wrapperC1ERKS0 Error: loading failed Execution halted ERROR: loading failed
- removing ‘/root/R/x86_64-pc-linux-gnu-library/4.4/stringfish’
The downloaded source packages are in ‘/tmp/RtmpWKQ1NE/downloaded_packages’ Warning message: In install.packages("stringfish", type = "source", configure.args = "--with-simd=AVX2") : installation of package ‘stringfish’ had non-zero exit status
Hello, would need some more to go on. Is it possible to make this issue reproducible in a docker/VM?
I was also having errors installing stringfish on R4.4.x, but updating Rcpp (and RcppParallel) first solved them
Updating Rcpp also worked for me.
The default Rcpp on Ubuntu (installed with apt-get from https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40) is 1.0.8 (checked with Rcpp::getRcppVersion()) make a following error:
/usr/lib/R/site-library/Rcpp/include/Rcpp/print.h: In function ‘void Rcpp::warningcall(SEXP, const string&)’:
/usr/lib/R/site-library/Rcpp/include/Rcpp/print.h:30:19: error: format not a string literal and no format arguments [-Werror=format-security]
30 | Rf_warningcall(call, s.c_str());
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
make: *** [/usr/lib/R/etc/Makeconf:204: RcppExports.o] Error 1
Updating to Rcpp 1.0.13 (with install.packages("Rcpp") and without explicit deleting of apt package) resolved the problem and qs finally was installed.
@traversc, would you be willing to set minimum versions of Rcpp and RcppParallel in the DESCRIPTION? It is difficult to know what to do with a compilation error when it happens.
Looking again, I see you already set minimum versions, but maybe Rcpp >= 0.12.18.3 and RcppParallel >= 5.1.4 are too permissive?
I believe RcppParallel version is fine, but Rcpp should 1.0.12.
Relevant commit: https://github.com/RcppCore/Rcpp/commit/b90ab6589eb10ac0ca63b7b9346dcab6d78e8b3a
But this isn't an issue specific to this package (there was a missing formatter string in Rcpp::warn) and every package using Rcpp should set this as a minimum. If that is the case, is it necessary to specify here?
If that is the case, is it necessary to specify here?
Maybe not, if that's the issue. Tough to pin down on my end because I only see the error when I'm installing on R 4.4.0 in a big Docker container on GitHub Actions, and switching to the p3m binary avoids the issue entirely.
I got "undefined symbol" again on library(stringfish). The source versions of Rcpp and RcppParallel do not seem to matter, but if the binaries are out of sync, then problems ensue.
This comes up regularly when I build Docker containers with renv libraries containing stringfish. A reprex is at https://github.com/wlandau/stringfish-reprex/tree/main I have an renv.lock file:
{
"R": {
"Version": "4.5.0",
"Repositories": [
{
"Name": "CRAN",
"URL": "https://packagemanager.posit.co/cran/latest"
}
]
},
"Packages": {
"Rcpp": {
"Package": "Rcpp",
"Version": "1.0.13-1",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"methods",
"utils"
],
"Hash": "6b868847b365672d6c1677b1608da9ed"
},
"RcppParallel": {
"Package": "RcppParallel",
"Version": "5.1.9",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R"
],
"Hash": "f38a72a419b91faac0ce5d9eee04c120"
},
"renv": {
"Package": "renv",
"Version": "1.0.11",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"utils"
],
"Hash": "47623f66b4e80b3b0587bc5d7b309888"
},
"stringfish": {
"Package": "stringfish",
"Version": "0.16.0",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"Rcpp",
"RcppParallel"
],
"Hash": "b7eb79470319ae71d4b5ed9cd7bf7294"
}
}
}
and a simple .github/workflows/reprex.yaml file which just restores the library:
on: [push]
name: reprex
jobs:
reprex:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install renv.
run: install.packages("renv")
shell: Rscript {0}
- name: Restore packages.
run: renv::restore()
shell: Rscript {0}
the worker log shows an error loading the dynamic library:
# Downloading packages -------------------------------------------------------
- Querying repositories for available source packages ... Done!
- Downloading renv from RSPM ... OK [2.1 Mb in 0.29s]
- Downloading Rcpp from RSPM ... OK [2.1 Mb in 0.36s]
- Downloading RcppParallel from RSPM ... OK [1.8 Mb in 0.45s]
- Downloading stringfish from RSPM ... OK [414 Kb in 0.23s]
Successfully downloaded 4 packages in 2.8 seconds.
# Installing packages --------------------------------------------------------
- Installing renv ... OK [installed binary and cached in 0.32s]
- Installing Rcpp ... OK [installed binary and cached in 0.39s]
- Installing RcppParallel ... OK [installed binary and cached in 0.28s]
/opt/R/4.5.0/lib/R/bin/R --vanilla -s -f '/tmp/RtmpOdQyHl/renv-install-150a55e684eb.R'
================================================================================
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/runner/work/_temp/Library/.renv/1/stringfish/libs/stringfish.so':
/home/runner/work/_temp/Library/.renv/1/stringfish/libs/stringfish.so: undefined symbol: _ZN12RcppParallel14tbbParallelForEmmRNS_6WorkerEmi
Calls: loadNamespace -> library.dynam -> dyn.load
Execution halted
The versions of these packages are all compatible when built from the source:
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: false
- name: Install packages.
run: |
install.packages("remotes")
library(remotes)
install_version("Rcpp", version = "1.0.13-1")
install_version("RcppParallel", version = "5.1.9")
install_version("stringfish", version = "0.16.0")
shell: Rscript {0}
but the original dynamic library error surfaces when we use binaries of the same versions and the snapshot dates are different:
install.packages(
"stringfish",
repos = "https://packagemanager.posit.co/cran/__linux__/noble/2024-12-01"
)
install.packages(
"stringfish",
repos = "https://packagemanager.posit.co/cran/__linux__/noble/2024-12-01"
)
install.packages(
"stringfish",
repos = "https://packagemanager.posit.co/cran/__linux__/noble/2025-06-02"
)
Is there something that stringfish can do to be more resilient to old binaries of Rcpp and RcppParallel?
@wlandau thanks for the reprex, I'll comment on the renv issue for better visibility
Thanks for commenting on https://github.com/rstudio/renv/issues/2141. Seems to be a temporary issue due to changes in RcppParallel.