web-dev-qa-db-fra.com

libpng: le compilateur C ne peut pas créer d'exécutable

J'essaie d'appeler la commande ./configure. Mais, cela montre cette erreur:

C compiler cannot create executables.

Voici la sortie:

checking for a BSD-compatible install... /home/linuxbrew/.linuxbrew/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /home/linuxbrew/.linuxbrew/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: C compiler cannot create executables
See `config.log' for more details

J'ai vérifié le config.log, il peut détecter le fichier gcc installé mais il ne trouve pas le fichier conftest.c. J'ai déjà essayé:

Sudo apt-get update
Sudo apt-get install build-essential

Mais cela montre toujours l'erreur. J'ai également vérifié que mon libc6 est déjà installé dans la version la plus récente.

Comment le résoudre?

C'est le 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 libpng configure 1.6.32, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure 

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

hostname = MP3C-ISIT-048
uname -m = x86_64
uname -r = 4.4.0-116-generic
uname -s = Linux
uname -v = #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018

/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: /home/shrinivasan/anaconda2/bin
PATH: /usr/local/MATLAB/R2016b/bin/matlab
PATH: /usr/local/cuda/bin
PATH: /home/linuxbrew/.linuxbrew/bin
PATH: /home/linuxbrew/.linuxbrew/sbin
PATH: /home/shrinivasan/bin
PATH: /home/shrinivasan/.local/bin
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
PATH: /usr/lib
PATH: /usr/local/cuda/bin


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

configure:2358: checking for a BSD-compatible install
configure:2426: result: /home/linuxbrew/.linuxbrew/bin/ginstall -c
configure:2437: checking whether build environment is sane
configure:2492: result: yes
configure:2643: checking for a thread-safe mkdir -p
configure:2682: result: /home/linuxbrew/.linuxbrew/bin/mkdir -p
configure:2689: checking for gawk
configure:2705: found /usr/bin/gawk
configure:2716: result: gawk
configure:2727: checking whether make sets $(MAKE)
configure:2749: result: yes
configure:2778: checking whether make supports nested variables
configure:2795: result: yes
configure:2925: checking whether to enable maintainer-specific portions of Makefiles
configure:2934: result: no
configure:3014: checking for gcc
configure:3030: found /usr/bin/gcc
configure:3041: result: gcc
configure:3270: checking for C compiler version
configure:3280: gcc --version >&5
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Copyright (C) 2015 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:3291: $? = 0
configure:3280: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,Java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-Java-awt=gtk --enable-gtk-cairo --with-Java-home=/usr/lib/jvm/Java-1.5.0-gcj-5-AMD64/jre --enable-Java-home --with-jvm-root-dir=/usr/lib/jvm/Java-1.5.0-gcj-5-AMD64 --with-jvm-jar-dir=/usr/lib/jvm-exports/Java-1.5.0-gcj-5-AMD64 --with-Arch-directory=AMD64 --with-ecj-jar=/usr/share/Java/Eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-Arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --Host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 
configure:3291: $? = 0
configure:3311: checking whether the C compiler works
configure:3333: gcc    conftest.c /media/Data/Libs >&5
/usr/bin/ld: cannot find /media/Data/Libs: File format not recognized
collect2: error: ld returned 1 exit status
configure:3337: $? = 1
configure:3375: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libpng"
| #define PACKAGE_TARNAME "libpng"
| #define PACKAGE_VERSION "1.6.32"
| #define PACKAGE_STRING "libpng 1.6.32"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define PACKAGE_URL ""
| #define PACKAGE "libpng"
| #define VERSION "1.6.32"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3380: error: in `/home/shrinivasan/Documents/anneke/software/libpng-1.6.32':
configure:3382: error: C compiler cannot create executables
See `config.log' for more details

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

ac_cv_env_CCASFLAGS_set=
ac_cv_env_CCASFLAGS_value=
ac_cv_env_CCAS_set=
ac_cv_env_CCAS_value=
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=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=set
ac_cv_env_LIBS_value=/media/Data/Libs
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_PNG_COPTS_set=
ac_cv_env_PNG_COPTS_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_path_install='/home/linuxbrew/.linuxbrew/bin/ginstall -c'
ac_cv_path_mkdir=/home/linuxbrew/.linuxbrew/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes

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

ACLOCAL='${Shell} /home/shrinivasan/Documents/anneke/software/libpng-1.6.32/missing aclocal-1.15'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR=''
AS=''
AUTOCONF='${Shell} /home/shrinivasan/Documents/anneke/software/libpng-1.6.32/missing autoconf'
AUTOHEADER='${Shell} /home/shrinivasan/Documents/anneke/software/libpng-1.6.32/missing autoheader'
AUTOMAKE='${Shell} /home/shrinivasan/Documents/anneke/software/libpng-1.6.32/missing automake-1.15'
AWK='gawk'
CC='gcc'
CCAS=''
CCASDEPMODE=''
CCASFLAGS=''
CCDEPMODE=''
CFLAGS=''
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DFNCPP=''
DLLTOOL=''
DO_INSTALL_LIBPNG_CONFIG_FALSE=''
DO_INSTALL_LIBPNG_CONFIG_TRUE=''
DO_INSTALL_LIBPNG_PC_FALSE=''
DO_INSTALL_LIBPNG_PC_TRUE=''
DO_INSTALL_LINKS_FALSE=''
DO_INSTALL_LINKS_TRUE=''
DO_PNG_PREFIX_FALSE=''
DO_PNG_PREFIX_TRUE=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
HAVE_CLOCK_GETTIME_FALSE=''
HAVE_CLOCK_GETTIME_TRUE=''
HAVE_LD_VERSION_SCRIPT_FALSE=''
HAVE_LD_VERSION_SCRIPT_TRUE=''
HAVE_SOLARIS_LD_FALSE=''
HAVE_SOLARIS_LD_TRUE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LIBOBJS=''
LIBS='/media/Data/Libs'
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MAINT='#'
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE='#'
MAKEINFO='${Shell} /home/shrinivasan/Documents/anneke/software/libpng-1.6.32/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='/home/linuxbrew/.linuxbrew/bin/mkdir -p'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='libpng'
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_NAME='libpng'
PACKAGE_STRING='libpng 1.6.32'
PACKAGE_TARNAME='libpng'
PACKAGE_URL=''
PACKAGE_VERSION='1.6.32'
PATH_SEPARATOR=':'
PNGLIB_MAJOR='1'
PNGLIB_MINOR='6'
PNGLIB_RELEASE='32'
PNGLIB_VERSION='1.6.32'
PNG_ARM_NEON_FALSE=''
PNG_ARM_NEON_TRUE=''
PNG_COPTS=''
PNG_INTEL_SSE_FALSE=''
PNG_INTEL_SSE_TRUE=''
PNG_MIPS_MSA_FALSE=''
PNG_MIPS_MSA_TRUE=''
PNG_POWERPC_VSX_FALSE=''
PNG_POWERPC_VSX_TRUE=''
PNG_PREFIX=''
POW_LIB=''
RANLIB=''
SED=''
SET_MAKE=''
Shell='/bin/bash'
STRIP=''
SYMBOL_PREFIX=''
VERSION='1.6.32'
ac_ct_AR=''
ac_ct_CC='gcc'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCCAS_FALSE=''
am__fastdepCCAS_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include=''
am__isrc=''
am__leading_dot='.'
am__nodep=''
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
binconfigs=''
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
Host=''
Host_alias=''
Host_cpu=''
Host_os=''
Host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${Shell} /home/shrinivasan/Documents/anneke/software/libpng-1.6.32/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
pkgconfigdir=''
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

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

/* confdefs.h */
#define PACKAGE_NAME "libpng"
#define PACKAGE_TARNAME "libpng"
#define PACKAGE_VERSION "1.6.32"
#define PACKAGE_STRING "libpng 1.6.32"
#define PACKAGE_BUGREPORT "[email protected]"
#define PACKAGE_URL ""
#define PACKAGE "libpng"
#define VERSION "1.6.32"

configure: exit 77
1
anne

Comme nous pouvons le constater dans le fichier config.log, gcc est appelé avec un argument supplémentaire /media/Data/Libs qu'il interprète comme un fichier de bibliothèque qu'il doit tenter de lier:

configure:3333: gcc    conftest.c /media/Data/Libs >&5
/usr/bin/ld: cannot find /media/Data/Libs: File format not recognized

En regardant plus loin, nous pouvons voir que cela est récupéré de votre environnement via le fichier ac_cv_env_LIBS_value de autoconf:

ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=set
ac_cv_env_LIBS_value=/media/Data/Libs
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=

Cela suggère que vous avez défini une variable d'environnement LIBS=/media/Data/Libs et que /media/Data/Libs est probablement un répertoire, son format n'est pas reconnu en tant que fichier de bibliothèque par ld.

Il est probable que LIBS=/media/Data/Libs ne soit pas lié à la construction de ce logiciel et LIBS est simplement un nom que vous avez utilisé pour une variable dans un autre contexte. C'est un bon rappel pour éviter les noms en majuscules pour de telles variables.

Pour l'instant, vous pouvez simplement exécuter unset LIBS dans le shell, puis réexécuter ./configure

1
steeldriver