r-lib / ps

R package to query, list, manipulate system processes
https://ps.r-lib.org/
Other
77 stars 19 forks source link

Fail to upgrade ps from 1.7.1 to 1.7.2 on Linux #136

Closed Krommyon closed 1 year ago

Krommyon commented 1 year ago

My problem: I cannot upgrade the ps-package via update.packages()

* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
Error in file(con, "wb") : cannot open the connection
Calls: writeBin -> file
In addition: Warning message:
In file(con, "wb") :
  cannot open file 'src/error-codes.c': No such file or directory
Execution halted
** libs
gcc -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -flto=auto -Wall px.c -o px
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c init.c -o init.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c api-common.c -o api-common.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c common.c -o common.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c extra.c -o extra.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c dummy.c -o dummy.o
make: *** No rule to make target 'error-codes.o', needed by 'ps.so'.  Stop.
ERROR: compilation failed for package ‘ps’
* removing ‘***personal***/R/x86_64-suse-linux-gnu-library/4.2/ps’
* restoring previous ‘***personal***/R/x86_64-suse-linux-gnu-library/4.2/ps’

The downloaded source packages are in
    ‘/tmp/RtmpLgqjBR/downloaded_packages’
Warning message:
In install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  installation of package ‘ps’ had non-zero exit status

sessionInfo()

R version 4.2.2 (2022-10-31)
Platform: x86_64-suse-linux-gnu (64-bit)
Running under: openSUSE Tumbleweed

Matrix products: default
BLAS:   /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8    
 [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8   
 [7] LC_PAPER=en_US.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C      

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

loaded via a namespace (and not attached):
[1] compiler_4.2.2 tools_4.2.2    tcltk_4.2.2
gaborcsardi commented 1 year ago

Seems like the same issue as https://github.com/r-lib/ps/issues/133.

How did you install R?

gaborcsardi commented 1 year ago

I can't reproduce this in a container:

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-suse-linux-gnu (64-bit)
Running under: openSUSE Tumbleweed

and ps installs cleanly. So again, how did you install R?

Did you run install.packages() from a shell, or are you using RStudio or another IDE?

Can you try running install.packages("ps") from a terminal and include the full output?

Also, what's the output of R CMD config --all?

Krommyon commented 1 year ago

Hi Gabor, I installed R natively via sudo (su -) zypper install. I open R in my Linux Terminal. Then I use install.packages() and update.packages().

Can you try running install.packages("ps") from a terminal and include the full output?

Do you mean via shell? I have never done that before.

Here is the output, you asked for

R CMD config --all
CC = gcc
CFLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g
CPICFLAGS = -fpic
CPPFLAGS = -I/usr/local/include
CXX = g++ -std=gnu++14
CXXFLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g
CXXPICFLAGS = -fpic
CXX11 = g++
CXX11STD = -std=gnu++11
CXX11FLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g
CXX11PICFLAGS = -fpic
CXX14 = g++
CXX14STD = -std=gnu++14
CXX14FLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g
CXX14PICFLAGS = -fpic
CXX17 = g++
CXX17STD = -std=gnu++17
CXX17FLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g
CXX17PICFLAGS = -fpic
CXX20 = g++
CXX20STD = -std=gnu++20
CXX20FLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g
CXX20PICFLAGS = -fpic
DYLIB_EXT = .so
DYLIB_LD = gcc
DYLIB_LDFLAGS = -shared -fopenmp
FC = gfortran
FFLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g
FPICFLAGS = -fpic
FLIBS = -lgfortran -lm -lquadmath
FCFLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g
SAFE_FFLAGS = -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -msse2 -mfpmath=sse
OBJC =
OBJCFLAGS =
JAVA = /usr/lib64/jvm/jre-openjdk/bin/java
JAVAC =
JAVAH =
JAR =
JAVA_HOME = /usr/lib64/jvm/jre-openjdk
JAVA_LIBS =
JAVA_CPPFLAGS =
LDFLAGS = -flto=auto
SHLIB_CFLAGS =
SHLIB_CXXFLAGS =
SHLIB_CXXLD = g++ -std=gnu++14
SHLIB_CXXLDFLAGS = -shared
SHLIB_CXX11LD = g++ -std=gnu++11
SHLIB_CXX11LDFLAGS = -shared
SHLIB_CXX14LD = g++ -std=gnu++14
SHLIB_CXX14LDFLAGS = -shared
SHLIB_CXX17LD = g++ -std=gnu++17
SHLIB_CXX17LDFLAGS = -shared
SHLIB_CXX20LD = g++ -std=gnu++20
SHLIB_CXX20LDFLAGS = -shared
SHLIB_EXT = .so
SHLIB_FFLAGS =
SHLIB_LD = gcc
SHLIB_LDFLAGS = -shared
TCLTK_CPPFLAGS = -I/usr/include -I/usr/include
TCLTK_LIBS = -L/usr/lib64 -ltcl8.6 -L/usr/lib64 -ltk8.6 -L/usr/lib64 -lX11 -lXss -lXext
BLAS_LIBS = -L/usr/lib64/R/lib -lRblas
LAPACK_LIBS = -L/usr/lib64/R/lib -lRlapack
MAKE = make
LIBnn = lib64
AR = ar
NM = /usr/bin/nm -B
RANLIB = ranlib
LTO =
LTO_FC =
LTO_LD =

## The following variables are defunct
CPP CXXCPP
gaborcsardi commented 1 year ago

Do you mean via shell? I have never done that before.

No, just the complete output from R, if started from a terminal. So it works with install.packages() and it does not with update.packages()?

Krommyon commented 1 year ago

Here you go

> install.packages("ps")
Installing package into ‘/home/order/R/x86_64-suse-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://ftp.gwdg.de/pub/misc/cran/src/contrib/ps_1.7.2.tar.gz'
Content type 'application/octet-stream' length 129096 bytes (126 KB)
==================================================
downloaded 126 KB

* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
Error in file(con, "wb") : cannot open the connection
Calls: writeBin -> file
In addition: Warning message:
In file(con, "wb") :
  cannot open file 'src/error-codes.c': No such file or directory
Execution halted
** libs
gcc -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -flto=auto -Wall px.c -o px
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c init.c -o init.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c api-common.c -o api-common.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c common.c -o common.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c extra.c -o extra.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c dummy.c -o dummy.o
make: *** No rule to make target 'error-codes.o', needed by 'ps.so'.  Stop.
ERROR: compilation failed for package ‘ps’
* removing ‘/***personal***/R/x86_64-suse-linux-gnu-library/4.2/ps’
* restoring previous ‘/***personal***/R/x86_64-suse-linux-gnu-library/4.2/ps’

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

and

> update.packages(ask=T)
maps :
 Version 3.4.0 installed in /home/order/R/x86_64-suse-linux-gnu-library/4.2 
 Version 3.4.1 available at https://ftp.gwdg.de/pub/misc/cran
Update? (Yes/no/cancel) no
ps :
 Version 1.7.1 installed in /home/order/R/x86_64-suse-linux-gnu-library/4.2 
 Version 1.7.2 available at https://ftp.gwdg.de/pub/misc/cran
Update? (Yes/no/cancel) Yes
trying URL 'https://ftp.gwdg.de/pub/misc/cran/src/contrib/ps_1.7.2.tar.gz'
Content type 'application/octet-stream' length 129096 bytes (126 KB)
==================================================
downloaded 126 KB

* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
Error in file(con, "wb") : cannot open the connection
Calls: writeBin -> file
In addition: Warning message:
In file(con, "wb") :
  cannot open file 'src/error-codes.c': No such file or directory
Execution halted
** libs
gcc -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -flto=auto -Wall px.c -o px
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c init.c -o init.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c api-common.c -o api-common.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c common.c -o common.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c extra.c -o extra.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c dummy.c -o dummy.o
make: *** No rule to make target 'error-codes.o', needed by 'ps.so'.  Stop.
ERROR: compilation failed for package ‘ps’
* removing ‘/***personal***/R/x86_64-suse-linux-gnu-library/4.2/ps’
* restoring previous ‘/***personal***/R/x86_64-suse-linux-gnu-library/4.2/ps’

The downloaded source packages are in
    ‘/tmp/RtmpE9bJdF/downloaded_packages’
Warning message:
In install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  installation of package ‘ps’ had non-zero exit status

That is everything, I got.

gaborcsardi commented 1 year ago

Can you please try this from a terminal, from a shell, and send me the output? Thanks!

R -q -e 'download.packages("ps", ".")'

and then

R CMD INSTALL ps_1.7.2.tar.gz
Krommyon commented 1 year ago

Here you go

> R CMD INSTALL /###personal###/R/x86_64-suse-linux-gnu-library/ps.test/ps_1.7.2.tar.gz
* installing to library ‘/###personal###/R/x86_64-suse-linux-gnu-library/4.2’
* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
Error in file(con, "wb") : cannot open the connection
Calls: writeBin -> file
In addition: Warning message:
In file(con, "wb") :
  cannot open file 'src/error-codes.c': No such file or directory
Execution halted
** libs
gcc -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -flto=auto -Wall px.c -o px
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c init.c -o init.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c api-common.c -o api-common.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c common.c -o common.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c extra.c -o extra.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g  -c dummy.c -o dummy.o
make: *** No rule to make target 'error-codes.o', needed by 'ps.so'.  Stop.
ERROR: compilation failed for package ‘ps’
* removing ‘/###personal###/R/x86_64-suse-linux-gnu-library/4.2/ps’
* restoring previous ‘/###personal###/R/x86_64-suse-linux-gnu-library/4.2/ps’
###persona###@localhost:~> 
gaborcsardi commented 1 year ago

This must be something specific to OpenSUSE, but I have no clue what it could be.

Anyway, can you try this:

tar xzf ps_1.7.2.tar.gz
R CMD INSTALL ps

If this still fails, then this should work:

tar xzf ps_1.7.2.tar.gz
cd ps
R -s -f inst/tools/error-codes.R
echo > inst/tools/error-codes.R
R CMD INSTALL .
Krommyon commented 1 year ago

Thank you Gabor. I never ran into such a specific problem with R and Suse After unpacking with tar:

R CMD INSTALL ps
Warning: invalid package ‘ps’
Error: ERROR: no packages specified

Your second recommendation

cd ps
R -s -f inst/tools/error-codes.R
Error in file(con, "wb") : cannot open the connection
Calls: writeBin -> file
In addition: Warning message:
In file(con, "wb") :
  cannot open file 'src/error-codes.c': No such file or directory
Execution halted

unfortunately doesn't work either.

gaborcsardi commented 1 year ago
R -s -f inst/tools/error-codes.R
Error in file(con, "wb") : cannot open the connection
In addition: Warning message:
In file(con, "wb") :
  cannot open file 'src/error-codes.c': No such file or directory
Execution halted

Do you have an R profile or other config that changes the working directory? The src directory should be clearly there.

Can you add print(getwd()) to the top of the inst/tools/error-codes.R file and then run R -f inst/tools/error-codes.R again, and check the output?

Krommyon commented 1 year ago

Do you have an R profile or other config that changes the working directory?

Yes, it is automatically loaded at startup of R via Rprofile

Since you mentioned the non-standard working directory, I commented the according setwd line in Rprofile out, started R in the terminal, used install.packages("ps") -> It works! The same is true for the "maps" package. The issue, I had with another package is gone too. I have experienced this with a total of 3 packages out of dozens, while all others are fine. Is there a bug involved? Should I tell the other developers or is this my fault?

gaborcsardi commented 1 year ago

Yeah, it is an unusual thing to do. I can work around this in ps, but this is definitely not something that developers expect. Usually, if you start a process (shell, R, any process), it will not change the working directory.

Krommyon commented 1 year ago

OK Gabor. Thank you and keep up the good work!

gaborcsardi commented 1 year ago

Hmmm, I can't actually reproduce this. If I put setwd("/tmp") or even setwd(tempdir()) in my .Rprofile, then

R CMD INSTALL `pwd`/ps_1.7.2.9000.tar.gz

still works.