autoconf complains "C compiler cannot create executables" on Linux Mint
Asked Answered
D

6

7

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?

Doxology answered 19/12, 2013 at 9:39 Comment(4)
This is simply GNU autoconf probing for your compiler's version. GCC not being able to create executables usually means that you do not have the development headers of Glibc installed, i.e. there is (almost) nothing in /usr/include.Mccollough
Hi Hristo, thanks for taking the time to comment. is there any further instruction you can give me regarding what i need to do? Do i just search for the dev headers and try to install them? Really unfamiliar with linux so please excuse my lack of understanding.Doxology
Never used Mint, but in Ubuntu (and afaik Mint is derived from Ubuntu) the package is called libc6-dev. You might need other development headers too though.Mccollough
Can you compile and execute a simple "hello world" program?Contrariwise
C
13

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.

Contrariwise answered 2/6, 2014 at 19:28 Comment(0)
J
3

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
Jingoism answered 5/9, 2017 at 20:50 Comment(0)
R
1

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.

Renarenado answered 18/1, 2017 at 10:22 Comment(1)
./configure --help lists a few more that affect it. You give the process which finding the reason. But what is your solution? empty CFLAGS?Larrylars
G
1

I faced the same error when installing python on RHEL 7. And Installing this lib is working for me:

yum install glibc-devel
yum install glibc-devel.i686
Ginzburg answered 17/9, 2020 at 2:16 Comment(0)
H
0

Thanks to Keith's hints. Met this problem twice. Initially it reports this in the shell print out:

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

But checking the config.log reviewed the real problem, it caused by the permssion issue of the Linux guest's vboxsf shared folder. Copying the build target folder to a non-shared folder fixed it.

configure:3995: ./conftest
./configure: line 3997: ./conftest: Permission denied
configure:3999: $? = 126
configure:4006: error: in `/home/my_virtual_box_shared_folder':
Heaviness answered 6/7, 2021 at 14:58 Comment(0)
F
0

My Understanding

I encounter this same issue. Here is my understanding:

  1. GCC(The one you try to install, denote gcc2) uses GCC(the existing old one in your system, denote gcc1) to compile itself.
  2. However, -V and -qversion are the older options, only available for the older version GCC.
  3. Your gcc1 doesn't have these options, then errors arise.

Attempt

  • Use your favorite editor to edit configure file.
  • Delete -V -qversion in the script.
  • ./configure
  • make

The above attempt works for me.

Thoughts

Why -V -qversion are in the configure?

  • The sake of backward compatibility.
Fisk answered 9/4 at 21:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.