C compiler cannot create executables

957 views
Skip to first unread message

Jarred Sumner

unread,
Oct 25, 2011, 11:32:49 PM10/25/11
to RubyInstaller
Hi,

I downloaded the latest version of Ruby from RubyInstaller.org (ruby
1.9.2p290 (2011-07-09) [i386-mingw32]), and I want to build Ruby from
source with the Mingw64 compiler.

First, with CMD, a fresh copy of Windows 7 SP1 x64, and
RubyInstaller's Ruby 1.9.2p290 I downloaded the repository as a zip
archive. I then extracted it. After that, I ran "rake ruby19
dkver=mingw64-32-4.5.4" in CMD. That had an error, so I decided to
just try "rake ruby19". I got the same error.

Everything downloaded and extracted successfully (That's not the error
or an error).

I got an error while it was running configure on libffi.

The error was: "configure: error: C compiler cannot create
executables"

STDOUT said:
mkdir -p sandbox/ruby_1_9
"D:/Multimedia/Builds/rubyinstaller/sandbox/extract_utils/basic-
bsdtar.exe" -xf
"D:/Multimedia/Builds/rubyinstaller/downloads/ruby-1.9.2-p290.tar.bz2"
> NUL 2>&
1
cd D:/Multimedia/Builds/rubyinstaller
cp -r resources/icons/ruby-doc.ico resources/icons/ruby.ico resources/
icons/ruby
w.ico sandbox/ruby19_build
cd -
Temporarily enhancing PATH to include DevKit...
cd sandbox/src-libffi
sh -c "./configure --enable-static --disable-shared --prefix=D:/
Multimedia/Build
s/rubyinstaller/sandbox/libffi"
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
continue configure in default builddir "./i686-pc-mingw32"
....exec /bin/sh .././configure "--srcdir=.." "--enable-builddir=i686-
pc-mingw32
" "mingw32"
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/d/Multimedia/Builds/rubyinstaller/sandbox/src-
libffi/i686
-pc-mingw32':
configure: error: C compiler cannot create executables
See `config.log' for more details
rake aborted!
Command failed with status (77): [sh -c "./configure --enable-static --
disab...]

Tasks: TOP => ruby19 => interpreter:ruby19:configure =>
interpreter:ruby19:depen
dencies => ffi => dependencies:ffi:configure => D:/Multimedia/Builds/
rubyinstall
er/sandbox/.checkpoints/.ffi-configure
(See full trace by running task with --trace)

Is the git repository's version of rubyinstaller broken, or am I doing
something wrong?

Thanks,
Jarred Sumner

Luis Lavena

unread,
Oct 26, 2011, 10:03:13 AM10/26/11
to rubyin...@googlegroups.com
On Wed, Oct 26, 2011 at 12:32 AM, Jarred Sumner <Jar...@jantire.com> wrote:
> Hi,
>
> I downloaded the latest version of Ruby from RubyInstaller.org (ruby
> 1.9.2p290 (2011-07-09) [i386-mingw32]), and I want to build Ruby from
> source with the Mingw64 compiler.
>
> First, with CMD, a fresh copy of Windows 7 SP1 x64, and
> RubyInstaller's Ruby 1.9.2p290 I downloaded the repository as a zip
> archive. I then extracted it. After that, I ran "rake ruby19
> dkver=mingw64-32-4.5.4" in CMD. That had an error, so I decided to
> just try "rake ruby19". I got the same error.
>
> Everything downloaded and extracted successfully (That's not the error
> or an error).
>
> I got an error while it was running configure on libffi.
>
> The error was: "configure: error: C compiler cannot create
> executables"
>

> checking for gcc... gcc


> checking whether the C compiler works... no
> configure: error: in `/d/Multimedia/Builds/rubyinstaller/sandbox/src-
> libffi/i686
> -pc-mingw32':
> configure: error: C compiler cannot create executables
> See `config.log' for more details
> rake aborted!
> Command failed with status (77): [sh -c "./configure --enable-static --
> disab...]
>

> [...]

> Is the git repository's version of rubyinstaller broken, or am I doing
> something wrong?

Well, the error seems clear to me, for some reason libffi can't be
compiled with that compiler and will require some checking.

Can you attempt to build libffi outside RubyInstaller to determine if
the issue is that?

--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Jon

unread,
Oct 26, 2011, 10:48:07 AM10/26/11
to rubyin...@googlegroups.com

Interesting, I get a failure but a different failure signature when I try

rake ffi dkver=mingw64-32-4.5.4

...


Temporarily enhancing PATH to include DevKit...
cd sandbox/src-libffi

sh -c "./configure --enable-static --disable-shared --prefix=C:/projects/rubyinstaller-git/sandbox/libffi"


checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
continue configure in default builddir "./i686-pc-mingw32"

....exec /bin/sh .././configure "--srcdir=.." "--enable-builddir=i686-pc-mingw32" "mingw32"


checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes

checking for gcc... i686-w64-mingw32-gcc


checking whether the C compiler works... no

configure: error: in `/c/projects/rubyinstaller-git/sandbox/src-libffi/i686-pc-mingw32':


