Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of C99 breaks gem install on CentOS 7 #11

Closed
tas50 opened this issue Feb 9, 2022 · 2 comments
Closed

Use of C99 breaks gem install on CentOS 7 #11

tas50 opened this issue Feb 9, 2022 · 2 comments

Comments

@tas50
Copy link

tas50 commented Feb 9, 2022

This gem uses C99 code that prevents the gem install on CentOS 7 unless people use pull in the backported development tools. Is there any way to use older style code here that would compile on CentOS 7 out of the box?

       Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
       
       current directory:
       /opt/chef/embedded/lib/ruby/gems/3.0.0/gems/io-wait-0.2.1/ext/io/wait
       /opt/chef/embedded/bin/ruby -I /opt/chef/embedded/lib/ruby/3.0.0 -r
       ./siteconf20220209-187-few2km.rb extconf.rb
       checking for rb_io_wait()... yes
       checking for sys/ioctl.h... yes
       checking for FIONREAD in sys/ioctl.h,sys/ioctl.h... yes
       creating Makefile
       
       current directory:
       /opt/chef/embedded/lib/ruby/gems/3.0.0/gems/io-wait-0.2.1/ext/io/wait
       make DESTDIR\\= clean
       
       current directory:
       /opt/chef/embedded/lib/ruby/gems/3.0.0/gems/io-wait-0.2.1/ext/io/wait
       make DESTDIR\\=
       compiling wait.c
       wait.c: In function 'io_wait':
       wait.c:332:2: error: 'for' loop initial declarations are only allowed in C99
       mode
         for (int i = 0; i < argc; i += 1) {
         ^
       wait.c:332:2: note: use option -std=c99 or -std=gnu99 to compile your code
       make: *** [wait.o] Error 1
       
       make failed, exit code 2
@johnmccrae
Copy link

johnmccrae commented Feb 28, 2022

This also breaks on Windows with the same error message. Specifically Windows 11 but will assume it happens on other contemporary versions as well.

@XrXr
Copy link
Member

XrXr commented Jun 25, 2022

Your compiler should support C99 since it prompted you about it. Try compiling in C99 mode when installing:

gem install io-wait --version 0.2.1 -- --with-cflags=-std=c99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants