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

Fix OpenSSL version conflict + decouple Ruby & dependencies entirely from Apple base OS libraries #226

Open
wants to merge 83 commits into
base: master
Choose a base branch
from

Conversation

trinitronx
Copy link
Collaborator

No description provided.

@trinitronx trinitronx added bug enhancement dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code labels Jul 16, 2024
@trinitronx trinitronx added this to the macOS Monterey 12.7.1 milestone Jul 16, 2024
@trinitronx trinitronx self-assigned this Jul 16, 2024
trinitronx and others added 24 commits February 2, 2025 16:58
Conflicts:
	soloistrc.lyra.yml
Note: From current chef-workstation manifest, they use 3.0.12.  Homebrew uses: 3.3.1

We may need to adjust... but it should be ABI compatible 🤷

Depends on: rvm/rvm#5480

If RVM is insistent on using [email protected], you need to:

    rvm get master
Current chef-workstation version manifest:

    chef-workstation 24.6.1066

    Component                Installed Version                          Version GUID                                                                 Overridden From
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------
    bzip2                    1.0.8                                      sha256:ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269
    c_rehash_ruby            main                                       path:/Users/anka/buildkite-workspace/omnibus/files/../../components/rehash
    cacerts                  2022-10-11                                 sha256:2cff03f9efdaf52626bd1b451d700605dc1ea000c5da56bd0fc59f8f43071040
    chef-analyze             0.1.186                                    git:e1a9d15d95fcaa307343f227a5c165d3b1b16c83                                 main
    chef-workstation-app     0.2.191
    config_guess             master                                     git:84f04b02a7e2fc8eaa9d52deee5f6d57b06fe447
    curl                     8.4.0                                      sha256:816e41809c043ff285e8c0f06a75a1fa250211bbfb2dc0a037eeef39f1a9e427
    expat                    2.5.0                                      sha256:6b902ab103843592be5e99504f846ec109c1abb692e85347587f237a4ffa1033
    gem-permissions          0.0.1
    gem-version-manifest     24.6.1066
    gems                     24.6.1066
    git-custom-bindir        2.39.3                                     sha256:2f9aa93c548941cc5aff641cedc24add15b912ad8c9b36ff5a41b1a9dcad783e
    go                       1.21.5                                     sha256:a2e1d5743e896e5fe1e7d96479c0a769254aed18cf216cf8f4c3a2300a9b3923      1.19.5
    go-uninstall             0.0.1
    google-protobuf          v3.21.12                                   git:f0dc78d7e6e331b8c6bb2d5283e06aa26883ca7c
    habitat                  1.6.1041                                   sha256:2dbde6139a47341d63e696014262b37958461fdaed7cfafe5e72f534bc66e40e
    libarchive               3.6.2                                      sha256:ba6d02f15ba04aba9c23fd5f236bb234eab9d5209e95d1c4df85c44d5f19b9b3
    libedit                  20120601-3.0                               sha256:51f0f4b4a97b7ebab26e7b5c2564c47628cdb3042fd8ba8d0605c719d2541918
    libffi                   3.4.2                                      sha256:540fb721619a6aba3bdeef7d940d8e9e0e6d2c193595bc243241b77ff9e93620      3.4.4
    libiconv                 1.16                                       sha256:e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04      1.17
    liblzma                  5.2.5                                      sha256:f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10      5.2.10
    libnghttp2               1.58.0                                     sha256:9ebdfbfbca164ef72bdf5fd2a94a4e6dfb54ec39d2ef249aeb750a91ae361dfb
    libxml2                  2.12.5                                     sha256:a972796696afd38073e0f59c283c3a2f5a560b5268b4babc391b286166526b21      2.11.7
    libxslt                  1.1.39                                     sha256:2a20ad621148339b0759c4d4e96719362dee64c9a096dbba625ba053846349f0
    libyaml                  0.1.7                                      sha256:8088e457264a98ba451a90b8661fcb4f9d6f478f7265d48322a196cec2480729      0.2.5
    main-chef-wrapper        24.6.1066
    more-ruby-cleanup        24.6.1066
    ncurses                  6.4                                        sha256:6931283d9ac87c5073f30b6290c4c75f21632bb4fc3603ac8100812bed248159
    openssl                  3.0.12                                     sha256:f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61
    openssl-customization    24.6.1066
    pcre                     8.45                                       sha256:4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09
    preparation              1.0.0
    rb-fsevent-gem           623f64a7edfd2505e64aa2125f01a54ffd6166ba   git:623f64a7edfd2505e64aa2125f01a54ffd6166ba
    ruby                     3.1.2                                      sha256:61843112389f02b735428b53bb64cf988ad9fb81858b8248e22e57336f24a83e      3.1.3
    ruby-cleanup             1.0.0
    ruby-env-script          24.6.1066
    rubygems-customization   24.6.1066
    shebang-cleanup          0.0.2
    uninstall-scripts        24.6.1066
    version-manifest         0.0.1
    zlib                     1.3.1                                      sha256:9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23      1.2.13
