Amazon Linux 2017.09.1出现gcc: error: libgomp.spec: No such file or directory错误。

7
我正在尝试在 Amazon Lightsail 实例(Amazon Linux 2017.09.1)上运行的 R 中安装 rJava 包。然而,我一直收到一个错误提示,称 gcc 无法找到 libgomp.spec 文件。
我已经定位到了该文件的路径 /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgomp.spec,并尝试设置符号链接到该文件,但是我无法确定符号链接应该放置在哪里,以便让 gcc 能够找到它。例如,下面这种方式似乎不起作用:
ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgomp.spec /usr/local/lib64/libgomp.spec

有人知道在哪里放置符号链接,以便gcc可以找到它吗?这个输出中可能有我不理解的提示:

    * installing *source* package ‘rJava’ ...
    ** package ‘rJava’ successfully unpacked and MD5 sums checked
    checking for gcc... gcc -m64 -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 -m64 -std=gnu99 accepts -g... yes
    checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -m64 -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 -m64 -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/include -I/usr/lib/jvm/java/include/linux'
    java libs   : '-L/usr/lib/jvm/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/RtmphGxVwl/R.INSTALL1d971c944ee1/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 -m64 -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 -m64 -std=gnu99 accepts -g... yes
    checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -m64 -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 -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c Rglue.c -o Rglue.o
    Rglue.c:847:13: warning: ‘new_jrectRef’ defined but not used [-Wunused-function]
     static SEXP new_jrectRef(JNIEnv *env, jobject a, const char *sig, SEXP dim ) {
                 ^~~~~~~~~~~~
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c arrayc.c -o arrayc.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c callJNI.c -o callJNI.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c callback.c -o callback.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c fields.c -o fields.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c init.c -o init.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c jri_glue.c -o jri_glue.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c loader.c -o loader.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c otables.c -o otables.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c rJava.c -o rJava.o
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I. -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c tools.c -o tools.o
    gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -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/jre/lib/amd64/server -ljvm -L/usr/lib64/R/lib -lR
    (cd ../jri && make)
    make[1]: Entering directory `/tmp/RtmphGxVwl/R.INSTALL1d971c944ee1/rJava/jri'
    make -C src JRI.jar
    make[2]: Entering directory `/tmp/RtmphGxVwl/R.INSTALL1d971c944ee1/rJava/jri/src'
    /usr/bin/javac -target 1.6 -source 1.6 -d . ../RConsoleOutputStream.java ../RFactor.java ../REXP.java ../Rengine.java ../RList.java ../Mutex.java ../package-info.java ../RMainLoopCallbacks.java ../RVector.java ../RBool.java
    warning: [options] bootstrap class path not set in conjunction with -source 1.6
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 warning
    /usr/bin/javah -d . -classpath . org.rosuda.JRI.Rengine
    gcc -m64 -std=gnu99 -c -o Rengine.o Rengine.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -fpic -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux -I/usr/include/R -I/usr/include/R
    gcc -m64 -std=gnu99 -c -o jri.o jri.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -fpic -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux -I/usr/include/R -I/usr/include/R
    gcc -m64 -std=gnu99 -c -o Rcallbacks.o Rcallbacks.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -fpic -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux -I/usr/include/R -I/usr/include/R
    gcc -m64 -std=gnu99 -c -o Rinit.o Rinit.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -fpic -I/usr/include/R -I/usr/include/R
    gcc -m64 -std=gnu99 -c -o globals.o globals.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -fpic -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux
    gcc -m64 -std=gnu99 -c -o rjava.o rjava.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux  -fpic -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/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 -m64 -std=gnu99 -o libjri.so Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o  -shared -L/usr/lib/jvm/jre/lib/amd64/server -ljvm -Wl,--export-dynamic -fopenmp -L/usr/local/lib64 -L/usr/lib64/R/lib -lR -ltre -lpcre -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n
    gcc: error: libgomp.spec: No such file or directory
    make[2]: *** [libjri.so] Error 1
    make[2]: Leaving directory `/tmp/RtmphGxVwl/R.INSTALL1d971c944ee1/rJava/jri/src'
    make[1]: *** [src/JRI.jar] Error 2
    make[1]: Leaving directory `/tmp/RtmphGxVwl/R.INSTALL1d971c944ee1/rJava/jri'
    make: *** [jri] Error 2
    ERROR: compilation failed for package ‘rJava’
4个回答

16

抱歉自己回答自己的问题,但是添加这三个符号链接使rJava能够在Amazon Linux 2017.09.1上安装:

ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgomp.spec /usr/lib64/libgomp.spec
ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgomp.a /usr/lib64/libgomp.a
ln -s /usr/lib64/libgomp.so.1.0.0 /usr/lib64/libgomp.so

1
请确保检查您安装的版本并相应地修改ln命令。此外,也许首先执行yum安装(在@GroovyP的回答中)会是一个好主意。确保您的链接版本和安装版本匹配。 - Les
这个方法适用于我使用的ruby 2.3.8在亚马逊Linux AMI 2018.03上安装rmagick 4.0.0版本。 - Kyle Ratliff
在我这里也起作用。不过我仍然想知道为什么 - GCC 有一个--disable-libgomp选项,所以我想知道我们是否真的需要libgomp。 - shevy

3

在安装rpy2时,我在Amazon Linux上遇到了相同的问题。sudo yum install gcc64解决了我的问题。


2
符号链接对我有用
ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgomp.spec /usr/lib64/libgomp.spec
ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgomp.a /usr/lib64/libgomp.a 
ln -s /usr/lib64/libgomp.so.1.0.0 /usr/lib64/libgomp.so

1

尝试安装 libgomp 和 ( libgomp-devlibgomp-devel)

# void Linux
xbps-install -Sy libgomp libgomp-devel
# Arch
pacman -Sy libgomp libgomp-devel
# debian
apt install libgomp libgomp-dev

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接