[R-sig-Debian] Unable to install some R packages in Ubuntu 20.04--internal compiler error: Segmentation fault

Mazin Abdelghany m@z|n@@bde|gh@ny @end|ng |rom gm@||@com
Mon Apr 19 19:24:36 CEST 2021


Hello all,

I recently installed R onto my Ubuntu 20.04 install using the instructions
here: https://cran.r-project.org/bin/linux/ubuntu/. R works as expected.

However, while some packages have installed without issue (e.g., R.matlab),
there are many packages that have not been able to install. Each failed
install throws a very similar error message. As an example,
install.packages("utf8") throws:
```
during GIMPLE pass: ccp
as_utf8.c: In function ‘rutf8_as_utf8’:
as_utf8.c:128:1: internal compiler error: Segmentation fault
  128 | }
      | ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
make: *** [/usr/lib/R/etc/Makeconf:172: as_utf8.o] Error 1
ERROR: compilation failed for package ‘utf8’
```

As another example, install.packages("fansi") throws:
```
during GIMPLE pass: ccp
nchar.c: In function ‘FANSI_nzchar’:
nchar.c:85:1: internal compiler error: Segmentation fault
   85 | }
      | ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
make: *** [/usr/lib/R/etc/Makeconf:172: nchar.o] Error 1
ERROR: compilation failed for package ‘fansi’
```

I have tried reinstalling gcc-9, which has not helped. I had found that the
PATH in Sys.getenv("PATH") was pointing to a miniconda3 install on my
system, so updated that to
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/rstudio/bin/postback,
which also has not helped.

I posted a question to:
https://answers.launchpad.net/ubuntu/+question/696623 and it was suggested
that I use gcc-10 instead of gcc-9. I edited /usr/lib/R/etc/Makeconf and
replaced CC=-std=gnu99 with CC=gcc-10. This resolved the issue and the
packages that were throwing these errors were able to be installed.

After posting the question to Stackoverflow, it was made clear that this
was not a solution rather an obtuse workaround. It was recommended that I
send the question here for help.

Output of gcc -v:
```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
9.3.0-17ubuntu1~20.04'
--with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2
--prefix=/usr --with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
```

Output of sessionInfo() in R:
```
R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.0.5 tools_4.0.5
```

Thanks all for your help and advice.
Best,
Mazin

	[[alternative HTML version deleted]]



More information about the R-SIG-Debian mailing list