io-console install failure on 0.4.1 (Ruby 1.9.3 on Windows) #6

Open
BruceWilliams opened this Issue Feb 7, 2013 · 10 comments

Projects

None yet

4 participants

@BruceWilliams

I'm observing io-console fails to build when I try to update to the latest version. The RubyInstaller folks tell me that I should take this up with you. The details are here:

https://groups.google.com/d/msg/rubyinstaller/9qbj5HKN7w4/RAgvVN9gSWMJ

Bruce Williams

@DHB
DHB commented Feb 9, 2013

Observed the same issue (Windows 7) ruby 1.9.3p194 and ruby 1.9.3p374.

$ gem update io.console
Updating installed gems
Updating io-console
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing io-console:
        ERROR: Failed to build gem native extension.

        h:/Ruby193_p374/bin/ruby.exe extconf.rb
checking for rb_w32_map_errno() in ruby.h... yes
checking for sys/ioctl.h... no
checking for rb_io_get_write_io() in ruby/io.h... yes
checking for dup3() in unistd.h... no
creating Makefile

make
generating console-i386-mingw32.def
compiling console.c
console.c: In function 'console_dev':
console.c:688:2: warning: implicit declaration of function 'rb_cloexec_open'
linking shared-object io/console.so
console.o: In function `console_dev':
h:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.4.1/console.c:688: undefined reference to `rb
h:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.4.1/console.c:695: undefined reference to `rb
collect2: ld returned 1 exit status
make: *** [console.so] Error 1


Gem files will remain installed in h:/Ruby193_p374/lib/ruby/gems/1.9.1/gems/io-console-0.4.1 for in
Results logged to h:/Ruby193_p374/lib/ruby/gems/1.9.1/gems/io-console-0.4.1/./gem_make.out
Nothing to update
@RobertinoValue

I'm getting the exact same error as DHB.

C:\Windows\system32>gem update
Updating installed gems
Updating io-console
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing io-console:
        ERROR: Failed to build gem native extension.
        C:/Ruby193/bin/ruby.exe extconf.rb
checking for rb_w32_map_errno() in ruby.h... yes
checking for sys/ioctl.h... no
checking for rb_io_get_write_io() in ruby/io.h... yes
checking for dup3() in unistd.h... no
creating Makefile
make
generating console-i386-mingw32.def
compiling console.c
console.c: In function 'console_dev':
console.c:688:2: warning: implicit declaration of function 'rb_cloexec_open'
linking shared-object io/console.so
console.o: In function `console_dev':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\io-console-0.4.1/console.c:688: undefined reference to `rb_cloexec_open'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\io-console-0.4.1/console.c:695: undefined reference to `rb_cloexec_open'
collect2: ld returned 1 exit status
make: *** [console.so] Error 1
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/io-console-0.4.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/io-console-0.4.1/./gem_make.out
Nothing to update
C:\Windows\system32>
@DHB
DHB commented Feb 10, 2013

Just wanted to add some additional thoughts.

MRI ruby comes bundeled with the console-io (0.3) gem along with other libraries since I dunno, couple of years at least.

In this context, I can hardly think of situations where people explicitely need and require console-io 0.4.1 anymore since functionality is equal to 0.3 and part of ruby anyway..

I also noticed some ongoing discussion wether it would be a good idea to sort of have Ruby MRI libraries truly decoupled and "gemified". In MRI 2.0 ?? For this type of situation this would surely help.

In my case, I believe I installed an older legacy gem for some tests I wanted to do. I just cannot recall what it was. The legacy gem itself had lots of other dependencies and installed some other gems.

I currently suspect one or some gemspecs are deprecated.

Or is Rubygems when executing "gem outdated" checking the repos at rubygems.org, discovering 0.4.1 and reporting the diff eitherway? On the other hand, the 0.4.1 branch is already one year old .. and I just experienced the issue recently. Even if 0.4.1 is supposed to make it into MRI 2.0, it should not interfere with existing versions.

Anyway, since installing the above, when I execute "gem outdated" the system barks and returns io-console 0.3 is outdated. I do this daily because I maintain one local repository for all the gems I have and I eventually want or need to bundle for the various apps. It is driving me nuts.

Nevertheless and regardless 0.4.2 should compile either way. I noticed it will make it into MRI 2.0 .

I am neither GNU gcc nor Mingw32 expert. But ../lib/console.rb is neither checking for darwin nor mingw32. Is this killing the make?

@Lunatikzx

Same issue occurring here any news on that

@RobertinoValue

Ref : http://rxr.whitequark.org/mri/ident?i=rb_cloexec_open

I don't know how accurate this MRI cross reference is, but only the HEAD version of Ruby seems to include the declaration/prototype for rb_cloexec_open (in '/include/ruby/intern.h). The function definition is found in io.c of HEAD.
Declaration on line 501 : int rb_cloexec_open(const char *pathname, int flags, mode_t mode);.

A search through all the other versions of Ruby came up with an empty result.
I have ruby 1.9.3p194 (2012-04-20) [i386-mingw32] installed. Where intern.h was installed to C:\Ruby193\include\ruby-1.9.1\ruby\. A quick scan of the file confirms what I found online. No declaration.
And I found that source file io.cdoes not exist.

Also when I look in the log file mkmf.log of extconf.rb (which generates the Makefile) I see several (unrelated?) problems.

Because I can see the function name in console.o, I opened a cmd window with admin rights in the io-console-0.4.1 folder, added the following 2 lines to console.c as the first 2 lines, deleted Makefile, mkmf.log, and console-i386-mingw32.def, and ran extconf.rb followed by make from the cmd line.
The 2 lines :
short int mode_t;
int rb_cloexec_open(const char *pathname, int flags, mode_t mode);
I also tried this with just the function declaration added.
But of course neither resolved the issue.

You can't do the gem update thing because it redownloads the gem constantly, overwriting changes to console.c.
I've given up, but if you want to give it a go, give make its toolbox, by adding the dev kit to your cmd session with this. :
SET PATH=C:\Ruby-DevKit-tdm-32-4.5.2-20111229-1559\bin;C:\Ruby-DevKit-tdm-32-4.5.2-20111229-1559\mingw\bin;%PATH% SET RI_DEVKIT=C:\Ruby-DevKit-tdm-32-4.5.2-20111229-1559 SET CC=gcc SET CXX=g++ SET CPP=cpp
Change to the version of the DevKit that you have installed of course.

@DHB
DHB commented Feb 13, 2013

I have to apologize. The issue had nothing to do with the additional gems I installed above and their gemspecs.
My fault.

I meanwhile had time to do some additional investigations.

• Io-console 0.3 and 0.4.1 compiled and installed with no problem on my Ubuntu 12.04 LTS system.

• For the almost extinct (?) Windows 7 user like us, I did the following attempts:

$ ruby -v
ruby 1.9.3p385 (2013-02-06) [i386-mingw32]

Little site remark: Testing the mingw32 devkit installation is currently also limited, since the smoke test ‘gem install rdiscount --platform=ruby’ no longer works. There is already a bug report #74. See: davidfstr/rdiscount#74

So after a plain ruby 1.9.3p385 install, no additional gems manually installed, I did this:

$ gem list --local
*** LOCAL GEMS ***
bigdecimal (1.1.0)
io-console (0.3)
json (1.5.4)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)

$ gem outdated
io-console (0.3 < 0.4.1)
json (1.5.4 < 1.7.7)
minitest (2.5.1 < 4.6.0)
rake (0.9.2.2 < 10.0.3)
rdoc (3.9.5 < 3.12.1)

$ gem uninstall io-console
Successfully uninstalled io-console-0.3

$ gem install io-console -v 0.3
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed io-console-0.3
1 gem installed
Installing ri documentation for io-console-0.3...
Installing RDoc documentation for io-console-0.3...


$ gem update io-console (to 0.4.1)

DOES NOT WORK !!!

I tried some manual attempts as per Robertino’s help: @Robertino: Thank you !

CMD H:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.3
$ ruby extconf.rb
checking for rb_w32_map_errno() in ruby.h... yes
checking for sys/ioctl.h... no
checking for rb_io_get_write_io() in ruby/io.h... yes
checking for dup3() in unistd.h... no
creating Makefile

CMD H:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.3
$ make
linking shared-object io/console.so

OK !

CMD H:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.4.1
$ ruby extconf.rb
checking for rb_w32_map_errno() in ruby.h... yes
checking for sys/ioctl.h... no
checking for rb_io_get_write_io() in ruby/io.h... yes
checking for dup3() in unistd.h... no
creating Makefile

CMD H:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.4.1
$ make
linking shared-object io/console.so
console.o: In function `console_dev':
H:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.4.1/console.c:688: undefined reference to `rb_cloexec_open'
H:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.4.1/console.c:695: undefined reference to `rb_cloexec_open'
collect2: ld returned 1 exit status
make: *** [console.so] Error 1

