Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
271 views
in Technique[技术] by (71.8m points)

r - make install not working with R4.0.2 in conda env

I have a conda env with R4.0.2. When I tried to install R package zip I had problems with C compilation.

At first installation was failing as it could not find R.h. I had set C paths for R.h as described in https://stackoverflow.com/a/33573979, e.g. export CPATH=/home/kh/miniconda3/envs/rpy2_3/lib/R/include/ where the path leads to dir with R.h. However, I then got the below error. It seems that make install is not working properly. Any suggestions?

-o zip init.o miniz.o rzip.o zip.o unixutils.o
/bin/sh: line 2: -o: command not found
make: *** [/home/kh/miniconda3/envs/rpy2_3/lib/R/share/make/shlib.mk:6: zip] Error 127
ERROR: compilation failed for package 'zip'
* removing '/home/kh/miniconda3/envs/rpy2_3/lib/R/library/zip'


EDIT:

conda install r-zip (from within evn) does not work properly - I have R4.0.2 and conda installs zip from earlier version:

Error: package or namespace load failed for 'zip':
 package 'zip' was installed before R 4.0.0: please re-install it

regarding my shlib.mk, this are the contents. I will try to set the variables OBJECTS and SHLIB_LINK

cat /home/kh/miniconda3/envs/rpy2_3/lib/R/share/make/shlib.mk
## ${R_HOME}/share/make/shlib.mk

all: $(SHLIB)

$(SHLIB): $(OBJECTS)
    @if test  "z$(OBJECTS)" != "z"; then 
      echo $(SHLIB_LINK) -o $@ $(OBJECTS) $(ALL_LIBS); 
      $(SHLIB_LINK) -o $@ $(OBJECTS) $(ALL_LIBS); 
    fi

.PHONY: all shlib-clean

shlib-clean:
    @rm -Rf .libs _libs
    @rm -f $(OBJECTS) symbols.rds


## FIXME: why not Rscript?
symbols.rds: $(OBJECTS)
    @$(ECHO) "tools:::.shlib_objects_symbol_tables()" | 
      $(R_HOME)/bin/R --vanilla --no-echo --args $(OBJECTS)

EDIT What at the end worked was copying Makeconf file from freshly made env (as suggested before) and editing the paths to point to the correct env. I also reset the variables from above, but I am not sure if this was in fact needed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...