Ubuntu – C compiler cannot create excecutables

compilinggccopenvpn

When I am trying to install a openvpn from a tarball ,
following error occurs

checking whether the C compiler works… no

configure: error: in `/home/shubhamd/Downloads/openvpn-2.3.2':
configure: error: C compiler cannot create executables

See `config.log' for more details

and the config.log is as follows :

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

It was created by OpenVPN configure 2.3.2, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure 

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

hostname = shubhamd
uname -m = x86_64
uname -r = 3.11.0-12-generic
uname -s = Linux
uname -v = #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013

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


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

configure:2873: checking for a BSD-compatible install
configure:2941: result: /usr/bin/install -c
configure:2952: checking whether build environment is sane
configure:3002: result: yes
configure:3143: checking for a thread-safe mkdir -p
configure:3182: result: /bin/mkdir -p
configure:3195: checking for gawk
configure:3211: found /usr/bin/gawk
configure:3222: result: gawk
configure:3233: checking whether make sets $(MAKE)
configure:3255: result: yes
configure:3339: checking build system type
configure:3353: result: x86_64-unknown-linux-gnu
configure:3373: checking host system type
configure:3386: result: x86_64-unknown-linux-gnu
configure:3418: checking for style of include used by make
configure:3446: result: GNU
configure:3517: checking for gcc
configure:3533: found /usr/bin/gcc
configure:3544: result: gcc
configure:3773: checking for C compiler version
configure:3782: gcc --version >&5
gcc (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1
Copyright (C) 2013 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:3793: $? = 0
configure:3782: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.1-10ubuntu8' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --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-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-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 --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 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) 
configure:3793: $? = 0
configure:3782: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3793: $? = 4
configure:3782: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3793: $? = 4
configure:3813: checking whether the C compiler works
configure:3835: gcc    conftest.c  >&5
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3839: $? = 1
configure:3877: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "OpenVPN"
| #define PACKAGE_TARNAME "openvpn"
| #define PACKAGE_VERSION "2.3.2"
| #define PACKAGE_STRING "OpenVPN 2.3.2"
| #define PACKAGE_BUGREPORT "openvpn-users@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define OPENVPN_VERSION_RESOURCE 2,3,2,0
| #define PACKAGE "openvpn"
| #define VERSION "2.3.2"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3882: error: in `/home/shubhamd/Downloads/openvpn-2.3.2':
configure:3884: error: C compiler cannot create executables
See `config.log' for more details

How to fix the error ?

Best Answer

It's likely you need to install the libc6-dev package. The errors you see indicate the linker (ld) is unable to link against the C library (and the object files it mentions, crt1.o for example, are part of this package).

I suggest you do sudo apt-get install build-essential, it will install, well, the essential tools and packages for basic builds to work. build-essential is a meta-package, which doesn't install any files of its own but depends on the required packages, so it's a safe bet to install it.

Related Question