ohler55 / agoo

A High Performance HTTP Server for Ruby
MIT License
912 stars 39 forks source link

gem install agoo fails on MacOS Ventura 13.2.1 #117

Closed backward-crazy-mage-puppy-36 closed 1 year ago

backward-crazy-mage-puppy-36 commented 1 year ago

Have tried versions 2.14.0 through 2.15.3 with ruby -v ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin22] on Apple Silicon M1 MacOS Ventura 13.2.1 fresh install.

gem install agoo gem install agoo -- --with-cflags="-target arm64-apple-darwin22.2.3"

fails with error

compiling websocket.c
linking shared-object agoo/agoo.bundle
Undefined symbols for architecture arm64:
  "_ERR_error_string_n", referenced from:
      _con_ssl_error in con.o
      _ssl_error in server.o
  "_ERR_get_error", referenced from:
      _agoo_con_http_read in con.o
      _con_ssl_error in con.o
      _agoo_con_http_write in con.o
      _ssl_error in server.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [agoo.bundle] Error 1

make failed, exit code 2

clang -v Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

gcc -v Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

c++ -v Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

ohler55 commented 1 year ago

Tried it here as well. I looks like Ruby 3.2.x ssl is broken. The compile works fine on Ruby 3.1. For now I'd suggest using Ruby 3.1 or if you can live without ssl then modify the extconf.rb file and comment out the two lines that mention ssl. I'm hesitant to make a release like that as the problem is pretty clearly the Ruby 3.2.1 release.

josephwecker commented 1 year ago

Just ran into this as well. I actually think it has something to do with openssl's setup right now on MacOS. I just got it to link correctly finally by adding -lcrypto to LIBS in the makefile. Apparently -lssl only has a subset of the symbols (or something... haven't looked any deeper).

backward-crazy-mage-puppy-36 commented 1 year ago

Just ran into this as well. I actually think it has something to do with openssl's setup right now on MacOS. I just got it to link correctly finally by adding -lcrypto to LIBS in the makefile. Apparently -lssl only has a subset of the symbols (or something... haven't looked any deeper).

Hi @josephwecker can you share the exact steps.

josephwecker commented 1 year ago

I was setting it up to be used in rails, so after adding gem "agoo" to the Gemfile, bundle install would error out exactly as reported by op. But after running bundle config build.agoo --with-cflags="-lcrypto", bundle install ran just fine and it seems to be working perfectly. I also deployed it to heroku, which had no problem building it (on linux I'm sure) without the -lcrypto. By the way, I tried several versions of ruby all the way down to 3.1.0 with the same error as above before trying to link crypto in. Hope that helps.

backward-crazy-mage-puppy-36 commented 1 year ago

https://github.com/ohler55/agoo/issues/117#issuecomment-1455023031 Did not work for me. Manually changing Makefile in /Users/#{user}/.rbenv/versions/3.2.1/gemsets/Angel/gems/agoo-2.15.3/ext/agoo and running

make clean
make install

does get the process to finish.

Tried it here as well. I looks like Ruby 3.2.x ssl is broken. The compile works fine on Ruby 3.1. For now I'd suggest using Ruby 3.1 or if you can live without ssl then modify the extconf.rb file and comment out the two lines that mention ssl. I'm hesitant to make a release like that as the problem is pretty clearly the Ruby 3.2.1 release.

This worked for me. For anyone else having this issue, you can add gem 'agoo', git: 'https://github.com/backward-crazy-mage-puppy-36/agoo', ref: '48584076d9c0f19bb419ecc835a0ca2ca99086f3' to your Gemfile and it should bundle w/o needing to add any config.

ohler55 commented 1 year ago

Thanks all for the due diligence. I push a change to extconf.rb that seems to fix the issue on my M1. Anyone willing to double check? If so I'll make a release.

backward-crazy-mage-puppy-36 commented 1 year ago

checking.

backward-crazy-mage-puppy-36 commented 1 year ago

Thanks all for the due diligence. I push a change to extconf.rb that seems to fix the issue on my M1. Anyone willing to double check? If so I'll make a release.

@ohler55 2fb4cb4aa87fb72d29c005efb2751e07f0feea00 is working for me.

ohler55 commented 1 year ago

Released v2.15.4