crystal-lang / distribution-scripts

40 stars 23 forks source link

Nightly build broken #318

Open straight-shoota opened 3 days ago

straight-shoota commented 3 days ago

The dist_darwin job on the current nightly build has failed: https://app.circleci.com/pipelines/github/crystal-lang/crystal/15319/workflows/75d431a6-1174-4f22-94c2-e7d9d43e02e3/jobs/84166

ossl_pkey_rsa.c:942:5: error: use of undeclared identifier 'RSA_SSLV23_PADDING'
    DefRSAConst(SSLV23_PADDING);
    ^
ossl_pkey_rsa.c:877:58: note: expanded from macro 'DefRSAConst'
#define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
                                                         ^
<scratch space>:228:1: note: expanded from here
RSA_SSLV23_PADDING
^
115 warnings and 1 error generated.
make[2]: *** [ossl_pkey_rsa.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
!!! Compiling ruby 2.7.3 failed!
ysbaddaden commented 3 days ago

It seems homebrew installs openssl@3 by default which is only supported starting from ruby-3.1.0. ruby-install had a patch to select the correct version, but maybe it got removed since ruby 2.7 and 3.0 are EOL.

We must either upgrade to Ruby 3.1+ or install openssl@1.1 and use it:

$ brew install openssl@1.1
$ ruby-install ruby-2.7.5 -- --with-openssl-dir=$(brew --prefix openssl@1.1)

References:

straight-shoota commented 2 days ago

After updating to install ruby@3 (ref https://github.com/crystal-lang/distribution-scripts/pull/263) directly from homebrew, now ffi-yajl fails building:

linking shared-object ffi_yajl/ext/encoder.bundle
Undefined symbols for architecture arm64:
  "_yajl_gen_alloc", referenced from:
      _mEncoder_do_yajl_encode in encoder.o
  "_yajl_gen_array_close", referenced from:
      _gen_array_close in encoder.o
  "_yajl_gen_array_open", referenced from:
      _gen_array_open in encoder.o
  "_yajl_gen_bool", referenced from:
      _gen_true in encoder.o
      _gen_false in encoder.o
  "_yajl_gen_config", referenced from:
      _mEncoder_do_yajl_encode in encoder.o
  "_yajl_gen_free", referenced from:
      _mEncoder_do_yajl_encode in encoder.o
  "_yajl_gen_get_buf", referenced from:
      _mEncoder_do_yajl_encode in encoder.o
  "_yajl_gen_map_close", referenced from:
      _gen_map_close in encoder.o
  "_yajl_gen_map_open", referenced from:
      _gen_map_open in encoder.o
  "_yajl_gen_null", referenced from:
      _gen_null in encoder.o
  "_yajl_gen_number", referenced from:
      _gen_number in encoder.o
  "_yajl_gen_string", referenced from:
      _gen_cstring in encoder.o
ld: symbol(s) not found for architecture arm64

Explicitly installing libffi doesn't help.

https://app.circleci.com/pipelines/github/crystal-lang/crystal/15323/workflows/a939fdc2-376b-42ed-86f8-50c139f4afdb/jobs/84210

ysbaddaden commented 2 days ago

Should be fixed in ffi-yajl v2.6.0: https://github.com/chef/ffi-yajl/issues/115

I tried reproducing in a ruby:3.2-alpine image, but to no avail (same in alpine:edge with ruby 3.3). It looks like a macOS only bug.

straight-shoota commented 20 hours ago

Fixing ffi-yajl to >= 2.6 makes the gem installation succeed. But now there's a download error: https://app.circleci.com/pipelines/github/crystal-lang/crystal/15331/workflows/98893216-21db-44ff-ab3d-8ede53dde3bf/jobs/84258

           [Software: llvm_bin] I | 2024-07-01T07:29:54+00:00 | Resolving manifest entry for llvm_bin
   [NetFetcher: llvm_bin] I | 2024-07-01T07:29:54+00:00 | Downloading from `http://crystal-lang.s3.amazonaws.com/llvm/llvm-15.0.7-3-darwin-arm64.tar.gz'
...
   [NetFetcher: llvm_bin] E | 2024-07-01T07:29:54+00:00 | Download failed - OpenURI::HTTPError!
#<Thread:0x000000010869ea70 /Users/distiller/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/bundler/gems/omnibus-1d97cd9e79a0/lib/omnibus/thread_pool.rb:55 run> terminated with exception (report_on_exception is true):
/Users/distiller/.rbenv/versions/3.2.2/lib/ruby/3.2.0/open-uri.rb:369:in `open_http': 403 Forbidden (OpenURI::HTTPError)
straight-shoota commented 20 hours ago

I suppose we probably don't have an aarch64 build of llvm available.