Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

autoconf complains "C compiler cannot create executables" on Linux Mint

I am trying to do an installations of Linux Mint 16 'petra' on both 32 and 64 bit installs.

I have no internet connection on my pc so have to install all additional software manually. Being a developer I thought I would attempt to install codeblocks with wxWidgets so followed the instructions found at:

http://wiki.codeblocks.org/index.php?ti

In order to perform the installation it appeared that i would need pre-requistites so following instructions found on https://developer.gnome.org/gtk3/stable ... lding.html downloaded glib 'stuff', unpacked and ran configure.

It's at this point that things fail. I get a message in the terminal stating that the C compiler cannot create executables and to see config.log for more details which contains (amongst other stuff) the following:

gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) 
configure:4072: $? = 0
configure:4061: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4072: $? = 4
configure:4061: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.

How do I diagnose these errors?

like image 792
user3118566 Avatar asked Dec 19 '13 09:12

user3118566


3 Answers

On some versions of gcc, the -V option tells it to use a specified version of the compiler -- but it requires an argument. It's documented here. The option appears to have been removed some time between 4.5.4 and 4.6.4.

But a configuration script like this is expected to do things that don't work, so it can determine what compiler it's using and what features it supports. It appears that at this point the script is not assuming that the compiler it's invoking is gcc; rather, it's trying a number of different options to get the compiler to report its own version number.

I think that the error message you've shown us:

gcc: error: unrecognized command line option '-V'

is not related to the problem you're encountering.

You need to focus on the portion of the log immediately preceding the error message that says the C compiler "cannot produce executables".

The first thing I'd try is to compile and execute a simple "hello, world" program. If that doesn't work, then you're missing something, and your compiler really doesn't work. If it does work, then you need to study the config.log file to see what's really causing the error.

I've sometimes hacked the configure script to print more information to track down problems like this. For example, it will generate and compiler a small C program; you can add code to save a copy of that C program and examine it separately.

like image 138
Keith Thompson Avatar answered Sep 28 '22 06:09

Keith Thompson


I ran into this error because my Linux distro didn't come with everything it needed to compile C programs. The build-essentials meta package gave me everything I needed.

sudo apt-get install build-essential
like image 36
steel Avatar answered Sep 28 '22 04:09

steel


I had a situation similar to this. The configure and other commands would work fine if I ran them directly from the shell. My situation was different. I was running a ./configure && make from another Makefile and the CFLAGS variable was set. This produced an error like yours. It was because of the CFLAGS variable. It affects the way configure works. Running ./configure --help lists a few more that affect it. Perhaps you should check if any of those are set.

like image 26
Noufal Ibrahim Avatar answered Sep 28 '22 05:09

Noufal Ibrahim