At 10:52 AM 3/4/02 -0300, [EMAIL PROTECTED] wrote:

>checking for C compiler default output... configure: error: C compiler
>cannot create executables

I typically get this error when I have configured GCC as a cross compiler
of some sort (for a different set of system libraries or for a different
CPU/Architecture). If it's a typical configure script then it means just
what it says it means, the script tried to compile a program (and probably
it compiled correctly) but then was unable to execute the output. Another
common cause of this is if for some reason your C compiler is not producing
output with the execute bit set by default. This can happen either if you
have a umask problem, or if you are running a script on a mounted
filesystem that doesn't support it (any read-only filesystem, any FAT
(DOS/Windows) filesystem, etc.). A good way to test this is to create a
little "hello world" program that requires dynamic linking, and see if you
can compile it and execute in the current directory. Something like:

--- CUT HERE ---

#include <stdio.h>
#include <math.h>

int main() {
        double foo;
        foo = 4.3;
        foo = sin( foo );
        printf( "Sin(4.3) = %lf\n", foo );
        return 0;
}

--- CUT HERE ---

Save that (in the same dir as the configure script) as "hello.c" then run

gcc -Wall -g -lm hello.c

To compile it and link it against the math library. It should create an
executable file called a.out, so you should then be able to run

./a.out

And see the output:

Sin(4.3) = -0.916166

And then you can safely delete hello.c and a.out. If all of this works then
the configure script you're trying to run is broken. Typical places I can
think of where it would fail:

If the compiler says something about being unable to include math.h, or
tells you that you have an "implicit definition" of anything, then your
header files and/or libraries are not installed correctly.

If the compiler tells you it is unable to resolve the reference to the
sin() function then your header files are probably fine, but your linker
and/or library files are screwed up.

If the program compiles successfully and when you run it you get an error
like "file not found" then you are probably configured to link (at compile
time) against a different set of libraries from those actually available at
run-time (usually because you've been cross-compiling for some other machine).

"ls -al a.out" should show you something like:
-rwxr-xr-x    1 cnww     users       21975 Mar  4 17:25 a.out

If the program compiles, but doesn't appear executable (i.e. the "x" bits
are not set in ls output) then you have a problem with the configuration of
the current directory.
--

The difference between genius and stupidity is that genius has its limits.



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to