Bug #18876
closedOpenSSL fails to autoload in --with-static-linked-ext builds
Description
i try use ruby + gem in my macos app with .a framework, i need install ruby in a custom location.
so i make & make install openssl with this configure:
/usr/bin/perl Configure --prefix="......./local/dependencies" no-shared zlib darwin64-x86_64-cc
then make & make install ruby with this configure:
/bin/sh configure --prefix /Users/xxxxx/xxxx/local/bundle --with-openssl-dir="/Users/xxxxx/xxxx/local/dependencies" --enable-load-relative --with-static-linked-ext --disable-install-doc --with-out-ext="xxxxxx"
because i need to isolated environment, so i make bundle-env
file for run shell. and i uploaded bundle-env file
and update gem by local
destroot/bundle/bin/bundle-env gem install downloads/rubygems-update-3.3.15.gem --no-document --env-shebang
at last, run install alway got exception:
destroot/bundle/bin/bundle-env gem install xxxxxxx --version="xxxxxx" --no-document --env-shebang
ERROR: While executing gem ... (Gem::Exception)
OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
at the same env, i tried some command, and i got the right version what i make install
destroot/bundle/bin/bundle-env ruby --version // ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-darwin21]
destroot/bundle/bin/bundle-env gem --version // 3.3.15
destroot/bundle/bin/bundle-env ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION' // OpenSSL 1.1.1i 8 Dec 2020
i found and uploaded ext/openssl/mkmf.log
and
Files
Updated by alanwu (Alan Wu) over 2 years ago
- Status changed from Open to Feedback
Since bundle-env ruby -ropenssl
works, I suspect it has something to
do with --env-shebang
. Maybe the gem
command isn't running with
the Ruby you want. Try running RUBYOPT=-v bundle-env gem
and
comparing that with ruby -v
(without bundle-env
). You might
also want to try RUBYOPT=-vd
to surface any errors while loading
OpenSSL; it looks like RubyGems loads it using an autoload
:
https://github.com/rubygems/rubygems/blob/master/lib/rubygems/openssl.rb
Updated by Gloomy_meng (Gloomy Meng) over 2 years ago
my local version is 3.1.1 too, and run ruby -v
, got ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-darwin20]
.
and i tried some different version with add RUBYOPT=-v
and RUBYOPT=-vd
to make a comparison.
with 3.1.1 and -vd
[11:26:11] [Gems] destroot/bundle/bin/bundle-env gem install cocoapods --version="1.11.3" --no-document --env-shebang
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-darwin21]
Exception `LoadError' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems.rb:1323 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems.rb:1339 - cannot load such file -- rubygems/defaults/ruby
Exception `NameError' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/3.1.0/psych/class_loader.rb:70 - uninitialized constant BigDecimal
[val, ::Object.const_get(val)]
^^^^^^^^^^
Exception `NameError' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/3.1.0/psych/class_loader.rb:70 - uninitialized constant Date
[val, ::Object.const_get(val)]
^^^^^^^^^^
Exception `NameError' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/3.1.0/psych/class_loader.rb:70 - uninitialized constant DateTime
[val, ::Object.const_get(val)]
^^^^^^^^^^
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/3.1.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
().load_tags=
^
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/3.1.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
().dump_tags=
^
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/3.1.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
().domain_types=
^
Exception `Gem::Exception' at /Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:47 - OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
ERROR: While executing gem ... (Gem::Exception)
OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:47:in `configure_connection_for_https'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request/https_pool.rb:6:in `setup_connection'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request/http_pool.rb:39:in `make_connection'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request/http_pool.rb:20:in `checkout'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:129:in `connection_for'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:188:in `perform_request'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:154:in `fetch'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/remote_fetcher.rb:309:in `request'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/remote_fetcher.rb:209:in `fetch_http'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/remote_fetcher.rb:248:in `fetch_path'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/source.rb:95:in `dependency_resolver_set'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/best_set.rb:23:in `block in pick_sets'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/source_list.rb:98:in `each'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/source_list.rb:98:in `each_source'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/best_set.rb:22:in `pick_sets'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/best_set.rb:28:in `find_all'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/installer_set.rb:175:in `find_all'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/installer_set.rb:61:in `add_always_install'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/dependency_installer.rb:322:in `resolve_dependencies'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:201:in `install_gem'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:226:in `block in install_gems'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:219:in `each'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:219:in `install_gems'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:167:in `execute'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/command.rb:323:in `invoke_with_build_args'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/command_manager.rb:185:in `process_args'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/command_manager.rb:149:in `run'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/gem_runner.rb:53:in `run'
/Users/didi/Documents/CocoaPods-app3.1.1/destroot/bundle/bin/gem:13:in `<main>'
Finished in 12 minutes and 18 seconds
with 3.1.0 and -v
[11:05:45] [Gems] destroot/bundle/bin/bundle-env gem install cocoapods --version="1.11.3" --no-document --env-shebang
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin21]
ERROR: While executing gem ... (Gem::Exception)
OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
with 3.1.0 and -vd
[11:26:26] [Gems] destroot/bundle/bin/bundle-env gem install cocoapods --version="1.11.3" --no-document --env-shebang
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin21]
Exception `LoadError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems.rb:1323 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems.rb:1339 - cannot load such file -- rubygems/defaults/ruby
Exception `NameError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.1.0/psych/class_loader.rb:70 - uninitialized constant BigDecimal
[val, ::Object.const_get(val)]
^^^^^^^^^^
Exception `NameError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.1.0/psych/class_loader.rb:70 - uninitialized constant Date
[val, ::Object.const_get(val)]
^^^^^^^^^^
Exception `NameError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.1.0/psych/class_loader.rb:70 - uninitialized constant DateTime
[val, ::Object.const_get(val)]
^^^^^^^^^^
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.1.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
().load_tags=
^
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.1.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
().dump_tags=
^
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.1.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
().domain_types=
^
Exception `Gem::Exception' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:47 - OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
ERROR: While executing gem ... (Gem::Exception)
OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:47:in `configure_connection_for_https'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request/https_pool.rb:6:in `setup_connection'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request/http_pool.rb:39:in `make_connection'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request/http_pool.rb:20:in `checkout'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:129:in `connection_for'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:188:in `perform_request'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:154:in `fetch'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/remote_fetcher.rb:309:in `request'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/remote_fetcher.rb:209:in `fetch_http'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/remote_fetcher.rb:248:in `fetch_path'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/source.rb:95:in `dependency_resolver_set'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/best_set.rb:23:in `block in pick_sets'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/source_list.rb:98:in `each'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/source_list.rb:98:in `each_source'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/best_set.rb:22:in `pick_sets'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/best_set.rb:28:in `find_all'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/installer_set.rb:175:in `find_all'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/resolver/installer_set.rb:61:in `add_always_install'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/dependency_installer.rb:322:in `resolve_dependencies'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:201:in `install_gem'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:226:in `block in install_gems'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:219:in `each'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:219:in `install_gems'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:167:in `execute'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/command.rb:323:in `invoke_with_build_args'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/command_manager.rb:185:in `process_args'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/command_manager.rb:149:in `run'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/gem_runner.rb:53:in `run'
/Users/didi/Documents/CocoaPods-app/destroot/bundle/bin/gem:28:in `<main>'
Finished in 2 minutes and 42 seconds
my local version is 3.1.1 too, so i tried with 3.0.3 and 3.1.0 version for your suggestion.
with add RUBYOPT=-v
and version is 3.0.3
when run
destroot/bundle/bin/bundle-env gem install downloads/rubygems-update-3.3.15.gem --no-document --env-shebang
i got error with this
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin21]
Exception `LoadError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems.rb:1332 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at <internal:/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at <internal:/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:162 - cannot load such file -- rubygems/defaults/operating_system
Exception `NameError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/psych/class_loader.rb:70 - uninitialized constant BigDecimal
Exception `NameError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/psych/class_loader.rb:70 - uninitialized constant Date
Exception `NameError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/psych/class_loader.rb:70 - uninitialized constant DateTime
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
Exception `SyntaxError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/forwardable/impl.rb:4 - <compiled>: syntax error, unexpected end-of-input
Exception `Gem::MissingSpecError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems/dependency.rb:311 - Gem::MissingSpecError
Exception `Gem::MissingSpecError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems/specification.rb:1402 - Gem::MissingSpecError
Exception `Gem::MissingSpecError' at <internal:/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:76 - Gem::MissingSpecError
Exception `Gem::MissingSpecError' at <internal:/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:162 - Gem::MissingSpecError
Exception `Gem::MissingSpecError' at <internal:/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:162 - Gem::MissingSpecError
Exception `NameError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.0.0/rubygems/command_manager.rb:225 - uninitialized constant Gem::Commands::InstallCommand
Did you mean? Gem::InstallUpdateOptions
ERROR: Loading command: install (Gem::MissingSpecError)
with add RUBYOPT=-v
and version is 3.1.0
Updated by Gloomy_meng (Gloomy Meng) over 2 years ago
bundle-env
's ruby is new installed , not my local version
Updated by alanwu (Alan Wu) over 2 years ago
- Status changed from Feedback to Open
I had some issues building OpenSSL
and the Ruby wrapper, but I was able to reproduce this problem.
RubyGems sets an autoload
for OpenSSL and then immediately triggers it with a
defined?
:
# from lib/rubygems/openssl.rb
autoload :OpenSSL, "openssl"
module Gem
HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
end
This exposes a behavior particular to the Ruby build configuration. It seems
that defined?(AutoLoadConstant)
returns nil
as opposed to loading the file
in other build configurations:
$ ruby --disable-all -ve 'autoload(:Ripper, "ripper"); p defined?(Ripper)'
ruby 3.2.0dev (2022-06-26T13:24:22Z static-ext-load-rel 49d5921550) [x86_64-darwin21]
nil
$ chruby 3.1.2
$ ruby --disable-all -ve 'autoload(:Ripper, "ripper"); p defined?(Ripper)'
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin20]
"constant"
I haven't investigated any deeper than this.
As a workaround, you can try applying the following patch against 3.1.2; I'm
able to run gem install rubygems-update
with it.
--- a/lib/rubygems/openssl.rb
+++ b/lib/rubygems/openssl.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-autoload :OpenSSL, "openssl"
+require "openssl"
module Gem
HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
Updated by Gloomy_meng (Gloomy Meng) over 2 years ago
ruby version changed to 3.1.2 still error ~
Here is the file I refer to, https://github.com/CocoaPods/CocoaPods-app/blob/master/Rakefile.
here is my rake file, step by step execution command.
[10:47:51] [pkg-config-0.28] /usr/bin/tar -zxvf downloads/pkg-config-0.28.tar.gz -C workbench
[10:47:51] [pkg-config-0.28] cd workbench/pkg-config-0.28 && /bin/sh configure --prefix /Users/didi/Documents/CocoaPods-app/destroot/dependencies --enable-static --with-internal-glib
[10:48:59] [pkg-config-0.28] cd workbench/pkg-config-0.28 && /usr/bin/make -j 7
[10:49:04] [pkg-config-0.28] cd workbench/pkg-config-0.28 && /usr/bin/make install
[10:49:05] [yaml-0.1.6] /usr/bin/tar -zxvf downloads/yaml-0.1.6.tar.gz -C workbench
[10:49:05] [yaml-0.1.6] cd workbench/yaml-0.1.6 && /bin/sh configure --prefix /Users/didi/Documents/CocoaPods-app/destroot/dependencies --disable-shared
[10:49:14] [yaml-0.1.6] cd workbench/yaml-0.1.6 && /usr/bin/make -j 7
[10:49:15] [yaml-0.1.6] cd workbench/yaml-0.1.6 && /usr/bin/make install
[10:49:15] [zlib-1.2.8] /usr/bin/tar -zxvf downloads/zlib-1.2.8.tar.gz -C workbench
[10:49:15] [zlib-1.2.8] cd workbench/zlib-1.2.8 && /bin/sh configure --prefix /Users/didi/Documents/CocoaPods-app/destroot/dependencies --static
[10:49:16] [zlib-1.2.8] cd workbench/zlib-1.2.8 && /usr/bin/make -j 7
[10:49:17] [zlib-1.2.8] cd workbench/zlib-1.2.8 && /usr/bin/make install
[10:49:17] [openssl-1.1.1i] /usr/bin/tar -zxvf downloads/openssl-1.1.1i.tar.gz -C workbench
[10:49:18] [openssl-1.1.1i] cd workbench/openssl-1.1.1i && /usr/bin/perl Configure --prefix="/Users/didi/Documents/CocoaPods-app/destroot/dependencies" no-shared zlib darwin64-x86_64-cc
[10:49:21] [openssl-1.1.1i] cd workbench/openssl-1.1.1i && /usr/bin/make -j 1
[10:53:23] [openssl-1.1.1i] Patching: workbench/openssl-1.1.1i/libcrypto.pc
[10:53:23] [openssl-1.1.1i] Patching: workbench/openssl-1.1.1i/libssl.pc
[10:53:23] [openssl-1.1.1i] cd workbench/openssl-1.1.1i && /usr/bin/make install
[10:55:18] [ruby-3.1.2] /usr/bin/tar -zxvf downloads/ruby-3.1.2.tar.gz -C workbench
[10:55:22] [ruby-3.1.2] cd workbench/ruby-3.1.2 && /bin/sh configure --prefix /Users/didi/Documents/CocoaPods-app/destroot/bundle --enable-load-relative --disable-shared --with-static-linked-ext --disable-install-doc --with-out-ext=",win32,win32/resolv,dbm,gdbm,sdbm,dl/win32,fiddle/win32,tk/tkutil,tk,win32ole,-test-/win32/dln,-test-/win32/fd_setsize,-test-/win32/dln/empty"
[10:57:34] [ruby-3.1.2] cd workbench/ruby-3.1.2 && /usr/bin/make -j 7
[11:00:44] [ruby-3.1.2] cd workbench/ruby-3.1.2 && /usr/bin/make install
[11:01:11] [bundle-env] Installing
[11:01:11] [rubygems-update-3.3.15] destroot/bundle/bin/bundle-env gem install downloads/rubygems-update-3.3.15.gem --no-document --env-shebang
[11:01:13] [rubygems-update-3.3.15] destroot/bundle/bin/bundle-env update_rubygems
[11:01:21] [rubygems-update-3.3.15] Patching: destroot/bundle/bin/gem
[11:01:21] [Gems] destroot/bundle/bin/bundle-env gem install cocoapods --version="1.11.3" --no-document --env-shebang
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
Exception `LoadError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems.rb:1323 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems.rb:1339 - cannot load such file -- rubygems/defaults/ruby
Exception `NameError' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/3.1.0/psych/class_loader.rb:70 - uninitialized constant BigDecimal
Exception `Gem::Exception' at /Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/request.rb:47 - OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources
and [openssl-1.1.1i] Patching: workbench/openssl-1.1.1i/libcrypto.pc
is replace Libs: -L${libdir} -lcrypto
by Libs: -lz -L${libdir} -lcrypto
here is note in https://github.com/CocoaPods/CocoaPods-app/blob/master/Rakefile in line 423
# Seems to be a OpenSSL bug in the pkg-config, as libz is required when
# linking libssl, otherwise Ruby's openssl ext will fail to configure.
# So add it ourselves.
and [11:01:21] [rubygems-update-3.3.15] Patching: destroot/bundle/bin/gem
is replace `` by #!/usr/bin/env ruby
.
here is note in https://github.com/CocoaPods/CocoaPods-app/blob/master/Rakefile in line 566
Fix shebang of `gem` bin to use bundled Ruby.
Updated by Gloomy_meng (Gloomy Meng) over 2 years ago
and [11:01:21] [rubygems-update-3.3.15] Patching: destroot/bundle/bin/gem is replace #!/Users/didi/Documents/CocoaPods-app/destroot/bundle/bin/ruby
by #!/usr/bin/env ruby.
Updated by alanwu (Alan Wu) over 2 years ago
Try the patch I posted on:
/Users/didi/Documents/CocoaPods-app/destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/openssl.rb
After update_rubygems
. The update probably reverts the patch against the bundled version.
You can check the contents of that file to make sure it's patched.
Updated by Gloomy_meng (Gloomy Meng) over 2 years ago
i install cocoapods succeed, tks.
so i only need update opessl.rb file in destroot/bundle/lib/ruby/site_ruby/3.1.0/rubygems/
when finished update_rubygems
Updated by hsbt (Hiroshi SHIBATA) over 2 years ago
- Status changed from Open to Closed
Updated by thomthom (Thomas Thomassen) about 2 years ago
alanwu (Alan Wu) wrote in #note-4:
I had some issues building OpenSSL
and the Ruby wrapper, but I was able to reproduce this problem.RubyGems sets an
autoload
for OpenSSL and then immediately triggers it with a
defined?
:
I'm running into issues on macOS with this (Ruby 3.1.2). The defined? OpenSSL::SSL
doesn't load OpenSSL. However, on a Windows build it does load automatically. Not sure why it doesn't autoload on macOS in this Ruby version.
I didn't understand the rest of the comments here. Is this autoload issue a result of misconfiguration when building Ruby?
Updated by alanwu (Alan Wu) about 2 years ago
- Subject changed from OpenSSL is not available with `--with-openssl-dir` to OpenSSL fails to autoload in --with-static-linked-ext builds
@thomthom (Thomas Thomassen)
The issue was specific to --with-static-linked-ext
builds, which you
might not be using because it's not a popular way to build Ruby. You
can check ruby -ve 'p RbConfig::CONFIG["configure_args"]'
to see if
you built with that option. Unrelated to the autoload issue, on macOS I
found that I usually need to use OpenSSL from HomeBrew to get the extension
working because the system LibreSSL is incompatible. You might want to check
if require 'openssl'
works.
The autoload issue I described in that comment seems to be fixed on the
master branch now.
Updated by thomthom (Thomas Thomassen) about 2 years ago
alanwu (Alan Wu) wrote in #note-11:
@thomthom (Thomas Thomassen)
The issue was specific to--with-static-linked-ext
builds, which you
might not be using because it's not a popular way to build Ruby.
We don't build a normal Ruby, we embed the interpreter into our application for plugin capabilities.
Our configure args:
'--prefix=/Users/user/.conan/data/ruby/3.1.2/sketchup/stable/build/bd95825b99dcb274d0e577fbdc953653a9ea0fb9'
'--with-openssl-dir=/Users/user/.conan/data/openssl/1.1.1q/sketchup/stable/package/93ae0b0e7eebe0611c04d3e0d9bbf49fbce92332'
'--with-libyaml-dir=/Users/user/.conan/data/libyaml/0.2.5/sketchup/stable/package/a56a950abed2e10dbdc26845400f0a034d97c454'
'--disable-install-doc'
'--disable-install-rdoc'
'--enable-shared'
'--enable-load-relative'
'--with-static-linked-ext'
'--without-debug'
'--without-gdbm'
'--without-gettext'
'--without-irb'
'--without-mkmf'
'--without-rdoc'
'--without-readline'
'--without-tk'
'--bindir=${prefix}/bin'
'--sbindir=${prefix}/bin'
'--libexecdir=${prefix}/bin'
'--libdir=${prefix}/lib'
'--includedir=${prefix}/include'
'--oldincludedir=${prefix}/include'
'--datarootdir=${prefix}/share' 'cflags=-mmacosx-version-min=10.14 -fdeclspec' 'cxxflags=-mmacosx-version-min=10.14 -fdeclspec' 'LDFLAGS=-mmacosx-version-min=10.14 -fdeclspec'
So is --with-static-linked-ext
causing a bug with autoload
? Or is it a configuration issue?
`require 'openssl' works.
I also added some logging to openssl.rb
to trace when it was loaded. While defined? OpenSSL::SSL
doesn't trigger the autoload, if I manually type OpenSSL
from the terminal the autoload
does work. Which then leaves me baffled to why HAVE_SSL = defined? OpenSSL::SSL
isn't behaving as expected.
I checked the config of our previous Ruby 2.7 build and that also used --with-static-linked-ext
- but Gem.install
works fine there.
Updated by alanwu (Alan Wu) about 2 years ago
thomthom (Thomas Thomassen) wrote in #note-12:
So is
--with-static-linked-ext
causing a bug withautoload
? Or is it a configuration issue?
Yeah, it's a bug and not a configuration issue.
defined?
is a keyword and the argument isn't evaluated like in a method call which is
why it could behave differently from referencing the constant in a normal context.
Updated by thomthom (Thomas Thomassen) about 2 years ago
alanwu (Alan Wu) wrote in #note-13:
thomthom (Thomas Thomassen) wrote in #note-12:
So is
--with-static-linked-ext
causing a bug withautoload
? Or is it a configuration issue?Yeah, it's a bug and not a configuration issue.
defined?
is a keyword and the argument isn't evaluated like in a method call which is
why it could behave differently from referencing the constant in a normal context.
Is there an open ticket to track this bug? This one appear to have been closed.
Updated by alanwu (Alan Wu) about 2 years ago
thomthom (Thomas Thomassen) wrote in #note-14:
alanwu (Alan Wu) wrote in #note-13:
thomthom (Thomas Thomassen) wrote in #note-12:
So is
--with-static-linked-ext
causing a bug withautoload
? Or is it a configuration issue?Yeah, it's a bug and not a configuration issue.
defined?
is a keyword and the argument isn't evaluated like in a method call which is
why it could behave differently from referencing the constant in a normal context.Is there an open ticket to track this bug? This one appear to have been closed.
The issue seems to be fixed on the master branch so I don't think we need another ticket.
Feel free to make a ticket if you can reproduce this on the master branch.
If you're interested to find the change that fixed the issue you could try bisecting.
Updated by thomthom (Thomas Thomassen) about 2 years ago
alanwu (Alan Wu) wrote in #note-15:
The issue seems to be fixed on the master branch so I don't think we need another ticket.
Feel free to make a ticket if you can reproduce this on the master branch.
If you're interested to find the change that fixed the issue you could try bisecting.
We see the issue with a build from master with this config:
./ruby -ve 'p RbConfig::CONFIG["configure_args"]'
ruby 3.2.0dev (2022-11-07T19:35:21Z master b14f133054) [x86_64-darwin20]
" '--prefix=/Users/vmehta/ruby/ruby-master/' '--with-openssl-dir=/Users/vmehta/.conan/data/openssl/1.1.1q/sketchup/stable/package/f2d937af1fa19d5fc4095849a65d1927e9e75ae7/' '--with-libyaml-dir=/Users/vmehta/.conan/data/libyaml/0.2.5/sketchup/stable/package/3fc084e254210603a5c5aece184b2d45e2509b30' '--disable-install-doc' '--disable-install-rdoc' '--enable-shared' '--enable-load-relative' '--with-static-linked-ext' '--without-debug' '--without-gdbm' '--without-gettext' '--without-irb' '--without-mkmf' '--without-rdoc' '--without-readline' '--without-tk'"
Should I be making a new ticket? What additional information would be useful?
Is it --with-static-linked-ext
that triggers this?
Updated by alanwu (Alan Wu) about 2 years ago
thomthom (Thomas Thomassen) wrote in #note-16:
Should I be making a new ticket? What additional information would be useful?
Feel free to make a new ticket. Make sure to include the full configure_args. It seems to be cut off.
Is it
--with-static-linked-ext
that triggers this?
I don't know. I wasn't be able to reproduce the issue with --with-static-linked-ext
and --enable-load-relative
. Maybe it's a combination with --with-openssl-dir
.
Updated by thomthom (Thomas Thomassen) about 2 years ago
alanwu (Alan Wu) wrote in #note-17:
thomthom (Thomas Thomassen) wrote in #note-16:
Should I be making a new ticket? What additional information would be useful?
Feel free to make a new ticket. Make sure to include the full configure_args. It seems to be cut off.
Is it
--with-static-linked-ext
that triggers this?I don't know. I wasn't be able to reproduce the issue with
--with-static-linked-ext
and--enable-load-relative
. Maybe it's a combination with--with-openssl-dir
.
Logged new issue: https://bugs.ruby-lang.org/issues/19115