配置:错误:C 编译器无法创建可执行文件 - 安装 dvipng 时

配置:错误:C 编译器无法创建可执行文件 - 安装 dvipng 时

我一直在安装 dvipng 软件包。由于我遇到即使安装后也找不到 libkpathsea 的问题,我尝试按照说明进行操作(http://www.nongnu.org/dvipng/dvipng_2.html#Build_002finstall):

在某些计算机上,库将安装在不在链接器搜索路径中的目录中。这将在运行“./configure”时生成错误,表明它找不到 libgd 或 libkpathsea(很可能)。然后,您需要指定相应库的目标文件的路径。它们通常被称为“libgd.a”或“libgd.so”。如果它们位于例如“/usr/local/lib”中,则执行

./configure LDFLAGS=-L/usr/local/lib

如果该库可作为共享对象文件(“.so”)使用,则运行时链接器可能还需要被告知在哪里可以找到该库,然后使用

./configure LDFLAGS='-L/usr/local/lib -R/usr/local/lib'

这正是我的情况:我已经安装了 Latex 的库,并且在我的 lib 文件夹中有“libgd.a”或“libgd.so”。然而,当我尝试运行他提到的代码时,据报道:

checking for C compiler default output file name... configure: error: C compiler cannot create executables

我的 config.log 是:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by dvipng configure 1.9, which was
generated by GNU Autoconf 2.60.  Invocation command line was

  $ ./configure LDFLAGS=-L/usr/local/lib -R/usr/local/lib

## --------- ##
## Platform. ##
## --------- ##

hostname = dingshan-virtual-machine
uname -m = x86_64
uname -r = 5.4.0-29-generic
uname -s = Linux
uname -v = #33-Ubuntu SMP Wed Apr 29 14:32:27 UTC 2020

/usr/bin/uname -p = x86_64
/bin/uname -X     = unknown

/bin/arch              = x86_64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/texlive/2018/bin/x86_64-linux
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /snap/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1739: checking whether make sets $(MAKE)
configure:1760: result: yes
configure:1817: checking for gcc
configure:1833: found /usr/bin/gcc
configure:1844: result: gcc
configure:2082: checking for C compiler version
configure:2089: gcc --version >&5
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2092: $? = 0
configure:2099: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2) 
configure:2102: $? = 0
configure:2109: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2112: $? = 1
configure:2135: checking for C compiler default output file name
configure:2162: gcc   -L/usr/local/lib -R/usr/local/lib conftest.c  >&5
gcc: error: unrecognized command line option '-R'
configure:2165: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "dvipng"
| #define PACKAGE_TARNAME "dvipng"
| #define PACKAGE_VERSION "1.9"
| #define PACKAGE_STRING "dvipng 1.9"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define DEBUG 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:2204: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-L/usr/local/lib -R/usr/local/lib'
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_make_make_set=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ALLOCA=''
CC='gcc'
CFLAGS=''
CPP=''
CPPFLAGS=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FT2_CFLAGS=''
FT2_CONFIG=''
FT2_LIBS=''
GREP=''
GS=''
INSTALL_BIN_TARGET=''
INSTALL_DATA=''
INSTALL_INFO=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
KPSEWHICH=''
LDFLAGS='-L/usr/local/lib -R/usr/local/lib'
LIBOBJS=''
LIBS=''
LN_S=''
LTLIBOBJS=''
MAKEINFO=''
MAKEINFO_MACROS=''
OBJEXT=''
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_NAME='dvipng'
PACKAGE_STRING='dvipng 1.9'
PACKAGE_TARNAME='dvipng'
PACKAGE_VERSION='1.9'
PATH_SEPARATOR=':'
POW_LIB=''
PSFONTS_O=''
SET_MAKE=''
SHELL='/bin/bash'
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_NAME "dvipng"
#define PACKAGE_TARNAME "dvipng"
#define PACKAGE_VERSION "1.9"
#define PACKAGE_STRING "dvipng 1.9"
#define PACKAGE_BUGREPORT "[email protected]"
#define DEBUG 1

configure: exit 77

有人可以帮我吗?

答案1

忽略这-R部分,GCC 没有这个选项;另外,你不需要告诉./configure/usr/local/lib,所以

./configure

应该管用。

相关内容