【问题标题】:Error Installing rJava | Makefile.all:38: recipe for target 'libjri.so' failed安装 rJava 时出错 | Makefile.all:38:目标“libjri.so”的配方失败
【发布时间】:2017-02-27 18:43:37
【问题描述】:

我在MRO 3.3.1 中安装 rJava 包时遇到问题,平台:x86_64-pc-linux-gnu(Ubuntu 16.04LTS 64 位)(错误消息如下)。

在报告了其他几个问题之后,我安装了 java-8-openjdk-*、java-8-oracle、liblzma-dev 等。我还尝试通过“conda install”安装 rJava,但它存储在 /anaconda3 目录中,我不知道如何将其提供给 MRO。

有什么线索吗?

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver    : '/usr/bin/jar'
compiler    : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : '-I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux'
java libs   : '-L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether JNI programs can be compiled... yes
checking JNI data types... ok
checking whether JRI should be compiled (autodetect)... yes
checking whether debugging output should be enabled... no
checking whether memory profiling is desired... no
checking whether threads support is requested... no
checking whether callbacks support is requested... no
checking whether JNI cache support is requested... no
checking whether headless init is enabled... no
checking whether JRI is requested... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/zzz.R
config.status: creating src/config.h
=== configuring in jri (/tmp/RtmpzZwPWE/R.INSTALL1f1038e0708d/rJava/jri)
configure: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local'  --cache-file=/dev/null --srcdir=.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking whether Java interpreter works... checking whether JNI programs can be compiled... yes
checking whether JNI programs can be run... yes
checking JNI data types... ok
checking whether Rinterface.h exports R_CStackXXX variables... yes
checking whether Rinterface.h exports R_SignalHandlers... yes
configure: creating ./config.status
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating run
config.status: creating src/config.h
** libs
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c Rglue.c -o Rglue.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c arrayc.c -o arrayc.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c callJNI.c -o callJNI.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c callback.c -o callback.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c fields.c -o fields.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c init.c -o init.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c jri_glue.c -o jri_glue.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c loader.c -o loader.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c otables.c -o otables.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c rJava.c -o rJava.o
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c tools.c -o tools.o
gcc -std=gnu99 -shared -L/usr/lib64/microsoft-r/3.3/lib64/R/lib -o rJava.so Rglue.o arrayc.o callJNI.o callback.o fields.o init.o jri_glue.o loader.o otables.o rJava.o tools.o -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm -L/usr/lib64/microsoft-r/3.3/lib64/R/lib -lR
(cd ../jri && make)
make[1]: Entering directory '/tmp/RtmpzZwPWE/R.INSTALL1f1038e0708d/rJava/jri'
make -C src JRI.jar
make[2]: Entering directory '/tmp/RtmpzZwPWE/R.INSTALL1f1038e0708d/rJava/jri/src'
/usr/bin/javac -target 1.4 -source 1.4 -d . ../package-info.java ../RFactor.java ../REXP.java ../Rengine.java ../RList.java ../Mutex.java ../RConsoleOutputStream.java ../RMainLoopCallbacks.java ../RVector.java ../RBool.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
/usr/bin/javah -d . -classpath . org.rosuda.JRI.Rengine
gcc -std=gnu99 -c -o Rengine.o Rengine.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DU_STATIC_IMPLEMENTATION -O2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/lib64/microsoft-r/3.3/lib64/R/include -I/usr/lib64/microsoft-r/3.3/lib64/R/include
gcc -std=gnu99 -c -o jri.o jri.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DU_STATIC_IMPLEMENTATION -O2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/lib64/microsoft-r/3.3/lib64/R/include -I/usr/lib64/microsoft-r/3.3/lib64/R/include
gcc -std=gnu99 -c -o Rcallbacks.o Rcallbacks.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DU_STATIC_IMPLEMENTATION -O2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/lib64/microsoft-r/3.3/lib64/R/include -I/usr/lib64/microsoft-r/3.3/lib64/R/include
gcc -std=gnu99 -c -o Rinit.o Rinit.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DU_STATIC_IMPLEMENTATION -O2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib64/microsoft-r/3.3/lib64/R/include -I/usr/lib64/microsoft-r/3.3/lib64/R/include
gcc -std=gnu99 -c -o globals.o globals.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DU_STATIC_IMPLEMENTATION -O2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux
gcc -std=gnu99 -c -o rjava.o rjava.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DU_STATIC_IMPLEMENTATION -O2 -g  -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux  -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux
rjava.c: In function ‘RJava_request_lock’:
rjava.c:22:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
   ^
rjava.c: In function ‘RJava_clear_lock’:
rjava.c:30:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
   ^
rjava.c: In function ‘RJava_request_callback’:
rjava.c:39:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong) * 3);
   ^
rjava.c: In function ‘RJava_init_ctrl’:
rjava.c:51:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
   ^
rjava.c:52:3: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
   read(resin, buf, sizeof(ptrlong) * 2);
   ^
gcc -std=gnu99 -o libjri.so Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o  -shared -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm -Wl,--export-dynamic -fopenmp  -L/usr/lib64/microsoft-r/3.3/lib64/R/lib -lR -lpcre -llzma -lbz2 -lz -lrt -ldl -lm -licui18n -licuuc -licudata -lstdc++ -licuuc -licui18n
/usr/bin/ld: cannot find -lpcre
/usr/bin/ld: cannot find -lbz2
collect2: error: ld returned 1 exit status
Makefile.all:38: recipe for target 'libjri.so' failed
make[2]: Leaving directory '/tmp/RtmpzZwPWE/R.INSTALL1f1038e0708d/rJava/jri/src'
make[2]: *** [libjri.so] Error 1
Makefile.all:21: recipe for target 'src/JRI.jar' failed
make[1]: Leaving directory '/tmp/RtmpzZwPWE/R.INSTALL1f1038e0708d/rJava/jri'
make[1]: *** [src/JRI.jar] Error 2
Makevars:14: recipe for target 'jri' failed
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/home/jeco/R/x86_64-pc-linux-gnu-library/3.3/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

【问题讨论】:

    标签: java r installation rjava


    【解决方案1】:

    您需要 libpcre 和 libbz2 的开发库。 您使用的是什么发行版? 假设它是基于 Debian 的,请尝试安装以下软件包:

    • libbz2-dev
    • libpcre3-dev 或 libpcre2-dev(不确定需要什么版本)

    例子:

    sudo apt-get install libbz2-dev libpcre3-dev
    

    【讨论】:

    • 伟大的@flg !经过将近一个月的努力解决这个问题,你终于在 44 分钟内给了我一个解决方案。非常感谢。
    【解决方案2】:

    这是我遇到的旧帖子,但我无法通过接受的答案解决问题。

    除了接受的答案之外,您可能还需要一些其他库。就我而言,我刚刚解决了它:

    sudo apt-get install liblzma-dev zlib1g-dev
    

    但可能需要其他人。你可能想检查https://github.com/rocker-org/rocker-versioned/issues/11

    【讨论】:

    • 在基于 Ubuntu 18.04 的 Linux Mint 上仍然存在问题,上面的所有库都存在,但仍然存在:/usr/bin/ld:找不到 -lpcre2-8 collect2:错误:ld 返回 1 退出状态 Makefile .all:35: 目标“libjri.so”的配方失败
    猜你喜欢
    • 2020-11-24
    • 2018-01-20
    • 2017-05-17
    • 1970-01-01
    • 2017-12-30
    • 1970-01-01
    • 2022-07-14
    • 2015-07-08
    • 2018-03-28
    相关资源
    最近更新 更多