Due to macOS stock libs being so outdated, and the general hostility of Apple's
OS-level changes to installing Ruby + dependencies over **many** years... we
must now go down the path of installing everything we need from Homebrew.

This will come with its own breakages due to Homebrew's history of formula
deprecations, renames, etc... C'est la vie

Currently including:

- libffi
- libreadline
- libxslt
- libyaml
Part of the effort to decouple our Ruby installation as much as possible from
macOS, to insulate against the incessant changes pushed by Apple.

Similar to postmodern/ruby-install#484, we will also install `ncurses` from
Homebrew.  Avoiding Apple's system-installed version for any Ruby versions
installed using RVM.
Shellcheck warnings were:

    In bootstrap-scripts/bootstrap.sh line 188:
        export CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-jemalloc-dir=$(pkg-config --variable=prefix jemalloc)"
               ^------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.

    In bootstrap-scripts/bootstrap.sh line 191:
        export CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-openssl-dir=$(brew --prefix openssl@3)"
               ^------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.

    In bootstrap-scripts/bootstrap.sh line 224:
        export CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-readline-dir=$(pkg-config --variable=prefix readline)"
               ^------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.

    In bootstrap-scripts/bootstrap.sh line 230:
        export CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-ncurses-dir=$(pkg-config --variable=prefix ncurses)"
               ^------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.

    In bootstrap-scripts/bootstrap.sh line 237:
        export CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-libyaml-dir=$(pkg-config --variable=prefix yaml-0.1)"
               ^------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.

    In bootstrap-scripts/bootstrap.sh line 243:
        export CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-libksba-dir=$(pkg-config --variable=prefix ksba)"
               ^------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
… issue

Compiler / linker error was:

    linking shared-library libruby.3.1.dylib
    transform_mjit_header: making external definition static inline: rb_vm_lvar_exposed, Init_vm_stack_canary, rb_vm_opt_cfunc_p, rb_vm_opt_mod, rb_vm_ic_hit_p, rb_vm_splat_array, rb_vm_defined, rb_vm_cc_general, rb_aliased_callable_method_entry, rb_find_defined_class_by_owner, rb_vm_call_ivar_attrset_p, rb_iseq_only_kwparam_p, rb_iseq_only_optparam_p, rb_vm_set_ivar_idx, rb_vm_setinstancevariable, rb_vm_setclassvariable, rb_vm_getclassvariable, rb_vm_rewrite_cref, rb_vm_get_cref, rb_vm_block_ep_update, rb_vm_cref_new_toplevel, rb_vm_cref_dup_without_refinements, rb_vm_frame_block_handler, rb_vm_cframe_keyword_p, rb_vm_ep_local_ep
    transform_mjit_header: making declaration static inline: rb_vm_lvar_exposed, rb_vm_lvar_exposed, Init_vm_stack_canary, rb_vm_rewrite_cref, rb_vm_frame_block_handler, rb_vm_block_ep_update, rb_vm_ep_local_ep
    transform_mjit_header: SKIPPED to transform: __sigbits, isspecial, isrune, isphonogram, isnumber, isideogram, ishexnumber, digittoint, toupper, tolower, toascii, isxdigit, isupper, isspace, ispunct, isprint, islower, isgraph, isdigit, iscntrl, isblank, isalpha, isalnum, __wcwidth, __isctype, __istype, isascii, __sincospi, __sincospif, __sincos, __sincosf, __inline_isnormall, __inline_isnormald, __inline_isnormalf, __inline_signbitl, __inline_signbitd, __inline_signbitf, __inline_isnanl, __inline_isnand, __inline_isnanf, __inline_isinfl, __inline_isinfd, __inline_isinff, __inline_isfinitel, __inline_isfinited, __inline_isfinitef, __darwin_fd_clr, __darwin_fd_set, __darwin_fd_isset, __darwin_check_fd_set, __sputc
    ln -sf ../../../.ext/include/arm64-darwin24/rb_mjit_min_header-3.1.2.h include/ruby-3.1.0/arm64-darwin24/rb_mjit_min_header-3.1.2.h
    generating makefiles ext/configure-ext.mk
    building spec/ruby/optional/capi/ext/array_spec.bundle
    building spec/ruby/optional/capi/ext/basic_object_spec.bundle
    ext/configure-ext.mk updated
    building spec/ruby/optional/capi/ext/bignum_spec.bundle
    ld: can't link a dylib with itself. same install_name as dylib being built in '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [spec/ruby/optional/capi/ext/basic_object_spec.bundle] Error 1
    make[1]: *** Waiting for unfinished jobs....
    ld: can't link a dylib with itself. same install_name as dylib being built in '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [spec/ruby/optional/capi/ext/bignum_spec.bundle] Error 1
    ld: can't link a dylib with itself. same install_name as dylib being built in '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [spec/ruby/optional/capi/ext/array_spec.bundle] Error 1
    ++(/Users/runner/.rvm/scripts/functions/support:383): __rvm_make(): return 2
Error was:

    linking transcoder transdb.bundle
    clang: error: invalid argument '-compatibility_version 3.1' only allowed with '-dynamiclib'
    make[2]: *** [.ext/arm64-darwin23/enc/trans/transdb.bundle] Error 1
    make[1]: *** [trans] Error 2
We will just try to forcibly uninstall [email protected] for now... because CI probably had this preinstalled
Error was:

    linking encoding encdb.bundle
    clang: error: invalid argument '-compatibility_version 3.1' only allowed with '-dynamiclib'
    make[2]: *** [.ext/arm64-darwin23/enc/encdb.bundle] Error 1
    make[1]: *** [enc] Error 2
    make[1]: *** Waiting for unfinished jobs....
Oops! Forgot to source rvm in subshell
rvm help autolibs shows:

    ## Modes

    * `0`, `disable`, `disabled` - Do not do anything.
    * `1`, `read`, `read-only` - Use available libs, ignore missing.
    * `2`, `fail`, `read-fail` - Use libs, fail if some are missing.
    * `3`, `packages`, `install-packages`, - Use libs, install missing libs.
    * `4`, `enable`, `enabled` - Install missing package manager (only OSX, on Linux it's like 3).
Also adding some machine architecture debug output
@trinitronx trinitronx force-pushed the fix-openssl-version-conflict branch from 70c7e09 to b51883c Compare February 4, 2025 05:38
./configure script error was:

    checking target architectures... arm64e
    checking arch option... configure: error: unknown target architecture: arm64e
install.log error was:

                                        rbs 2.1.0
    Building native extensions. This could take a while...
    /Users/runner/.rvm/src/ruby-3.1.2/lib/rubygems/ext/builder.rb:95:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)

        current directory: /Users/runner/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension
    /Users/runner/.rvm/rubies/ruby-3.1.2/bin/ruby --disable\\=gems -I/Users/runner/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/arm64-darwin23 -I /Users/runner/.rvm/src/ruby-3.1.2/lib -r ./siteconf20250204-61114-6gdw6r.rb extconf.rb
    creating Makefile

    current directory: /Users/runner/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension
    make DESTDIR\\= clean
    dyld[61119]: terminating because inserted dylib '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' could not be loaded: tried: '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (no such file), '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))
    dyld[61119]: tried: '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (no such file), '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))

    current directory: /Users/runner/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension
    make DESTDIR\\=
    dyld[61120]: terminating because inserted dylib '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' could not be loaded: tried: '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (no such file), '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))
    dyld[61120]: tried: '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (no such file), '/Users/runner/.rvm/src/ruby-3.1.2/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))

    make failed, uncaught signal 6

    Gem files will remain installed in /Users/runner/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0 for inspection.
    Results logged to /Users/runner/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/extensions/arm64-darwin-23/3.1.0/rbs-2.1.0/gem_make.out
RVM warning was:

    Required ruby-3.1.3 is not installed.
    To install do: 'rvm install "ruby-3.1.3"'
    Checking requirements for osx.
    Missing required packages: pkg-config [email protected]
    Somehow it happened there is no executable 'openssl',
    run 'brew doctor' and make sure latest '[email protected]' is installed properly.
mkmf.log error was:

    DYLD_FALLBACK_LIBRARY_PATH=.:/Users/runner/.rvm/rubies/ruby-3.1.3/lib:/Users/runner/.rvm/src/ruby-3.1.3 "gcc -o conftest -I/Users/runner/.rvm/rubies/ruby-3.1.3/include/ruby-3.1.0/arm64-darwin23 -I/Users/runner/.rvm/rubies/ruby-3.1.3/include/ruby-3.1.0/ruby/backward -I/Users/runner/.rvm/rubies/ruby-3.1.3/include/ruby-3.1.0 -I. -I/opt/homebrew/Cellar/libffi/3.4.6/include -I/opt/homebrew/opt/gdbm/include -I/opt/homebrew/Cellar/libyaml/0.2.5/include -I/opt/homebrew/Cellar/readline/8.2.13/include -I/opt/homebrew/Cellar/openssl@3/3.4.0/include -I/opt/homebrew/Cellar/jemalloc/5.3.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -fdeclspec -Wno-error=implicit-function-declaration -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef -fno-common -pipe conftest.c  -L. -L/Users/runner/.rvm/rubies/ruby-3.1.3/lib -L/opt/homebrew/opt/gdbm/lib -L/opt/homebrew/Cellar/libyaml/0.2.5/lib -L/opt/homebrew/Cellar/readline/8.2.13/lib -L/opt/homebrew/Cellar/openssl@3/3.4.0/lib -L/opt/homebrew/Cellar/jemalloc/5.3.0/lib -L. -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -fstack-protector-strong -L/opt/homebrew/opt/gdbm/lib -L/opt/homebrew/Cellar/libyaml/0.2.5/lib -L/opt/homebrew/Cellar/readline/8.2.13/lib -L/opt/homebrew/Cellar/openssl@3/3.4.0/lib -L/opt/homebrew/Cellar/jemalloc/5.3.0/lib   -arch arm64   -lruby.3.1   -ljemalloc"
    dyld[63108]: terminating because inserted dylib '/Users/runner/.rvm/src/ruby-3.1.3/libruby.3.1.dylib' could not be loaded: tried: '/Users/runner/.rvm/src/ruby-3.1.3/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/.rvm/src/ruby-3.1.3/libruby.3.1.dylib' (no such file), '/Users/runner/.rvm/src/ruby-3.1.3/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), './libruby.3.1.dylib' (no such file), '/Users/runner/.rvm/rubies/ruby-3.1.3/lib/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))
    dyld[63108]: tried: '/Users/runner/.rvm/src/ruby-3.1.3/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/.rvm/src/ruby-3.1.3/libruby.3.1.dylib' (no such file), '/Users/runner/.rvm/src/ruby-3.1.3/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), './libruby.3.1.dylib' (no such file), '/Users/runner/.rvm/rubies/ruby-3.1.3/lib/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))
    checked program was:
    /* begin */
    1: #include "ruby.h"
    2:
    3: int main(int argc, char **argv)
    4: {
    5:   return !!argv[argc];
    6: }
    /* end */
Passing `-e` in `RUBYOPT` was not allowed.

Error was:

    ruby: invalid switch in RUBYOPT: -e (RuntimeError)
Note: The heredoc did not parse properly for passing to -e
…issues

Also, this is the version in chef-workstation 24.12.1073
…atch)

Error was:

    Patch 'osx-arch-fix' not found.
    There has been an error applying the specified patches. Halting the installation.
    Required ruby-3.1.6 is not installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dependencies Pull requests that update a dependency file enhancement ruby Pull requests that update Ruby code
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant