configure: error: C compiler cannot create executables

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

configure: error: C compiler cannot create executables

YuGiOhJCJ Mailing-List
Hello,

I am building a cross compiler (linux 32 bits -> windows 32 bits).
I have compiled and installed:
- i686-pc-mingw32-binutils-2.24.51-i486-1_ygo
- i686-pc-mingw32-gcc-4.9.1-i486-1_ygo (with mingwrt-4.0.3.1 and w32api-4.0.3.1 headers)

But when I try to configure the w32api library, I got an error:
$ ./configure --prefix=/usr/i686-pc-mingw32 --build=`./config.guess` --host=i686-pc-mingw32 --disable-nls
bash: ./config.guess: No such file or directory
configure: WARNING: unrecognized options: --disable-nls
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
checking for i686-pc-mingw32-gcc... i686-pc-mingw32-gcc
checking whether the C compiler works... no
configure: error: in `/tmp/build/w32api-4.0.3-1.mingw32-src':
configure: error: C compiler cannot create executables
See `config.log' for more details

As you can see, there is a missing "config.guess" file in the archive.
Also, the "--disable-nls" option is not available.
Maybe it can explain why the C compiler is recognize by the configure script as not working.

Do you have any idea why I am unable to compile this w32api please?

Thank you.
Best regards.

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: configure: error: C compiler cannot create executables

Keith Marshall
On 07/08/14 15:57, YuGiOhJCJ Mailing-List wrote:
> Hello,
>
> I am building a cross compiler (linux 32 bits -> windows 32 bits).
> I have compiled and installed:
> - i686-pc-mingw32-binutils-2.24.51-i486-1_ygo
> - i686-pc-mingw32-gcc-4.9.1-i486-1_ygo (with mingwrt-4.0.3.1 and w32api-4.0.3.1 headers)

I suggest you avoid mingwrt-4.x and w32api-4.x; Earnie has made a
veritable TARFUBAR of them.  Stick with mingwrt-3.20 and w32api-3.17

> But when I try to configure the w32api library, I got an error:
> $ ./configure --prefix=/usr/i686-pc-mingw32 --build=`./config.guess` --host=i686-pc-mingw32 --disable-nls
> bash: ./config.guess: No such file or directory

Hmm.  Are you trying to build in the top source directory?  GCC
expressly advises against this, and it isn't a good idea for the MinGW
support libraries either.  However, this isn't the real cause of this
problem: config.guess doesn't live in the top directory of the MinGW
support library source tree -- it lives in the build-aux subdir.

In any event, it doesn't really matter what you set $build to, as long
as it's reasonable.  Why not just set it explicitly?  For example, I
configure my cross-tools with:

  $ $top_srcdir/configure --host=mingw32 --build=x86_64-linux-gnu ...

> configure: WARNING: unrecognized options: --disable-nls

There's no NLS support in the MinGW runtime libraries, so there's no
reason for configure to handle this; you can safely ignore the warning,
or if you are configuring stand-alone, better yet maybe just don't pass
--disable-nls for this phase of configuration.

> configure: WARNING: if you wanted to set the --build type, don't use --host.
>     If a cross compiler is detected then cross compile mode will be used
> checking build system type... i686-pc-linux-gnu
> checking host system type... i686-pc-mingw32
> checking target system type... i686-pc-mingw32
> checking for i686-pc-mingw32-gcc... i686-pc-mingw32-gcc
> checking whether the C compiler works... no
> configure: error: in `/tmp/build/w32api-4.0.3-1.mingw32-src':
> configure: error: C compiler cannot create executables
> See `config.log' for more details
>
> As you can see, there is a missing "config.guess" file in the archive.

Nope.  See above.  You are looking in the wrong place.

> Also, the "--disable-nls" option is not available.

Again, see above.  It is not required.

> Maybe it can explain why the C compiler is recognize by the configure script as not working.
>
> Do you have any idea why I am unable to compile this w32api please?

Yes.  The configure script uses AC_PROG_CC, which tries to compile and
link an executable, to determine that EXEEXT should be .exe; linking
fails, because you don't yet have the necessary runtime libraries.  This
is a chicken-and-egg dilemma; it needs an aclocal.m4 work-around to
disable the EXEEXT check within AC_PROG_CC.

This is just one aspect which Earnie has broken; it isn't particularly
difficult to restore the work-around, but there's too much else broken
to make it worth fixing just this; it's better to stick with the 3.x
versions of the libraries.

--
Regards,
Keith.

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: configure: error: C compiler cannot create executables

YuGiOhJCJ Mailing-List
> On 07/08/14 15:57, YuGiOhJCJ Mailing-List wrote:
> > Hello,
> >
> > I am building a cross compiler (linux 32 bits -> windows 32 bits).
> > I have compiled and installed:
> > - i686-pc-mingw32-binutils-2.24.51-i486-1_ygo
> > - i686-pc-mingw32-gcc-4.9.1-i486-1_ygo (with mingwrt-4.0.3.1 and w32api-4.0.3.1 headers)
>
> I suggest you avoid mingwrt-4.x and w32api-4.x; Earnie has made a
> veritable TARFUBAR of them.  Stick with mingwrt-3.20 and w32api-3.17
>

OK, so following your suggestion, staying on mingwrt-3.20 and w32api-3.17 is working.
I was able to create a cross-compiler (linux 32 bits -> windows 32 bits) with this configuration:
- binutils-2.24.51
- gcc-4.9.1
- mingwrt-3.20.2
- w32api-3.17
Thank you.

For the remark about the "top source directory", I am not sure about that.
Someone else has already told me that my way to build my compiler was not good because I don't use the correct path.
Anyway, my method seems to work good because I am able to cross-compile, and that is my objective.
Now, I think I can improve that because I do not follow the gcc convention for the path.
But to be honest, I have never found an other way to build my cross-compiler.
When I follow my steps and using my path it works.
When I try to not using the "top source directory", I am a bit confused and it is often a failure (some headers or libraries not found and a cross-compiler that does not work at all).

That is my way I do (if you know how to improve it, let me know):
1) i686-pc-mingw32-binutils-2.24.51
$ ./configure --prefix=/usr --target=i686-pc-mingw32 --disable-nls
2) i686-pc-mingw32-mingwrt-3.20.2 (headers copy only)
$ mkdir -pv /usr/i686-pc-mingw32
$ mkdir -pv /usr/lib/gcc/i686-pc-mingw32/4.9.1
$ cp -rv include /usr/i686-pc-mingw32
$ cp -rv include /usr/lib/gcc/i686-pc-mingw32/4.9.1
3) i686-pc-mingw32-w32api-3.17 (headers copy only)
$ mkdir -pv /usr/i686-pc-mingw32
$ mkdir -pv /usr/lib/gcc/i686-pc-mingw32/4.9.1
$ cp -rv include /usr/i686-pc-mingw32
$ cp -rv include /usr/lib/gcc/i686-pc-mingw32/4.9.1
4) i686-pc-mingw32-gcc-4.9.1
$ ../gcc-4.9.1/configure --prefix=/usr --target=i686-pc-mingw32 --disable-shared --enable-languages=c --disable-nls
5) i686-pc-mingw32-w32api-lib-3.17
$ ./configure --prefix=/usr/i686-pc-mingw32 --build=`./config.guess` --host=i686-pc-mingw32 --disable-nls
6) i686-pc-mingw32-mingwrt-lib-3.20.2
$ ./configure --prefix=/usr/i686-pc-mingw32 --host=i686-pc-mingw32

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: configure: error: C compiler cannot create executables

Keith Marshall
On 08/08/14 00:22, YuGiOhJCJ Mailing-List wrote:
> That is my way I do (if you know how to improve it, let me know):

As I've noted before, there is a great deal wrong with this; see
interleaved comments below.

> 1) i686-pc-mingw32-binutils-2.24.51
> $ ./configure --prefix=/usr --target=i686-pc-mingw32 --disable-nls

Before we go any further, I would strongly recommend that you configure
--with-sysroot; if you omit it, your compiler may appear to work, most
of the time, but my experience has been mysterious malfunctions in some
aspects of the compiler operation -- code profiling, for example.

Secondly, I would strongly recommend that you keep your build separate
from your source directories; here's an approximation of how I do it:

  $ mkdir -p $HOME/cross-build
  $ cd $HOME/cross-build
  $ tar xf $HOME/downloads/binutils-2.24.tar.bz2
  $ tar xf ...

(and so on, for all required source packages).

Now, from hints in your procedure, I deduce that your objective is to
install into /usr/i686-pc-mingw32, (in which I assume you will have full
search and write permission for installation); thus you want
--with-sysroot=/usr/i686-pc-mingw32; let's define a convenience
variable, (which we need not export):

  $ SYSROOT=/usr/i686-pc-mingw32

Having made this choice, you then need to be aware of a ghastly hack, in
gcc/config/i386/mingw32.h within the GCC sources, which more or less
restricts your choice of installation path to --prefix=$SYSROOT/mingw,
and that your *first* action must be to place the MinGW headers into
this installation path:

  $ mkdir -p $SYSROOT/mingw
  $ cp -rp mingwrt-3.20-2-mingw32/include $SYSROOT/mingw
  $ cp -rp w32api-3.17-2-mingw32/include $SYSROOT/mingw

And only now, are you ready to configure, make, and install binutils:

  $ mkdir mingw32-cross-binutils
  $ cd mingw32-cross-binutils
  $ ../binutils-2.24/configure --with-sysroot=$SYSROOT \
  >   --prefix=$SYSROOT/mingw --target=i686-pc-mingw32 --disable-nls \
  >   && make && make install

> 2) i686-pc-mingw32-mingwrt-3.20.2 (headers copy only)
> $ mkdir -pv /usr/i686-pc-mingw32

This (above) needs to have already been done, before you begin to build
anything, but...

> $ mkdir -pv /usr/lib/gcc/i686-pc-mingw32/4.9.1

...this, you should not be doing at all, while...

> $ cp -rv include /usr/i686-pc-mingw32

...this should have been completed, *before* you commenced to configure
your cross-binutils, as I indicated above, and...

> $ cp -rv include /usr/lib/gcc/i686-pc-mingw32/4.9.1

...this is not just unnecessary -- it is completely wrong.

> 3) i686-pc-mingw32-w32api-3.17 (headers copy only)
> $ mkdir -pv /usr/i686-pc-mingw32

You already did this, but it should have been sooner, while...

> $ mkdir -pv /usr/lib/gcc/i686-pc-mingw32/4.9.1

...this is, once again, not something you should have done at all, and...

> $ cp -rv include /usr/i686-pc-mingw32

...this should also have been done, as I've indicated already, *before*
the cross-binutils configuration, build, and installation steps, and...

> $ cp -rv include /usr/lib/gcc/i686-pc-mingw32/4.9.1

...this is, once again, completely wrong.

So, if you've followed my procedure thus far, you now have the MinGW
system headers in the proper sysroot path, and you've progressed through
the cross-binutils build and installation; you are now ready to progress
to the *first stage* of the cross-gcc build.  However, before you jump
in to configure this, you should arrange for GMP, MPFR, and MPC to be
built concurrently; here's how I did it for gcc-4.8.2:

  $ cd $HOME/cross-build/gcc-4.8.2
  $ ln -s ../gmp-5.1.2 gmp
  $ ln -s ../mpfr-3.1.2 mpfr
  $ ln -s ../mpc-1.0.2 mpc

(Allegedly, you should be able to handle binutils in a similar fashion,
but I've never had any success with that, so I prefer to separate it
out, as I've described above).

In addition to this, you may also wish to consider applying patches; for
example, in MinGW.org's gcc-4.8.1 source bundle, I found:

  a) config.sub.patch
  b) gcc-4.8.1-mingw32.patch
  c) relocate.patch

Among these, I saw nothing of significant value in (a), so I ignored it.
 (b) and (c) appeared to have remained relevant, going forward to
gcc-4.8.2, so I applied them, (and subsequently reverted (c), when I
discovered how destructive it is -- it utterly broke the build -- so I
would advise you to avoid it like the plague).  In addition to these, I
also applied:

  d) ginclude-float.h.patch

which is attached hereto; you may wish to apply it too.

So, now on to the configuration of GCC itself:

> 4) i686-pc-mingw32-gcc-4.9.1
> $ ../gcc-4.9.1/configure --prefix=/usr --target=i686-pc-mingw32 --disable-shared --enable-languages=c --disable-nls

Here, you are correctly using an out-of-source build, but you are
missing --with-sysroot, and your --prefix=/usr is wrong; beyond that, I
see a dearth of other options, which I would like to have seen you
specify, as I did for gcc-4.8.2:

  $ mkdir $HOME/cross-build/mingw32-cross-gcc
  $ cd $HOME/cross-build/mingw32-cross-gcc
  $ ../gcc-4.8.2/configure --target=mingw32 \
  >   --with-sysroot=$SYSROOT --prefix=$SYSROOT/mingw \
  >   --enable-shared --enable-threads --disable-multilib \
  >   --disable-sjlj-exceptions --disable-win32-registry \
  >   --with-arch=i586 --with-tune=generic --with-dwarf2 \
  >   --enable-languages=c,c++ --disable-nls

(Yes, I know some of those likely have no effect; I just like to keep as
much consistency as possible, with MinGW.org's self-hosted builds).

At this point, you should be ready to invoke the stage 1 GCC build, and
installation; you haven't included your procedure here, but for the sake
of completeness, it should be:

  $ make all-gcc && make install-gcc

Once you've completed this, you must then build and install the mingwrt
and w32api installable library objects and libraries themselves, before
you can complete the GCC build.

> 5) i686-pc-mingw32-w32api-lib-3.17
> $ ./configure --prefix=/usr/i686-pc-mingw32 --build=`./config.guess` --host=i686-pc-mingw32 --disable-nls

Here, you have reverted to an in-source build, which is feasible but
strongly discouraged, and your --prefix is incorrect, (insofar as it
does not match the --with-sysroot location you should ideally be using
for the cross-binutils and cross-gcc builds).  Furthermore, you know
what your --build should be, so why waste resource on a heuristic and
possibly inaccurate determination, using config.guess?  Better:

  $ mkdir $HOME/cross-build/mingw32-w32api-build
  $ cd $HOME/cross-build/mingw32-w32api-build
  $ ../w32api-3.17-2-mingw32/configure --host=i686-pc-mingw32 \
  >   --build=i686-pc-linux-gnu --prefix=$SYSROOT/mingw

(note that your --disable-nls is inappropriate here; w32api does not
support it, so it is pointless to specify it).

After you've correctly configured thus, you should build and install:

  $ make && make install

> 6) i686-pc-mingw32-mingwrt-lib-3.20.2
> $ ./configure --prefix=/usr/i686-pc-mingw32 --host=i686-pc-mingw32

Perhaps you've omitted part of this, but it is incomplete.  It should be
similar to the case for w32api:

  $ mkdir $HOME/cross-build/mingw32-mingwrt-build
  $ cd $HOME/cross-build/mingw32-mingwrt-build
  $ ../mingwrt-3.20-2-mingw32/configure --host=i686-pc-mingw32 \
  >   --build=i686-pc-linux-gnu --prefix=$SYSROOT/mingw

  $ make && make install

and having completed all of this, thus far, you still have one final
step to complete:

  $ cd $HOME/cross-build/mingw32-cross-gcc
  $ make all && make install

--
Regards,
Keith.

------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe

ginclude-float.h.patch (779 bytes) Download Attachment