C 컴파일러가 작동하는지 확인하세요...아니요

C 컴파일러가 작동하는지 확인하세요...아니요

저는 처음부터 Linux(LFS)를 구축하려고 하는데 이 책을 따라하고 있었습니다.https://www.linuxfromscratch.org/lfs/view/stable/chapter08/eudev.html

./configureeudev 패키지에서 실행한 후 이 오류가 발생합니다.

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.xzlfs-host에서 압축을 푼 후 zlib 폴더에서 이 명령을 실행하세요.

./configure --prefix=/mnt/lfs/usr

참고: ( --prefixLFS 프로젝트를 설치한 위치에 따라 변경)

이제 ./configurelfs chroot 환경에서 모든 명령을 실행할 수 있습니다.

답변2

구성 스크립트에 이상한 점이 있습니다. 컴파일러 버전을 확인하려고 시도하지만 "-V", "-qversion" 및 "-version" 옵션이 사용됩니다. 올바른 옵션은 "--version"이어야 합니다.

로그에서 본 또 다른 문제는 손상된 libz.so.1 파일이었습니다. zlib 패키지를 다시 설치해 보세요.

관련 정보