Skip to content

ruby-build ignores pkg-config when deciding whether to install OpenSSL #2544

@baarde

Description

@baarde

If no compatible OpenSSL version is found, ruby-build downloads and installs OpenSSL.

When looking for a compatible OpenSSL version, ruby-build will try the system OpenSSL, then Homebrew-installed OpenSSL versions.

ruby-build should to be able to find an OpenSSL version installed by other package managers, using pkg-config (like Autoconf does when building Ruby).

Steps to reproduce the behavior

  • Install Ruby dependencies, as well as pkg-config, using your package manager of choice (say MacPorts):
    sudo port install pkgconfig openssl libyaml
  • Check that pkg-config is present and finds OpenSSL:
    pkg-config --cflags --libs openssl
  • Check that OpenSSL version is 3.x.x:
    pkg-config --modversion openssl
  • Check that Ruby builds correctly on your machine:
    cd ruby-3.4.4 \
      && ./autogen.sh \
      && ./configure --prefix=/var/tmp/ruby-3.4.4 --enable-shared --with-ext=openssl,psych,+ \
      && make install
  • Install Ruby using ruby-build:
    ruby-build 3.4.4 /var/tmp/ruby-3.4.4

Expected behavior

ruby-build should use the OpenSSL package installed by the package manager.

Actual behavior

ruby-build downloads and builds OpenSSL.

Logs

==> Downloading openssl-3.0.16.tar.gz...
-> curl -q -fL -o openssl-3.0.16.tar.gz https://dqw8nmjcqpjn7.cloudfront.net/57e03c50feab5d31b152af2b764f10379aecd8ee92f16c985983ce4a99f7ef86
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14.6M  100 14.6M    0     0  44.3M      0 --:--:-- --:--:-- --:--:-- 44.4M
==> Installing openssl-3.0.16...
-> ./config --prefix=/var/tmp/ruby-3.4.4/openssl --openssldir=/var/tmp/ruby-3.4.4/openssl/ssl --libdir=lib zlib-dynamic no-ssl3 shared
-> make -j 12
-> make install_sw install_ssldirs
==> Installed openssl-3.0.16 to /var/tmp/ruby-3.4.4
==> Downloading ruby-3.4.4.tar.gz...
-> curl -q -fL -o ruby-3.4.4.tar.gz https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.4.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 22.1M  100 22.1M    0     0  32.2M      0 --:--:-- --:--:-- --:--:-- 32.2M
==> Installing ruby-3.4.4...
-> ./configure --prefix=/var/tmp/ruby-3.4.4 --with-openssl-dir=/var/tmp/ruby-3.4.4/openssl --enable-shared --with-ext=openssl,psych,+
-> make -j 12
-> make install
==> Installed ruby-3.4.4 to /var/tmp/ruby-3.4.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions