Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Doesn't install on Debian testing #22

Closed
EmmanuelCharpentier opened this issue Nov 9, 2021 · 15 comments
Closed

Doesn't install on Debian testing #22

EmmanuelCharpentier opened this issue Nov 9, 2021 · 15 comments

Comments

@EmmanuelCharpentier
Copy link

Seen this morning when trying to update spdep, which now entails installing spatialreg :

> install.packages("spatialreg")
Installation du package dans ‘/usr/local/lib/R/site-library’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/spatialreg_1.1-8.tar.gz'
Content type 'application/x-gzip' length 764534 bytes (746 KB)
==================================================
downloaded 746 KB

* installing *source* package ‘spatialreg’ ...
** package ‘spatialreg’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c eminmaxC.c -o eminmaxC.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c listw2Matrix.c -o listw2Matrix.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ml_sse.c -o ml_sse.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c mom_calc.c -o mom_calc.o
gcc -std=gnu99 -std=gnu11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o spatialreg.so eminmaxC.o init.o listw2Matrix.o ml_sse.o mom_calc.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-spatialreg/00new/spatialreg/libs
** R
** inst
** byte-compile and prepare package for lazy loading

 *** caught segfault ***
address 0x5568764bd5c1, cause 'memory not mapped'
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault
ERROR: lazy loading failed for package ‘spatialreg’
* removing ‘/usr/local/lib/R/site-library/spatialreg’

The downloaded source packages are in
	‘/tmp/Rtmpil1u9K/downloaded_packages’
Message d'avis :
Dans install.packages("spatialreg") :
  installation of package ‘spatialreg’ had non-zero exit status

As a consequence, spdep is not upgraded...

@rsbivand
Copy link
Member

rsbivand commented Nov 9, 2021

The relationship between spdep and spatialreg is described in r-spatial/spdep#31. All of spatialreg's CRAN checks are OK, as are my own checks locally - CRAN check r-release-linux-x86_64 is on Debian GNU/Linux testing, which I do not use. I'm afraid you will have to debug this yourself, or ask on R-sig-debian.

Since spatialreg uses BLAS and LAPACK, this might be an USE_FC_LEN_T issue, in which case please try to install spatialreg from github ("r-spatial/spatialreg") and report back - I can release the corrected version if need be.

Your set of CFLAGS may also be confusing, are you adding any to those of your installed R? For me, Fedora R installed from source:

$ R CMD config CFLAGS
-g -O2

Further, a binary for testing seems to be available too: https://packages.debian.org/bookworm/r-cran-spatialreg, so installation must work OK there.

@edzer
Copy link
Member

edzer commented Nov 9, 2021

On ubuntu:

R CMD config CFLAGS
-g -O2 -fdebug-prefix-map=/build/r-base-i2PIHO/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g

@EmmanuelCharpentier
Copy link
Author

The relationship between spdep and spatialreg is described in r-spatial/spdep#31. All of spatialreg's CRAN checks are OK, as are my own checks locally - CRAN check r-release-linux-x86_64 is on Debian GNU/Linux testing, which I do not use. I'm afraid you will have to debug this yourself, or ask on R-sig-debian.

Since spatialreg uses BLAS and LAPACK, this might be an USE_FC_LEN_T issue, in which case please try to install spatialreg from github ("r-spatial/spatialreg") and report back - I can release the corrected version if need be.```

Doesn't work :

> library(remotes)
> install_github("r-spatial/spatialreg")
Downloading GitHub repo r-spatial/spatialreg@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                            
2: CRAN packages only             
3: None                           
4: spdep (1.1-11 -> 1.1-12) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 3
   checking for file ‘/tmp/RtmpDnQsFo/remotes32a22899fde7/r-spatial-spatialreg-8✔  checking for file ‘/tmp/RtmpDnQsFo/remotes32a22899fde7/r-spatial-spatialreg-85ed3fb/DESCRIPTION’
─  preparing ‘spatialreg’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  installing the package to process help pages
         -----------------------------------
─  installing *source* package ‘spatialreg’ ...
   ** using staged installation
   ** libs
   gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -c eminmaxC.c -o eminmaxC.o
   gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -c init.c -o init.o
   gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -c listw2Matrix.c -o listw2Matrix.o
   gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -c ml_sse.c -o ml_sse.o
   gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -c mom_calc.c -o mom_calc.o
   gcc -std=gnu99 -std=gnu11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o spatialreg.so eminmaxC.o init.o listw2Matrix.o ml_sse.o mom_calc.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
   installing to /tmp/RtmpxGFHtR/Rinst3310846726798/00LOCK-spatialreg/00new/spatialreg/libs
   ** R
   ** inst
   ** byte-compile and prepare package for lazy loading
   
    *** caught segfault ***
   address 0x55b3bd7d2e04, cause 'memory not mapped'
   An irrecoverable exception occurred. R is aborting now ...
   Segmentation fault
   ERROR: lazy loading failed for package ‘spatialreg’
─  removing ‘/tmp/RtmpxGFHtR/Rinst3310846726798/spatialreg’
         -----------------------------------
   ERROR: package installation failed
Erreur : Failed to install 'spatialreg' from GitHub:
  System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
E> ** byte-compile and prepare package for lazy loading
E> 
E>  *** caught segfault ***
E> address 0x55b3bd7d2e04, cause 'memory not mapped'
E> An irrecoverable exception occurred. R is aborting now ...
E> Segmentation fault
E> ERROR: lazy loading failed for package ‘spatialreg’
E> * removing ‘/tmp/RtmpxGFHtR/Rinst3310846726798/spatialreg’
E>       -----------------------------------
E> ERROR: package installation failed

The same thing is observed if I ask for updating spdep...

Your set of CFLAGS may also be confusing, are you adding any to those of your installed R? For me, Fedora R installed from source:

$ R CMD config CFLAGS
-g -O2

FWIW :

charpent@zen-book-flip:~$ sudo R CMD config CFLAGS
[sudo] Mot de passe de charpent : 
-g -O2 -ffile-prefix-map=/build/r-base-PT7Nxy/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g

Further, a binary for testing seems to be available too: https://packages.debian.org/bookworm/r-cran-spatialreg, so installation must work OK there.

For historical reasons (my R habits predate the current millenium), I tend to use self-compiled packages...

@rsbivand
Copy link
Member

So the problem may be in your choice of CFLAGS. I can try to replicate, but do not run your OS, and probably have a different version of gcc (11.2.1).

@rsbivand
Copy link
Member

rsbivand commented Nov 11, 2021

On Fedora 34, gcc as stated:

* installing *source* package 'spatialreg' ...
** using staged installation
** libs
gcc -I"/home/rsb/topics/R/R412-share/lib64/R/include" -DNDEBUG   -I/usr/local/include  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -fpic  -g -O2  -c eminmaxC.c -o eminmaxC.o
gcc -I"/home/rsb/topics/R/R412-share/lib64/R/include" -DNDEBUG   -I/usr/local/include  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -fpic  -g -O2  -c init.c -o init.o
gcc -I"/home/rsb/topics/R/R412-share/lib64/R/include" -DNDEBUG   -I/usr/local/include  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -fpic  -g -O2  -c listw2Matrix.c -o listw2Matrix.o
gcc -I"/home/rsb/topics/R/R412-share/lib64/R/include" -DNDEBUG   -I/usr/local/include  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -fpic  -g -O2  -c ml_sse.c -o ml_sse.o
gcc -I"/home/rsb/topics/R/R412-share/lib64/R/include" -DNDEBUG   -I/usr/local/include  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -Wall -pedantic -fdiagnostics-color=always -fpic  -g -O2  -c mom_calc.c -o mom_calc.o
gcc -shared -L/home/rsb/topics/R/R412-share/lib64/R/lib -L/usr/local/lib64 -o spatialreg.so eminmaxC.o init.o listw2Matrix.o ml_sse.o mom_calc.o -L/home/rsb/topics/R/R412-share/lib64/R/lib -lRlapack -L/home/rsb/topics/R/R412-share/lib64/R/lib -lRblas -lgfortran -lm -lquadmath -L/home/rsb/topics/R/R412-share/lib64/R/lib -lR
installing to /home/rsb/topics/packages/github-r-spatial/spatialreg.Rcheck/00LOCK-spatialreg/00new/spatialreg/libs
** 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
** 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 (spatialreg)

I put the flags in Makevars, and see:

* checking compilation flags in Makevars ... WARNING
Non-portable flags in variable 'PKG_CFLAGS':
  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -g -Wall -pedantic -fdiagnostics-color=always

in CMD check which succeeds too. However, I didn't subvert the load flags.

@rsbivand
Copy link
Member

Package spatialreg_1.2-1.tar.gz is on its way to CRAN.

@rsbivand
Copy link
Member

Please raise this on R-sig-debian, there is nothing more that I can do, I think. You need someone who understands Debian build trains and packaging. I only install R and packages from source on Fedora, and binary R on Windows and macOS but packages on those platforms from source. The CFLAGS and LDFLAGS come from R CMD config on your platform.

@rsbivand
Copy link
Member

@edzer I cannot find out how to get rocker/geospatial to work. Please provide links and scripts to use docker to try to emulate this problem (I do not use docker at all). docker run --rm -ti rocker/geospatial gets stuck in an rocker/studio password trap, but docker run --rm -ti rocker/r-base lets me run R interactively, but of course installing the packages spatialreg depends on fails, because the remaining software is absent. All I need is to be able to run `R CMD INSTALL where the dependencies of spatialreg are satisfied, and better if the Debian version is the same as the one with problems here. @eddelbuettel ?

@edzer
Copy link
Member

edzer commented Nov 11, 2021

docker run -e PASSWORD=xxyy -p 8787:8787 --rm -ti rocker/geospatial

then point your browser to localhost:8787 and log in with rstudio and xxyy

@edzer
Copy link
Member

edzer commented Nov 11, 2021

Comes with:

Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1

@eddelbuettel
Copy link

My "reference" installation (to run all the reverse-depends) has no issue; this is Debian testing "always current by a day or two" with CRAN "always current by a day or two":

dirk@cloud-devel:~$ R_LIBS_USER=~/tmp/lib R        # ~/tmp/lib is where all the 'extra' packages go

R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

R> library(spatialreg)
Loading required package: spData
To access larger datasets in this package, install the spDataLarge package with: `install.packages('spDataLarge', repos='https://nowosad.github.io/drat/', type='source')`
Loading required package: Matrix
R> 

@rsbivand
Copy link
Member

rsbivand commented Nov 11, 2021

@edzer port already allocated - why on earth is rstudio involved, it just get in the way. Isn't the whole point to use CLI only? Can I install binaries of the spatialreg dependencies, if so how to start bash in rocket/r-base and how to use apt-get to get the binaries? Aha docker run --rm -ti rocker/geospatial bash works:

> install.packages("spatialreg", type="source", dependencies=c("Depends", "Imports", "LinkingTo"), repos="https://cloud.r-project.org")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/spatialreg_1.2-1.tar.gz'
Content type 'application/x-gzip' length 1190682 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

* installing *source* package ‘spatialreg’ ...
** package ‘spatialreg’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/local/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c eminmaxC.c -o eminmaxC.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c listw2Matrix.c -o listw2Matrix.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ml_sse.c -o ml_sse.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c mom_calc.c -o mom_calc.o
gcc -shared -L/usr/local/lib/R/lib -L/usr/local/lib -o spatialreg.so eminmaxC.o init.o listw2Matrix.o ml_sse.o mom_calc.o -lopenblas -lgfortran -lm -lquadmath -L/usr/local/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-spatialreg/00new/spatialreg/libs
** 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
** 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 (spatialreg)

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

So the Debian version in rocker/geospatial does not show the problem seen with "testing", right? The CFLAGS and load flags differ a good deal, certainly no -std= or -Wl on load.

@edzer
Copy link
Member

edzer commented Nov 11, 2021

why on earth is rstudio involved, it just get in the way.

Good point:

docker run -e PASSWORD=xxyy -p 8787:8787 --rm -ti rocker/geospatial /bin/bash

gives you a #

@EmmanuelCharpentier
Copy link
Author

Your set of CFLAGS may also be confusing, are you adding any to those of your installed R? For me, Fedora R installed from source:

$ R CMD config CFLAGS
-g -O2

They seem to come from /etc/R/Makeconf which, in Debian testing, comes in r-base-core.

Curiously, reinstalling the said r-base-core made me ableto install/upgrade spdep and spatialreg. I donot understand why...

Worth a ticket against r-base-core ?

Thank you for your help !

@rsbivand
Copy link
Member

From @eddelbuettel 's comment above, possibly not worth a ticket if subsequent builds now succeed, if I understand correctly.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants