Skip to content

Force linking openssl so that eventmachine installs correctly

Gabriel Mazetto requested to merge brodock/homebrew-openssl into main

What does this Merge Request do and why?

When trying to bundle install using ruby 3.x eventmachine was not compiling correctly.

The error was similar to: https://stackoverflow.com/a/33956405/230526

Installing eventmachine 1.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/brodock/.rvm/gems/ruby-3.0.4/gems/eventmachine-1.2.7/ext
/Users/brodock/.rvm/rubies/ruby-3.0.4/bin/ruby -I /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0 -r ./siteconf20220604-83798-zf6iy7.rb extconf.rb
checking for -lcrypto... yes
checking for -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... yes
checking for CLOCK_MONOTONIC_RAW in time.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
CXXFLAGS= -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result -Wno-address
creating Makefile

current directory: /Users/brodock/.rvm/gems/ruby-3.0.4/gems/eventmachine-1.2.7/ext
make DESTDIR\= clean

current directory: /Users/brodock/.rvm/gems/ruby-3.0.4/gems/eventmachine-1.2.7/ext
make DESTDIR\=
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make: *** [binder.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/brodock/.rvm/gems/ruby-3.0.4/gems/eventmachine-1.2.7 for inspection.
Results logged to /Users/brodock/.rvm/gems/ruby-3.0.4/extensions/arm64-darwin-21/3.0.0/eventmachine-1.2.7/gem_make.out

  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/builder.rb:93:in `run'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/builder.rb:44:in `block in make'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/builder.rb:36:in `each'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/builder.rb:36:in `make'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:63:in `block in build'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/builder.rb:159:in `build_extension'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/builder.rb:193:in `block in build_extensions'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/builder.rb:190:in `each'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/ext/builder.rb:190:in `build_extensions'
  /Users/brodock/.rvm/rubies/ruby-3.0.4/lib/ruby/3.0.0/rubygems/installer.rb:837:in `build_extensions'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/rubygems_gem_installer.rb:71:in `build_extensions'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/source/rubygems.rb:204:in `install'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/installer/gem_installer.rb:54:in `install'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/worker.rb:62:in `apply_func'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/worker.rb:57:in `block in process_queue'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/worker.rb:54:in `loop'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/worker.rb:54:in `process_queue'
  /Users/brodock/.rvm/gems/ruby-3.0.4/gems/bundler-2.3.6/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.

In Gemfile:
  thin was resolved to 1.8.0, which depends on
    eventmachine

To fix it, one alternative is to brew link --force openssl@1.1. The changes here does the equivalent to that using the Brewfile

Merge Request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise Issue to follow-up.
  • Documentation added/updated, if needed.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Gabriel Mazetto

Merge request reports