configure: error: C compiler cannot create executables
See `config.log' for more details
rake aborted!
Command failed with status (77): [sh -c "./configure --enable-static --disab...]

Tasks: TOP => ffi => dependencies:ffi:configure => C:/projects/rubyinstaller-git/sandbox/.checkpoints/.ffi-configure

...and my `config.log` looks like http://pastie.org/2762264 and briefly glancing over the first configure failure it appears to be library search path related as the compile test can't find important libs like `-lmsvcrt` and `-lkernel32`


Jon

---
blog: http://jonforums.github.com/
twitter: @jonforums

Most people die of a sort of creeping common sense, and discover when it
is too late that the only things one never regrets are one's mistakes.
- Oscar Wilde

Jon

unread,
Oct 26, 2011, 3:56:12 PM10/26/11
to rubyin...@googlegroups.com

Luis is right. There's something about our RubyInstaller + DevKit build environment that's causing the problem.

I'm able to build the same simple program via CMD.EXE after putting a `mingw64-32-4.5.4` DevKit on PATH. However, when I try to build using the following, I get the same configure test failure we both see.


*** FAILING SCENARIO ***

C:\projects\rubyinstaller-git>rake devkit:sh dkver=mingw64-32-4.5.4
mkdir -p C:/projects/rubyinstaller-git/sandbox/.checkpoints


...
Temporarily enhancing PATH to include DevKit...

sh-3.1$ cd /C/Users/Jon/Documents/CDev/sandbox/
sh-3.1$ cat conftest.c
int main()
{
;
return 0;
}
sh-3.1$ gcc --version
gcc.exe (GCC) 4.5.4 20110812 (prerelease)
Copyright (C) 2010 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.

sh-3.1$ gcc -o conftest.exe conftest.c
C:\projects\rubyinstaller-git\sandbox\devkit\mingw\bin/i686-w64-mingw32-ld.exe: cannot find crt2.o: No such file or directory
...
C:\projects\rubyinstaller-git\sandbox\devkit\mingw\bin/i686-w64-mingw32-ld.exe: cannot find -lmsvcrt
collect2: ld returned 1 exit status

*** PASSING SCENARIO ***

C:\Users\Jon\Documents\CDev\sandbox>\DevKit-w64\devkitvars.bat
Adding the DevKit to PATH...

C:\Users\Jon\Documents\CDev\sandbox>echo %PATH%
C:\DevKit-w64\bin;C:\DevKit-w64\mingw\bin;C:\Program Files\Gimp-2.7.4\bin;
...

C:\Users\Jon\Documents\CDev\sandbox>gcc --version
gcc (GCC) 4.5.4 20110812 (prerelease)
Copyright (C) 2010 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.

C:\Users\Jon\Documents\CDev\sandbox>type conftest.c
int main()
{
;
return 0;
}

C:\Users\Jon\Documents\CDev\sandbox>gcc -o conftest.exe conftest.c

Jon

unread,
Oct 28, 2011, 12:28:24 PM10/28/11
to RubyInstaller
On Oct 25, 11:32 pm, Jarred Sumner <Jar...@jantire.com> wrote:
> Hi,
>
> I downloaded the latest version of Ruby from RubyInstaller.org (ruby
> 1.9.2p290 (2011-07-09) [i386-mingw32]), and I want to build Ruby from
> source with the Mingw64 compiler.
>
> First, with CMD, a fresh copy of Windows 7 SP1 x64, and
> RubyInstaller's Ruby 1.9.2p290 I downloaded the repository as a zip
> archive. I then extracted it. After that, I ran "rake ruby19
> dkver=mingw64-32-4.5.4" in CMD. That had an error, so I decided to
> just try "rake ruby19". I got the same error.

Currently we only officially support the `tdm-32-4.5.2` DevKit
version, but we all want the MinGW-w64 version to work. It used to
work when I added the initial support, but a few things have changed
and it appears the problem has something to do with our environment.

Please open a new issue at https://github.com/oneclick/rubyinstaller/issues
so we don't forget to find a fix.

Thanks for testing things out and reporting the problem.

Jon

Justin Baker

unread,
Mar 1, 2012, 3:14:50 PM3/1/12
to rubyin...@googlegroups.com
Did this ever get a bug report?
I couldn't find one, but I wanted to make sure. 

Also I found Jon's post on building rubinius and tried doing it. 
I'm guessing that along the way instead of running deprefix.rb 
you guys just something else.

But if I do run deprefix.rb I get a linking error or something
while trying to test the C compiler:
collect2: cannot find 'ld'

That's really isn't a big deal though from the way it looks
like you guys set the folder up, but I thought I would post
it incase it is relevant.

If there isn't a bug report lemme know and I'll create one.

Jon

unread,
Mar 1, 2012, 3:57:36 PM3/1/12
to rubyin...@googlegroups.com
> Did this ever get a bug report?
> I couldn't find one, but I wanted to make sure.


I'm not sure if it got a bug report or is similar to https://github.com/oneclick/rubyinstaller/issues/76

Need a bit more info on what you're trying to do and your system. If you're trying to build for a 64bit Windows system you'll want to use the 64bit DevKit similar to

rake ruby19 dkver=tdm-64-4.6.1

and you can build a standalone 64bit DevKit like:

rake devkit dkver=tdm-64-4.6.1 sfx=1

and look in the pkg/ subdirectory. Note that this is *not* a mingw-w64 based 64bit DevKit, but it should work for you.

If you're trying to build for 32bit, the 32bit mingw-w64 DevKit's haven't got a lot of attention as of late. Let me know if you're interested in 32bit via mingw-w64 and I'll take a look into when I get a spare moment.



> Also I found Jon's post on building rubinius<http://jonforums.github.com/ruby/2011/07/17/building-rubinius-on-windows-1.html> and
> tried doing it.
> I'm guessing that along the way instead of running *deprefix.rb*

> you guys just something else.
>

> But if I do run *deprefix.rb* I get a linking error or something


> while trying to test the C compiler:

> *collect2: cannot find 'ld'*
> *
> *


> That's really isn't a big deal though from the way it looks
> like you guys set the folder up, but I thought I would post
> it incase it is relevant.

> *
> *


> If there isn't a bug report lemme know and I'll create one.

> *
> *
> *
> *

Justin Baker

unread,
Mar 1, 2012, 4:51:12 PM3/1/12
to rubyin...@googlegroups.com
I'm just using your awesome DevKit scripts to get a convenient build enviroment for mingw-64 toolchain.
The 32bit is fine because I wanted to play with rubinius, which requires a "mingw-w64 toolchain".

So after being pretty ignorant to all things that might be required I ended up finding out I could build a 
pretty solid environment with the rubyinstaller. So the devkit I'm running is from the recipe.

rake devkit  dkver=mingw64-32-4.5.4 7z=1

But I can't get it to find the C libraries when I'm trying to configure rubinius.
I'm not going to lie I have no idea how this all works, but I would be glad to help out all that I can.

Here's a link to a gist with my output and errors.

Luis Lavena

unread,
Mar 1, 2012, 4:57:57 PM3/1/12
to rubyin...@googlegroups.com

Please try a cmd.exe command prompt instead of power shell.

Also ensure gcc can compile a simple hello world example.

Sorry for top posting. Sent from mobile.

--
You received this message because you are subscribed to the Google Groups "RubyInstaller" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyinstaller/-/iSVgBH7dCuwJ.
To post to this group, send email to rubyin...@googlegroups.com.
To unsubscribe from this group, send email to rubyinstalle...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyinstaller?hl=en.

Justin Baker

unread,
Mar 1, 2012, 5:08:29 PM3/1/12
to rubyin...@googlegroups.com
got a nice:

C:\Users\Justin\Projects\Test>gcc hello_world.c
hello_world.c:2:18: fatal error: stdio.h: No such file or directory
compilation terminated.

but otherwise the same errors while building rubinius

Loading up my local ruby TDM devkit into the path it compiles fine.

Luis Lavena

unread,
Mar 1, 2012, 5:25:12 PM3/1/12
to rubyin...@googlegroups.com

See troubleshooting Page about similar issue. Will try tdm-64 as soon get back to my desk.

Sorry for top posting. Sent from mobile.

--
You received this message because you are subscribed to the Google Groups "RubyInstaller" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyinstaller/-/uVSujvUr9PcJ.

Jon

unread,
Mar 1, 2012, 5:39:16 PM3/1/12
to rubyin...@googlegroups.com
> got a nice:
>
> *C:\Users\Justin\Projects\Test>gcc hello_world.c*
> *hello_world.c:2:18: fatal error: stdio.h: No such file or directory*
> *compilation terminated.*
> *
> *

> but otherwise the same errors while building rubinius
>
> Loading up my local ruby TDM devkit into the path it compiles fine.

Uh-oh...I'm going to check an old mingw-w64 DevKit build I have as we may have oops'd the build recipe...more in a bit.

Here's what I get from a freshly built mingw-w64 DevKit

C:\Users\Jon\Documents\CDev\sandbox>type helloworld.c
#include <stdio.h>

int main(int argc, char *argv[]) { printf("Hello World!\n");return 0; }

C:\Users\Jon\Documents\CDev\sandbox>\DevKit-w64\devkitvars.bat
Adding the DevKit to PATH...

C:\Users\Jon\Documents\CDev\sandbox>echo %PATH%

C:\DevKit-w64\bin;C:\DevKit-w64\mingw\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem

C:\Users\Jon\Documents\CDev\sandbox>gcc --version
gcc (GCC) 4.5.4 20110812 (prerelease)
Copyright (C) 2010 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.

C:\Users\Jon\Documents\CDev\sandbox>gcc -Wall -o hw.exe helloworld.c
helloworld.c:1:19: fatal error: stdio.h: No such file or directory
compilation terminated.


Also, unless the Rubinius folks have fixed things, once you get a working DevKit you're likely looking at this https://github.com/rubinius/rubinius/issues/1164 issue.

I also recall that the vm on Windows was ~187MB while on OSX it was ~18MB.

Jon

---
Fail fast. Fail often. Fail publicly. Learn. Adapt. Repeat.
http://thecodeshop.github.com | http://jonforums.github.com/
twitter: @jonforums

Jon

unread,
Mar 1, 2012, 5:53:56 PM3/1/12
to rubyin...@googlegroups.com
> > got a nice:
> >
> > *C:\Users\Justin\Projects\Test>gcc hello_world.c*
> > *hello_world.c:2:18: fatal error: stdio.h: No such file or directory*
> > *compilation terminated.*
> > *
> > *
> > but otherwise the same errors while building rubinius
> >
> > Loading up my local ruby TDM devkit into the path it compiles fine.
>
> Uh-oh...I'm going to check an old mingw-w64 DevKit build I have as we may have oops'd the build recipe...more in a bit.

That's not it...my build from 10/26/2011 fails the same way. Since you're trying to build Rubinius, this is going to be a problem.

Will try to find time to look into tomorrow if Luis doesn't find it first ;)

Luis Lavena

unread,
Mar 1, 2012, 6:01:38 PM3/1/12
to rubyin...@googlegroups.com
On Thu, Mar 1, 2012 at 7:25 PM, Luis Lavena <luisl...@gmail.com> wrote:
> See troubleshooting Page about similar issue. Will try tdm-64 as soon get
> back to my desk.
>

So, got in front of my computer.

Used mingw64-32-4.6.3 as DevKit:

https://gist.github.com/1953830

Configure worked.

Windows 7 x64 Ultimate.

Building now, libffi seems to build properly.

However, word of advice with this: this build of mingw-w64 will
dynamically link against stdc++ and others, which will require these
DLLs be placed along the compiled source.

I'll try with the other DevKit (4.5.4) but I do believe is broken.

Jon

unread,
Mar 1, 2012, 9:15:43 PM3/1/12
to rubyin...@googlegroups.com
> So, got in front of my computer.
>
> Used mingw64-32-4.6.3 as DevKit:
>
> https://gist.github.com/1953830

Also works for me.


> However, word of advice with this: this build of mingw-w64 will
> dynamically link against stdc++ and others, which will require these
> DLLs be placed along the compiled source.

Luis raises a *very* important point that at least (2) DLLs from the 4.6.3 DevKit need be used with Rubinius if and when you get it to build. IIRC they are `libstdc++-6.dll` and `libgcc_s_sjlj-1.dll` but I don't experiment with Rubinius any more.


TL;DR: use the mingw64-32-4.6.3 and don't worry about renaming binaries as in my 4.5.4 based blog post.

There's two versions of binary mingw-w64 downloads, the rubenvb build and their automated buildbot builds. IIRC, they have different internal packaging.

We switched from the automated build (4.5.4) to focus on using the rubenvb builds (4.6.3) for multiple reasons. I *suspect* this commit and friends don't play well with the old 4.5.4 buildbot layout

https://github.com/oneclick/rubyinstaller/commit/aa52f0920c6a48f4d0a5b1340feb90b75be23d77

I've not been happy with the mingw-w64 mingw buildbot builds (for many reasons) and will likely remove support for the current 4.5.4 build rather than fixing it. I may take a little time to validate my suspicion, but let us know how far you get on Rubinius using the mingw64-32-4.6.3 DevKit.

If 4.6.3 works well enough for you, wish mingw64-32-4.5.4 a safe trip, as it's not long for this repo ;)

Jon

Justin Baker

unread,
Mar 1, 2012, 11:00:04 PM3/1/12
to rubyin...@googlegroups.com


> So, got in front of my computer.
>
> Used mingw64-32-4.6.3 as DevKit:
>
> https://gist.github.com/1953830

Also works for me.

 Yeah, the fact it got past the sanity test makes me smile.


Luis raises a *very* important point that at least (2) DLLs from the 4.6.3 DevKit need be used with Rubinius if and when you get it to build. IIRC they are `libstdc++-6.dll` and `libgcc_s_sjlj-1.dll` but I don't experiment with Rubinius any more.

Alright, thanks for the info. I don't know much about what's going on, but now seems like a good time to learn.

I ended up failing on 'enc/trans/big5.c' so I didn't even get as far as you did. Haha
 

We switched from the automated build (4.5.4) to focus on using the rubenvb builds (4.6.3) for multiple reasons. I *suspect* this commit and friends don't play well with the old 4.5.4 buildbot layout

  https://github.com/oneclick/rubyinstaller/commit/aa52f0920c6a48f4d0a5b1340feb90b75be23d77

If 4.6.3 works well enough for you, wish mingw64-32-4.5.4 a safe trip, as it's not long for this repo ;)

That sounds good the rubenvb package looks a lot cleaner. Plus it actually works! I had a problem with getting the dkver=mingw64-32-4.6.3 to work last night, but I can't replicate it today.
Too bad it was late last night and I can't remember anything. I'll try some more later.

Thanks, for helping me out. Also thanks for the Devkit builder it's pretty awesome and saved me a lot of time. If there's anything else you want me to do just let me know.

Reply all
Reply to author
Forward
0 new messages