redis / hiredis-rb

Ruby wrapper for hiredis
BSD 3-Clause "New" or "Revised" License
319 stars 90 forks source link

Unable to install on latest master #78

Open gyfis opened 2 years ago

gyfis commented 2 years ago

Hi, I'm trying to use hiredis with the native SSL support, which seems to be available on the master branch of the repo, but I'm unable to install the gem when specifying gem 'hiredis', github: 'redis/hiredis-rb' in my Gemfile.

I'm using Ruby 2.7.5., M1 Max MacBook, but this also happens on a Ubuntu 20.04 machine. The stacktrace is quite mysterious, so I wasn't able to figure out where or why it's failing. I have hiredis installed via brew.

Any pointers appreciated!

Here are the stacktrace and related files:

bundle install ``` > bundle install ... Using hiredis 0.6.3 from https://github.com/redis/hiredis-rb.git (at master@a66f527) /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:167: warning: conflicting chdir during another chdir block /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:175: warning: conflicting chdir during another chdir block Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/bundler/gems/hiredis-rb-a66f527d7661/ext/hiredis_ext /Users/gyfis/.rbenv/versions/2.7.5/bin/ruby -I /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/2.7.0 -r ./siteconf20220211-34460-1bi0xss.rb extconf.rb --with-cflags\=-std\=c99 checking for sys/socket.h... yes make: *** No rule to make target `static'. Stop. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/gyfis/.rbenv/versions/2.7.5/bin/$(RUBY_BASE_NAME) --with-sys-dir --without-sys-dir --with-sys-include --without-sys-include=${sys-dir}/include --with-sys-lib --without-sys-lib=${sys-dir}/lib extconf.rb:33:in `block in
': Building hiredis failed (RuntimeError) from extconf.rb:31:in `chdir' from extconf.rb:31:in `
' To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/bundler/gems/extensions/arm64-darwin-21/2.7.0/hiredis-rb-a66f527d7661/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/bundler/gems/hiredis-rb-a66f527d7661 for inspection. Results logged to /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/bundler/gems/extensions/arm64-darwin-21/2.7.0/hiredis-rb-a66f527d7661/gem_make.out An error occurred while installing hiredis (0.6.3), and Bundler cannot continue. In Gemfile: hiredis ```
Here's the` hiredis-rb-a66f527d7661/mkmf.log`: ``` have_header: checking for sys/socket.h... -------------------- yes "clang -o conftest -I/Users/gyfis/.rbenv/versions/2.7.5/include/ruby-2.7.0/arm64-darwin21 -I/Users/gyfis/.rbenv/versions/2.7.5/include/ruby-2.7.0/ruby/backward -I/Users/gyfis/.rbenv/versions/2.7.5/include/ruby-2.7.0 -I. -I/Users/gyfis/.rbenv/versions/2.7.5/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -std=c99 conftest.c -L. -L/Users/gyfis/.rbenv/versions/2.7.5/lib -L. -L/Users/gyfis/.rbenv/versions/2.7.5/lib -fstack-protector-strong -m64 -lruby.2.7 " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return !!argv[argc]; 6: } /* end */ "clang -E -I/Users/gyfis/.rbenv/versions/2.7.5/include/ruby-2.7.0/arm64-darwin21 -I/Users/gyfis/.rbenv/versions/2.7.5/include/ruby-2.7.0/ruby/backward -I/Users/gyfis/.rbenv/versions/2.7.5/include/ruby-2.7.0 -I. -I/Users/gyfis/.rbenv/versions/2.7.5/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -std=c99 conftest.c -o conftest.i" checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include /* end */ -------------------- ```
And here's the `gem_make.out`: ``` current directory: /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/bundler/gems/hiredis-rb-a66f527d7661/ext/hiredis_ext /Users/gyfis/.rbenv/versions/2.7.5/bin/ruby -I /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/2.7.0 -r ./siteconf20220211-34460-1bi0xss.rb extconf.rb --with-cflags\=-std\=c99 checking for sys/socket.h... yes make: *** No rule to make target `static'. Stop. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/gyfis/.rbenv/versions/2.7.5/bin/$(RUBY_BASE_NAME) --with-sys-dir --without-sys-dir --with-sys-include --without-sys-include=${sys-dir}/include --with-sys-lib --without-sys-lib=${sys-dir}/lib extconf.rb:33:in `block in
': Building hiredis failed (RuntimeError) from extconf.rb:31:in `chdir' from extconf.rb:31:in `
' To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/gyfis/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/bundler/gems/extensions/arm64-darwin-21/2.7.0/hiredis-rb-a66f527d7661/mkmf.log extconf failed, exit code 1 ```
milieu commented 2 years ago

I too have this issue, though with ruby 3.0.2

milieu commented 2 years ago

Looks like this issue might be related in the C library: https://github.com/redis/hiredis/issues/862 different build error for hiredis, ignore

milieu commented 2 years ago

Looks like the build error we're running into locally is basically a duplicate of this unresolved (😢) issue: https://github.com/redis/hiredis-rb/issues/54

The build error in that issue looks the same, but is probably ran from a Docker container -- it looks similar to what I was seeing on an Alpine container before I switched to looking at this locally

skull-squadron commented 2 years ago

Native ext ( d62cb77c72fe292e4f35f385467006096b7d9e3b ) builds fine on M1 Max + 3.1.2, 2.7.6, and 2.6.10.

brew uninstall --ignore-dependencies hiredis; gem install specific_install && gem specific_install https://github.com/redis/hiredis-rb