[R] Option "-shared" not being passed to gcc when installing packages

Simon Knapp @|eep|ngwe|| @end|ng |rom gm@||@com
Thu Sep 21 02:09:56 CEST 2023


When installing packages, the option "-shared" is not being passed to gcc
which hence fails, complaining that it cannot find main. When installing
"mgcv", for example, I get the output listed below, in which the last call
to gcc should contain the option "-shared".

This problem occurs for all of several other packages I have just tried to
install.

It has been a while since I've used R, and I'm not positive if I've ever
tried to install a package on this computer before, though I think I have.

I am using R version 4.3.1 (2023-06-16) -- "Beagle Scouts" on ubuntu 20.04

How might I fix this?

> install.packages("mgcv")
Installing package into ‘/home/<me>/R/x86_64-pc-linux-gnu-library/4.3’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/mgcv_1.9-0.tar.gz'
Content type 'application/x-gzip' length 1112050 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

* installing *source* package ‘mgcv’ ...
** package ‘mgcv’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c coxph.c -o coxph.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c davies.c -o davies.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c discrete.c -o discrete.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c gdi.c -o gdi.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c magic.c -o magic.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c mat.c -o mat.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c matrix.c -o matrix.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c mgcv.c -o mgcv.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c misc.c -o misc.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c mvn.c -o mvn.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c ncv.c -o ncv.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c qp.c -o qp.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c soap.c -o soap.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c sparse-smooth.c -o sparse-smooth.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c sparse.c -o sparse.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG    -fopenmp -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c tprs.c -o tprs.o
gcc -std=gnu99 -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o
mgcv.so coxph.o davies.o discrete.o gdi.o init.o magic.o mat.o matrix.o
mgcv.o misc.o mvn.o ncv.o qp.o soap.o sparse-smooth.o sparse.o tprs.o
-llapack -lblas -lgfortran -lm -lquadmath -fopenmp -L/usr/lib/R/lib -lR
/usr/bin/ld:
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in
function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: mgcv.so] Error 1
ERROR: compilation failed for package ‘mgcv’
* removing ‘/home/<me>/R/x86_64-pc-linux-gnu-library/4.3/mgcv’

The downloaded source packages are in
        ‘/tmp/RtmpI7uMoa/downloaded_packages’
Warning message:
In install.packages("mgcv") :
  installation of package ‘mgcv’ had non-zero exit status
>

Kind regards,
Simon Knapp

	[[alternative HTML version deleted]]



More information about the R-help mailing list