Bug 983769 - compile error including ruby.h in c99 mode: unknown type name ‘fd_set’
compile error including ruby.h in c99 mode: unknown type name ‘fd_set’
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: ruby (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jeroen van Meeuwen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-11 19:28 EDT by Tim Cuthbertson
Modified: 2013-07-15 21:36 EDT (History)
7 users (show)

See Also:
Fixed In Version: ruby-2.0.0.247-14.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-15 21:36:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tim Cuthbertson 2013-07-11 19:28:18 EDT
Description of problem:

I get errors trying to build the command-t vim plugin (which includes a compiled ruby extension). The errors come from including <ruby.h>, the plugin's code doesn't seem to be the cause.

Version-Release number of selected component (if applicable): ruby-devel-2.0.0.195-8.fc19.x86_64

How reproducible: Always


Steps to Reproduce:
1. Create:

-- ext.c:

    #include <stdlib.h>
    #include <ruby.h>

-- extconf.rb:

    require 'mkmf'
    have_header('ruby.h')
    create_makefile('ext')

-- depend

    CFLAGS += -std=c99


2. Run:

$ ruby extconf.rb
checking for ruby.h... yes
creating Makefile

$ make

Actual results:

gcc -I. -I/usr/include/x86_64-linux -I/usr/include/ruby/backward -I/usr/include -I. -DHAVE_RUBY_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -fPIC -m64 -std=c99 -o ext.o -c ext.c
In file included from /usr/include/ruby/ruby.h:1567:0,
                 from /usr/include/ruby.h:33,
                 from ext.c:2:
/usr/include/ruby/intern.h:323:1: error: unknown type name ‘fd_set’
 typedef fd_set rb_fdset_t;
 ^
In file included from /usr/include/ruby/ruby.h:24:0,
                 from /usr/include/ruby.h:33,
                 from ext.c:2:
/usr/include/ruby/intern.h:412:1: error: unknown type name ‘fd_set’
 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
 ^
/usr/include/ruby/intern.h:412:1: error: unknown type name ‘fd_set’
 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
 ^
/usr/include/ruby/intern.h:412:1: error: unknown type name ‘fd_set’
 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
 ^
make: *** [ext.o] Error 1



Additional info:

I can't figure out what exactly causing it. Either of the following workarounds make the problem go away:

 - require <ruby.h> before <stdlib.h> (in ext.c)
 - remove the -std=c99 flag from `depend`
Comment 1 Mamoru TASAKA 2013-07-12 05:09:28 EDT
--- ruby-devel-2.0.0.195-8.fc19.i686/usr/include/ruby/intern.h  2013-03-20 22:36:23.000000000 +0900
+++ ruby-devel-2.0.0.247-12.fc19.i686/usr/include/ruby/intern.h 2013-06-19 04:18:15.000000000 +0900
@@ -36,6 +36,10 @@
 #include <sys/types.h>
 #endif
 
+#if defined(HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#endif
+
 #include "ruby/st.h"
 
 #if defined __GNUC__ && __GNUC__ >= 4

and with glibc-2.17, time.h includes bits/time.h, which includes sys/select.h, which defines fd_set.
According to 
http://pubs.opengroup.org/onlinepubs/007904975/basedefs/sys/select.h.html ,
perhaps directly including sys/select.h seems preferable than time.h, however anyway with ruby 2.0.0p249 this is not reproducible.
Comment 2 Mamoru TASAKA 2013-07-12 05:11:08 EDT
(In reply to Mamoru TASAKA from comment #1)
> and with glibc-2.17, time.h includes bits/time.h

Before this, sys/time.h includes time.h.
Comment 3 Vít Ondruch 2013-07-12 05:57:11 EDT
There is related command-t bug report:

https://wincent.com/issues/2098

And this seems to the fix in Ruby:

https://github.com/ruby/ruby/commit/99035ca2621f7128d0e3a7f3a8acd8c3e2323e09#include/ruby/intern.h
Comment 4 Fedora Update System 2013-07-12 06:03:32 EDT
ruby-2.0.0.247-12.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/FEDORA-2013-12663/ruby-2.0.0.247-12.fc19
Comment 5 Fedora Update System 2013-07-13 23:28:01 EDT
Package ruby-2.0.0.247-13.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ruby-2.0.0.247-13.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-12663/ruby-2.0.0.247-13.fc19
then log in and leave karma (feedback).
Comment 6 Tim Cuthbertson 2013-07-14 18:44:08 EDT
Thanks, this update fixes the issue.
Comment 7 Fedora Update System 2013-07-15 21:36:36 EDT
ruby-2.0.0.247-14.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.