The library itself is rather simple. However, I did not and could not test whether it works as it supposed to work. There are NO tests or Rspecs supplied along with the gem.

To cut a long story short:

Io-console should not have been uploaded to rubygems.org on Feb. 04 2013 in its present state. It does not compile on windows (yet).

One way or the other, Nobu is part of the ruby core team and is doing the Windows stuff (sic!). I bet he will fix the issue as soon as time permits.

Not sure though, he ever reads all this on Github. The io-console version posted here is 0.2.2. (!) according to the gemspec.

But I don’t want to get into the rubygems.org vs. GitHub discussion … :-)

@DHB
DHB commented Feb 13, 2013

The gem_make.out:

H:/Ruby193_p374/bin/ruby.exe extconf.rb
checking for rb_w32_map_errno() in ruby.h... yes
checking for sys/ioctl.h... no
checking for rb_io_get_write_io() in ruby/io.h... yes
checking for dup3() in unistd.h... no
creating Makefile

make
generating console-i386-mingw32.def
compiling console.c
console.c: In function 'console_dev':
console.c:686:2: warning: implicit declaration of function 'rb_cloexec_open'
linking shared-object io/console.so
console.o: In function `console_dev':
H:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.4.0.1/console.c:686: undefined reference to `rb_cloexec_open'
H:\Ruby193_p374\lib\ruby\gems\1.9.1\gems\io-console-0.4.0.1/console.c:693: undefined reference to `rb_cloexec_open'
collect2: ld returned 1 exit status
make: *** [console.so] Error 1

Looks like
rb_cloexec_open() did not exist in console.c of io-console 0.3.
That’s why it compiles OK.

rb_cloexec_open() is new in console.c of io-console 0.4.1 along with some other new methods.

rb_cloexec_open() was introduced new in MRI Revision: 33549 ?

Dunno – I can’t find it … I give up - This is as far as I want to dive into it …

@RobertinoValue

@DHB Thanks for your attempts. Too bad that it didn't work. I had little hope that I had overlooked something. But this one will probably only work if we would compile Ruby from HEAD (or not). Guess we'll have to wait and see what happens.

@DHB
DHB commented Feb 24, 2013

0.4.2 compiled with no problem on ruby 1.9.3p374 (2013-01-15) [i386-mingw32]. Lots of thx to Nobu !!!!!

@RobertinoValue

Also no problems on ruby 1.9.3p194 (2012-04-20) [i386-mingw32].
(Upgrading to 1.9.3-p392 this week though.)

Thanks for letting us know DHB. And Nobu for fixing.

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>gem update
Updating installed gems
Updating io-console
Fetching: io-console-0.4.2.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed io-console-0.4.2
.
.
Installing ri documentation for io-console-0.4.2...
.
.
C:\Windows\system32>ruby -v
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

C:\Windows\system32>```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment