FS#59523 - [gcc] g++ segfaults when compiling in R

Attached to Project: Arch Linux
Opened by Oleg (wvxvw) - Saturday, 04 August 2018, 08:36 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 09 August 2018, 19:10 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

I've updated and installed R package using:

pacman -Suy r

Then, I started the interpreter:

R

In interpreter, I then executed:

install.packages("ggplot2")

Answered "yes" to all prompts. Selected a mirror that's close to my location (it reproduces with other mirrors too).

This started installation process, during which g++ is required to compile:

g++ -I"/usr/include/R/" -DNDEBUG -I../inst/include/ -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -c Module.cpp -o Module.o

Which comes from Rcpp package.

And resulted in this failure:

Module.cpp: In function ‘SEXPREC* InternalFunction_invoke(SEXP)’:
Module.cpp:117:6: internal compiler error: Segmentation fault
SEXP InternalFunction_invoke(SEXP args) {
^~~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
make: *** [/usr/lib64/R/etc/Makeconf:168: Module.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/home/wvxvw/R/x86_64-pc-linux-gnu-library/3.5/Rcpp’
* installing *source* package ‘RColorBrewer’ ...
** package ‘RColorBrewer’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RColorBrewer)
* installing *source* package ‘dichromat’ ...
** package ‘dichromat’ successfully unpacked and MD5 sums checked
** R
** data
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (dichromat)
* installing *source* package ‘labeling’ ...
** package ‘labeling’ successfully unpacked and MD5 sums checked
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (labeling)
* installing *source* package ‘R6’ ...
** package ‘R6’ successfully unpacked and MD5 sums checked
** 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
* DONE (R6)
* installing *source* package ‘crayon’ ...
** package ‘crayon’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (crayon)
* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** libs

I have g++ version: g++ (GCC) 8.1.1 20180531

R version: R version 3.5.1 (2018-07-02) -- "Feather Spray"
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Thursday, 09 August 2018, 19:10 GMT
Reason for closing:  Works for me
Additional comments about closing:  no one can reproduce anymore
Comment by Maxim (mxfm) - Saturday, 04 August 2018, 12:19 GMT
The rest of the R output (after g++ segfault) is useless.
Comment by loqs (loqs) - Saturday, 04 August 2018, 18:27 GMT
What is the backtrace from the core dump?
Comment by loqs (loqs) - Thursday, 09 August 2018, 00:37 GMT
not sure if this is the same as  FS#59581 

#include <stdio.h>
//#include "tinycthread.h"
#include <threads.h>

int main() {
mtx_t mutex;
if (thrd_success != mtx_init(&mutex, mtx_plain | mtx_recursive)) {
fprintf(stderr, "Failed to create mutex\n");
return 1;
}
return 0;
}

gcc -pthread test.c
a.out works switch the include to "tinycthread.h" and "Failed to create mutex"
Comment by M. Edward (Ed) Borasky (znmeb) - Thursday, 09 August 2018, 01:29 GMT
I and others are also seeing problems with gcc 8.2.0 / glibc 2.28. See https://bugs.archlinux.org/task/59550 for some links.
Comment by M. Edward (Ed) Borasky (znmeb) - Thursday, 09 August 2018, 01:33 GMT
This may be a problem in an R library package, not GCC / glibc or R itself - see https://github.com/r-lib/later/issues/45#issuecomment-411591399
Comment by Eli Schwartz (eschwartz) - Thursday, 09 August 2018, 01:50 GMT
Trying to install r, then run install.packages("Rcpp") -- or install.packages("ggplot2") -- works fine for me in a fully up-to-date clean chroot. No compiler errors. Can you confirm whether this is still a problem? Is it possible that gcc 8.2.0 fixed this?

EDIT: the issue with "later" is not the same issue. First, that one I can reproduce, second, that one was a runtime error not a compiler error.
Comment by Oleg (wvxvw) - Thursday, 09 August 2018, 18:14 GMT
Unfortunately, I'm not able to reproduce this anymore. Also, coredumpctl cannot find the core dump for this incident. I don't think the dump was saved. However, now I know that xscreensaver crashes repeatedly.
Comment by M. Edward (Ed) Borasky (znmeb) - Thursday, 09 August 2018, 18:38 GMT
I can't reproduce it either with gcc 8.2.0 / glibc 2.28. I don't recall seeing it with 8.1.1 / 2.27 either though. I compile R packages every day in normal usage, and my workstation contains the whole tidyverse, devtools, the whole R Markdown / knitr stack and a bunch of deep learning, spatial and Bayesian packages. It's not quite all of CRAN, but it's a bunch.

Loading...