我正在尝试从头开始构建 Linux (LFS) 我只是在关注这本书https://www.linuxfromscratch.org/lfs/view/stable/chapter08/eudev.html
./configure
在 eudev 包中运行后出现此错误
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... no
configure: error: in `/sources/eudev-3.2.11':
configure: error: C compiler cannot create executables
See `config.log' for more details
这是config.log
更新:(更多详细信息)
root@lfs-host:/mnt/lfs/sources/eudev-3.2.11# cat ~/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 eudev configure 3.2.11, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ ./configure --prefix=/usr --bindir=/usr/sbin --sysconfdir=/etc --enable-manpages --disable-static
## --------- ##
## Platform. ##
## --------- ##
hostname = lfs-host
uname -m = x86_64
uname -r = 5.15.0-30-generic
uname -s = Linux
uname -v = #31-Ubuntu SMP Thu May 5 10:00:34 UTC 2022
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /mnt/lfs/tools/bin/
PATH: /usr/bin/
## ----------- ##
## Core tests. ##
## ----------- ##
configure:3272: looking for aux files: config.guess config.sub ltmain.sh missing install-sh compile
configure:3285: trying ./
configure:3314: ./config.guess found
configure:3314: ./config.sub found
configure:3314: ./ltmain.sh found
configure:3314: ./missing found
configure:3296: ./install-sh found
configure:3314: ./compile found
configure:3496: checking for gcc
configure:3528: result: /usr/bin/gcc
configure:3881: checking for C compiler version
configure:3890: /usr/bin/gcc --version >&5
gcc (GCC) 11.2.0
Copyright (C) 2021 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:3901: $? = 0
configure:3890: /usr/bin/gcc -v >&5
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/11.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr LD=ld --enable-languages=c,c++ --disable-multilib --disable-bootstrap --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (GCC)
configure:3901: $? = 0
configure:3890: /usr/bin/gcc -V >&5
gcc: error: unrecognized command-line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3901: $? = 1
configure:3890: /usr/bin/gcc -qversion >&5
gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:3901: $? = 1
configure:3890: /usr/bin/gcc -version >&5
gcc: error: unrecognized command-line option '-version'
gcc: fatal error: no input files
compilation terminated.
configure:3901: $? = 1
configure:3921: checking whether the C compiler works
configure:3943: /usr/bin/gcc -O3 -Wall conftest.c >&5
/usr/libexec/gcc/x86_64-pc-linux-gnu/11.2.0/cc1: error while loading shared libraries: /usr/lib/libz.so.1: file too short
configure:3947: $? = 1
configure:3987: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "eudev"
| #define PACKAGE_TARNAME "eudev"
| #define PACKAGE_VERSION "3.2.11"
| #define PACKAGE_STRING "eudev 3.2.11"
| #define PACKAGE_BUGREPORT "https://github.com/gentoo/eudev/issues"
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main (void)
| {
|
| ;
| return 0;
| }
configure:3992: error: in `/sources/eudev-3.2.11':
configure:3994: error: C compiler cannot create executables
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_env_BLKID_CFLAGS_set=
ac_cv_env_BLKID_CFLAGS_value=
ac_cv_env_BLKID_LIBS_set=
ac_cv_env_BLKID_LIBS_value=
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=/usr/bin/gcc
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-O3 -Wall'
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_KMOD_CFLAGS_set=
ac_cv_env_KMOD_CFLAGS_value=
ac_cv_env_KMOD_LIBS_set=
ac_cv_env_KMOD_LIBS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_PKG_CONFIG_LIBDIR_set=
ac_cv_env_PKG_CONFIG_LIBDIR_value=
ac_cv_env_PKG_CONFIG_PATH_set=
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=
ac_cv_env_PKG_CONFIG_value=
ac_cv_env_SELINUX_CFLAGS_set=
ac_cv_env_SELINUX_CFLAGS_value=
ac_cv_env_SELINUX_LIBS_set=
ac_cv_env_SELINUX_LIBS_value=
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=/usr/bin/gcc
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL=''
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR=''
AM_BACKSLASH=''
AM_DEFAULT_V=''
AM_DEFAULT_VERBOSITY=''
AM_V=''
AR=''
AUTOCONF=''
AUTOHEADER=''
AUTOMAKE=''
AWK=''
BLKID_CFLAGS=''
BLKID_LIBS=''
CC='/usr/bin/gcc'
CCDEPMODE=''
CFLAGS='-O3 -Wall'
CPP=''
CPPFLAGS=''
CSCOPE=''
CTAGS=''
CXX=''
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS=''
CYGPATH_W=''
DEFS=''
DEPDIR=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ENABLE_HWDB_FALSE=''
ENABLE_HWDB_TRUE=''
ENABLE_MANPAGES_FALSE=''
ENABLE_MANPAGES_TRUE=''
ENABLE_MTD_PROBE_FALSE=''
ENABLE_MTD_PROBE_TRUE=''
ENABLE_PROGRAMS_FALSE=''
ENABLE_PROGRAMS_TRUE=''
ENABLE_RULE_GENERATOR_FALSE=''
ENABLE_RULE_GENERATOR_TRUE=''
ETAGS=''
EXEEXT=''
FGREP=''
GPERF=''
GREP=''
HAVE_BLKID_FALSE=''
HAVE_BLKID_TRUE=''
HAVE_INTROSPECTION_FALSE=''
HAVE_INTROSPECTION_TRUE=''
HAVE_KMOD_FALSE=''
HAVE_KMOD_TRUE=''
HAVE_SELINUX_FALSE=''
HAVE_SELINUX_TRUE=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTALL_STRIP_PROGRAM=''
INTROSPECTION_CFLAGS=''
INTROSPECTION_COMPILER=''
INTROSPECTION_GENERATE=''
INTROSPECTION_GIRDIR=''
INTROSPECTION_LIBS=''
INTROSPECTION_MAKEFILE=''
INTROSPECTION_SCANNER=''
INTROSPECTION_TYPELIBDIR=''
KMOD_CFLAGS=''
KMOD_LIBS=''
LD=''
LDFLAGS=''
LIBM=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
M4=''
MAKEINFO=''
MANIFEST_TOOL=''
MKDIR_P=''
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE=''
PACKAGE_BUGREPORT='https://github.com/gentoo/eudev/issues'
PACKAGE_NAME='eudev'
PACKAGE_STRING='eudev 3.2.11'
PACKAGE_TARNAME='eudev'
PACKAGE_URL=''
PACKAGE_VERSION='3.2.11'
PATH_SEPARATOR=':'
PKG_CONFIG=''
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH=''
RANLIB=''
SED=''
SELINUX_CFLAGS=''
SELINUX_LIBS=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
UDEV_VERSION='243'
VERSION=''
ac_ct_AR=''
ac_ct_CC='/usr/bin/gcc'
ac_ct_CXX=''
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__fastdepCXX_FALSE=''
am__fastdepCXX_TRUE=''
am__include=''
am__isrc=''
am__leading_dot=''
am__nodep=''
am__quote=''
am__tar=''
am__untar=''
bindir='/usr/sbin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
girdir=''
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p=''
oldincludedir='/usr/include'
pdfdir='${docdir}'
pkgconfiglibdir=''
prefix='/usr'
program_transform_name='s,x,x,'
psdir='${docdir}'
rootlibdir=''
rootlibexecdir=''
rootprefix=''
rootrundir=''
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sharepkgconfigdir=''
sushell=''
sysconfdir='/etc'
target_alias=''
typelibsdir=''
udevconfdir=''
udevconffile=''
udevhwdbbin=''
udevhwdbdir=''
udevkeymapdir=''
udevkeymapforceredir=''
udevlibexecdir=''
udevrulesdir=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "eudev"
#define PACKAGE_TARNAME "eudev"
#define PACKAGE_VERSION "3.2.11"
#define PACKAGE_STRING "eudev 3.2.11"
#define PACKAGE_BUGREPORT "https://github.com/gentoo/eudev/issues"
#define PACKAGE_URL ""
configure: exit 77
root@lfs-host:/mnt/lfs/sources/eudev-3.2.11#
此错误适用于所有./configure
,而不仅仅是eudev
但我检查 gcc 工作正常
(lfs chroot) root:/sources/eudev-3.2.11# gcc
gcc: fatal error: no input files
compilation terminated.
答案1
所以我已经解决了我的问题,问题是我损坏了 lib 文件,libz.so.1
重点是我必须重新安装,zlib
感谢 @WhiteOwl 和 @Kusalananda 给了我线索,而且那个日志文件给了我们信息/usr/lib/libz.so.1: file too short
。
但是我无法使用时如何重新安装 zlib 呢./configure
?由于我是从头开始构建 Linux,因此我将 help 称为 lfs-host ubuntu
。并zlib-1.2.12.tar.xz
在 lfs-host 中解压后在 zlib 文件夹中运行此命令
./configure --prefix=/mnt/lfs/usr
注意:(--prefix
根据您安装 LFS 项目的位置进行更改)
现在我可以./configure
在 lfs chroot 环境中运行所有命令
答案2
配置脚本中有一些奇怪的东西。它尝试检查编译器的版本,但使用选项“-V”、“-qversion”和“-version”。正确的选项应该是“--version”。
我在日志中看到的另一个问题是 libz.so.1 文件损坏。尝试重新安装 zlib 软件包。