rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
1.02k stars 155 forks source link

renv::install("fmesher") failes with a segfault #1947

Open ThierryO opened 4 months ago

ThierryO commented 4 months ago

Installing fmesher inside an renv project with renv 1.0.7 fails with a segfault.

> renv::install("fmesher")
# Downloading packages -------------------------------------------------------
- Downloading fmesher from CRAN ...             OK [file is up to date]
Successfully downloaded 1 package in 3.4 seconds.

The following package(s) will be installed:
- fmesher [0.1.7]
These packages will be installed into "~/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu".

Do you want to proceed? [Y/n]: y

# Installing packages --------------------------------------------------------
- Installing fmesher ...                        FAILED
Error: Error installing package 'fmesher':
===================================

* installing *source* package ‘fmesher’ ...
** package ‘fmesher’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
using C++17
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c Rcpp_interface.cc -o Rcpp_interface.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c basis.cc -o basis.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c fmesher_helpers.cc -o fmesher_helpers.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c ioutils.cc -o ioutils.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c locator.cc -o locator.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c mesh.cc -o mesh.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c meshc.cc -o meshc.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c predicates.cc -o predicates.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c trees.cc -o trees.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c vector.cc -o vector.o
g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o fmesher.so RcppExports.o Rcpp_interface.o basis.o fmesher_helpers.o ioutils.o locator.o mesh.o meshc.o predicates.o trees.o vector.o -L/usr/lib/R/lib -lR
installing to /home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/staging/1/00LOCK-fmesher/00new/fmesher/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading

 *** caught segfault ***
address 0x6536b2b4a8f2, cause 'memory not mapped'
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault (core dumped)
ERROR: lazy loading failed for package ‘fmesher’
* removing ‘/home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/staging/1/fmesher’
install of package 'fmesher' failed [error code 1]
Traceback (most recent calls last):
12: renv::install("fmesher")
11: renv_install_impl(records)
10: renv_install_staged(records)
 9: renv_install_default(records)
 8: handler(package, renv_install_package(record))
 7: renv_install_package(record)
 6: withCallingHandlers(renv_install_package_impl(record), error = function(e) writef("FAILED"))
 5: renv_install_package_impl(record)
 4: r_cmd_install(package, path)
 3: r_exec_error(package, output, "install", status)
 2: abort(all)
 1: stop(fallback)

Using install.pacakges("fmesher") outside an renv project on the same machine works

> install.packages("fmesher")
Installing package into ‘/home/thierry/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/fmesher_0.1.7.tar.gz'
Content type 'application/x-gzip' length 1008688 bytes (985 KB)
==================================================
downloaded 985 KB

* installing *source* package ‘fmesher’ ...
** package ‘fmesher’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
using C++17
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c Rcpp_interface.cc -o Rcpp_interface.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c basis.cc -o basis.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c fmesher_helpers.cc -o fmesher_helpers.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c ioutils.cc -o ioutils.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c locator.cc -o locator.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c mesh.cc -o mesh.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c meshc.cc -o meshc.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c predicates.cc -o predicates.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c trees.cc -o trees.o
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -DFMESHER_WITH_R -I'/usr/lib/R/site-library/Rcpp/include'     -fpic  -g -O2 -ffile-prefix-map=/build/r-base-avGvPq/r-base-4.4.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -c vector.cc -o vector.o
g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o fmesher.so RcppExports.o Rcpp_interface.o basis.o fmesher_helpers.o ioutils.o locator.o mesh.o meshc.o predicates.o trees.o vector.o -L/usr/lib/R/lib -lR
installing to /home/thierry/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-fmesher/00new/fmesher/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (fmesher)

The downloaded source packages are in
    ‘/tmp/Rtmp0TF3QP/downloaded_packages’

> sessioninfo::session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.1 (2024-06-14)
 os       Ubuntu 22.04.4 LTS
 system   x86_64, linux-gnu
 ui       RStudio
 language nl_BE:nl
 collate  nl_BE.UTF-8
 ctype    nl_BE.UTF-8
 tz       Europe/Brussels
 date     2024-07-19
 rstudio  2024.04.2+764 Chocolate Cosmos (desktop)
 pandoc   3.1.8 @ /usr/bin/pandoc

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 ! package     * version date (UTC) lib source
 P cli           3.6.3   2024-06-21 [?] CRAN (R 4.4.1)
 R fortunes      1.5-4   <NA>       [?] <NA>
 P renv          1.0.7   2024-04-11 [?] CRAN (R 4.4.1)
 P rstudioapi    0.16.0  2024-03-24 [?] CRAN (R 4.4.0)
 P sessioninfo   1.2.2   2021-12-06 [?] CRAN (R 4.4.0)
 P yaml          2.3.9   2024-07-05 [?] CRAN (R 4.4.1)

 [1] /home/thierry/Insync/thierry.onkelinx@inbo.be/Google Drive/github_2023/projecten/anomalie-patrijs/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu
 [2] /home/thierry/.cache/R/renv/sandbox/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/9a444a72

 P ── Loaded and on-disk path mismatch.
 R ── Package was removed from disk.

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
``
ThierryO commented 4 months ago

A strange observation: Using renv::install("fmesher") outside the renv project does work. And after that renv::install("fmesher") inside the packages works again. I had to apply that trick to several packages in order to install them in a renv project.

kevinushey commented 4 months ago

That's very odd. Does it matter where the project is located? (For example, does this also occur if your renv project is placed outside of your Google Drive?)