-4

Every time I try to compile a configure sh, I am getting this error. It doesn't matter which one.
I installed and reinstalled g++ and cpp and many others. Here is an idea:

echo "void main(){printf(\"hello world\n\");}" |gcc -x c - -o /tmp/hello;/tmp/hello

<stdin>: In function ‘main’:
<stdin>:1:13: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
<stdin>:1:13: warning: incompatible implicit declaration of built-in function ‘printf’
<stdin>:1:13: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
bash: /tmp/hello: No such file or directory

config.log from one of the files.

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

configure:555: checking host system type
configure:577: checking host specific optimization flag
configure:593: checking for gcc
configure:706: checking whether the C compiler (gcc -O6 -fomit frame-pointer ) wor$
configure:722: gcc -o conftest -O6 -fomit-frame-pointer   conftest.c  1>&5
configure:719:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main(){return(0);}
 ^~~~
/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
configure: failed program was:

#line 717 "configure"

here is another 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 OpenFst configure 1.6.5, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ configure 

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

hostname = CybernetiX
uname -m = x86_64
uname -r = 4.14.0-kali1-amd64
uname -s = Linux
uname -v = #1 SMP Debian 4.14.2-1kali1 (2017-12-04)

/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: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin


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

configure:2373: checking for a BSD-compatible install
configure:2441: result: /usr/bin/install -c
configure:2452: checking whether build environment is sane
configure:2507: result: yes
configure:2658: checking for a thread-safe mkdir -p
configure:2697: result: /bin/mkdir -p
configure:2704: checking for gawk
configure:2720: found /usr/bin/gawk
configure:2731: result: gawk
configure:2742: checking whether make sets $(MAKE)
configure:2764: result: yes
configure:2793: checking whether make supports nested variables
configure:2810: result: yes
configure:2947: checking for style of include used by make
configure:2975: result: GNU
configure:3046: checking for gcc
configure:3062: found /usr/bin/gcc
configure:3073: result: gcc
configure:3302: checking for C compiler version
configure:3311: gcc --version >&5
gcc (Debian 7.2.0-18) 7.2.0
Copyright (C) 2017 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:3322: $? = 0
configure:3311: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-18' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --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 --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 --enable-default-pie --with-system-zlib --with-target-system-zlib --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 --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 7.2.0 (Debian 7.2.0-18) 
configure:3322: $? = 0
configure:3311: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3322: $? = 1
configure:3311: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:3322: $? = 1
configure:3342: checking whether the C compiler works
configure:3364: gcc    conftest.c  >&5
/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
configure:3368: $? = 1
configure:3406: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "OpenFst"
| #define PACKAGE_TARNAME "openfst"
| #define PACKAGE_VERSION "1.6.5"
| #define PACKAGE_STRING "OpenFst 1.6.5"
| #define PACKAGE_BUGREPORT "help@www.openfst.org"
| #define PACKAGE_URL ""
| #define PACKAGE "openfst"
| #define VERSION "1.6.5"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3411: error: in `/root/Downloads/openfst-1.6.5':
configure:3413: error: C compiler cannot create executables
See `config.log' for more details

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

ac_cv_env_CCC_set=
ac_cv_env_CCC_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_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_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_PYTHON_VERSION_set=
ac_cv_env_PYTHON_VERSION_value=
ac_cv_env_PYTHON_set=
ac_cv_env_PYTHON_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='/usr/bin/install -c'
ac_cv_path_mkdir=/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} /root/Downloads/openfst-1.6.5/missing aclocal-1.14'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR=''
AUTOCONF='${SHELL} /root/Downloads/openfst-1.6.5/missing autoconf'
AUTOHEADER='${SHELL} /root/Downloads/openfst-1.6.5/missing autoheader'
AUTOMAKE='${SHELL} /root/Downloads/openfst-1.6.5/missing automake-1.14'
AWK='gawk'
CC='gcc'
CCDEPMODE=''
CFLAGS=''
CPP=''
CPPFLAGS=''
CXX=''
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DLLTOOL=''
DL_LIBS=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
HAVE_BIN_FALSE=''
HAVE_BIN_TRUE=''
HAVE_COMPACT_FALSE=''
HAVE_COMPACT_TRUE=''
HAVE_COMPRESS_FALSE=''
HAVE_COMPRESS_TRUE=''
HAVE_CONST_FALSE=''
HAVE_CONST_TRUE=''
HAVE_FAR_FALSE=''
HAVE_FAR_TRUE=''
HAVE_GRM_FALSE=''
HAVE_GRM_TRUE=''
HAVE_LINEAR_FALSE=''
HAVE_LINEAR_TRUE=''
HAVE_LOOKAHEAD_FALSE=''
HAVE_LOOKAHEAD_TRUE=''
HAVE_MPDT_FALSE=''
HAVE_MPDT_TRUE=''
HAVE_NGRAM_FALSE=''
HAVE_NGRAM_TRUE=''
HAVE_PDT_FALSE=''
HAVE_PDT_TRUE=''
HAVE_PYTHON_FALSE=''
HAVE_PYTHON_TRUE=''
HAVE_SCRIPT_FALSE=''
HAVE_SCRIPT_TRUE=''
HAVE_SPECIAL_FALSE=''
HAVE_SPECIAL_TRUE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /root/Downloads/openfst-1.6.5/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='/bin/mkdir -p'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='openfst'
PACKAGE_BUGREPORT='help@www.openfst.org'
PACKAGE_NAME='OpenFst'
PACKAGE_STRING='OpenFst 1.6.5'
PACKAGE_TARNAME='openfst'
PACKAGE_URL=''
PACKAGE_VERSION='1.6.5'
PATH_SEPARATOR=':'
PYTHON=''
PYTHON_CPPFLAGS=''
PYTHON_EXEC_PREFIX=''
PYTHON_EXTRA_LDFLAGS=''
PYTHON_EXTRA_LIBS=''
PYTHON_LDFLAGS=''
PYTHON_PLATFORM=''
PYTHON_PREFIX=''
PYTHON_SITE_PKG=''
PYTHON_VERSION=''
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
VERSION='1.6.5'
ac_ct_AR=''
ac_ct_CC='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='include'
am__isrc=''
am__leading_dot='.'
am__nodep='_no'
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
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} /root/Downloads/openfst-1.6.5/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
libfstdir=''
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
pkgpyexecdir=''
pkgpythondir=''
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
pyexecdir=''
pythondir=''
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

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

/* confdefs.h */
#define PACKAGE_NAME "OpenFst"
#define PACKAGE_TARNAME "openfst"
#define PACKAGE_VERSION "1.6.5"
#define PACKAGE_STRING "OpenFst 1.6.5"
#define PACKAGE_BUGREPORT "help@www.openfst.org"
#define PACKAGE_URL ""
#define PACKAGE "openfst"
#define VERSION "1.6.5"

configure: exit 77"

root@CybernetiX:~/Downloads/openfst-1.6.5# bash configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... no configure: error: in /root/Downloads/openfst-1.6.5': configure: error: C compiler cannot create executables Seeconfig.log' for more details

up vote 0 down vote accept

root@CybernetiX:~/Downloads/julius-4.3.1# bash configure loading cache ./config.cache checking host system type... x86_64-unknown-linux-gnu checking host specific optimization flag... support/cflags.x86_64-unknown-linux-gnu checking for gcc... gcc checking whether the C compiler (gcc -O6 -fomit-frame-pointer ) works... no configure: error: installation or configuration problem: C compiler cannot create executables.

valiano
  • 16,433
  • 7
  • 64
  • 79
  • 1
    "*[...] C compiler [...]*" - then *please* do not tag this as `C++` – Fureeish Dec 27 '17 at 23:06
  • 2
    `void main(){printf("hello world\n");}` is neither a complete and valid c or c++ program, so what do you actually expect? – user0042 Dec 27 '17 at 23:10
  • 5
    You're missing `#include ` – Barmar Dec 27 '17 at 23:15
  • 2
    Start reading a good C book. And read the documeantion of the tools you use. – too honest for this site Dec 27 '17 at 23:45
  • not worried bout the hello crap. i just need to fix my compiler, to finish my ai – CybernetiX S3C Dec 28 '17 at 03:06
  • https://stackoverflow.com/questions/16437383/linker-error-gcc – MFisherKDX Dec 28 '17 at 03:36
  • @MFisherKDX i have seen this. no avail – CybernetiX S3C Dec 28 '17 at 03:41
  • 1
    I think you need to work out what the `this linker was not configured to use sysroots` message means. Warnings are just warnings; they do not prevent the code from linking. The linker prevents the code from linking because it isn't configured to use sysroots — whatever that means. Have you ever been able to compile and run a C program on this machine? If not, practice until you can. Reinstall the tools as necessary. – Jonathan Leffler Dec 28 '17 at 05:23
  • 1
    Note that a Google search on the error message comes up with a number of sources of information, including [Linker errorL `gcc`](https://stackoverflow.com/questions/16437383/linker-error-gcc) on SO. You either need a compiler that doesn't run the linker with the `--sysroot=…` option, or you need a linker that accepts the option. So, at the moment, you have a non-working compilation system. – Jonathan Leffler Dec 28 '17 at 05:30
  • yes, i knew this. i have my masters in cyber security. i know the dynamics of google. i have compiled many C programs as I said before. i have another machine running same everything and runs smoothly. if you read all i have entered in this page i have mentioned this earlier. i been working with linux since 1997. i have not come across this error. i have searched and found the usage --with-sysroot=/ but i still receive this error. this is a kali linux box with custom AI robot. building a robot to hack on its own. there already is almost everything on here i need. until this last 4 scripts. – CybernetiX S3C Dec 28 '17 at 06:16
  • i have uninstalled and reinstalled binutils and the proper c packages. i even tried to cmake this. same errors. but my completed machines works fine. i need to finish this one so i can experiment with them on each other. im also kali linux certified, just to get the noob talk out of the way. and i teach it as well. – CybernetiX S3C Dec 28 '17 at 06:41

2 Answers2

0

The line

  echo "void main(){printf(\"hello world\n\");}" |gcc -x c - -o /tmp/hello;/tmp/hello

will fail at the first statement

gcc -x c - -o /tmp/hello

because

void main(){ 
    printf("hello world\n");
}

isn't valid c or c++ code. Hence no executable generated, hence no executable to execute (/tmp/hello).

The simplest valid (shell embedded) c code I can think of to provide there would be

echo "#include <stdio.h>
int main(int argc, char* argv[]) {printf(\"hello world\n\");}" |
gcc -std=c99 -Wall -pedantic -x c - -o /tmp/hello; /tmp/hello   

See the Live Demo

user0042
  • 7,917
  • 3
  • 24
  • 39
0

Do you use a custom linker (ld)? It seems so (/usr/local/bin/ld). Gcc passes some options to the linker (--sysroot in this case) and they are not supported by the linker. You have to either rebuild binutils (where the linker comes from) or pass some options to gcc (I don't know what). Search the Web for that error message regarding the linker.

  • ld wasnt custom, and binutils was from MIT – CybernetiX S3C Dec 28 '17 at 06:22
  • also i am having same issue rebuilding binutils now. my brain hurts lol. a couple of decades of linux and this one is killing me. haha. did not have an issue on my other machine. – CybernetiX S3C Dec 28 '17 at 06:38
  • Make a wrapper of ld to remove unsupported options before invoking real ld. –  Dec 28 '17 at 06:48
  • How isn't ld custom? Why is it under /usr/local? You use kali, debian-based, you have linker as /usr/bin/ld –  Dec 28 '17 at 06:53
  • it was preinstalled. when i installed last working configure script it showed ld was installed. binutils not. thats where this problem started. it didnt have binutils already. so that script stopped there. i went to mit site and dug around google for the newest. matched it. dl it. and now i been getting above errors. i tried to grab from sources but not avail. thats why i had the dl version. i didnt configure it with sysroot at first. but each time i uninstall binutils it removes parts of kali packages and other shit i need. – CybernetiX S3C Dec 28 '17 at 07:01
  • i havent gotten much sleep either. so i could have screwed something up or missed something. this has been a 4 week project and 8 days of trying to figure this error out. cant even install binutils --with-sysroot=/ because i still have this error – CybernetiX S3C Dec 28 '17 at 07:04
  • im wondering if i rm the ld directory from where its at i will be able configure the binutils again.idk, im out of ideas. honestly burnt out. just a huge year long project for an experiment. – CybernetiX S3C Dec 28 '17 at 07:08