r/ruby • u/AustinBlues13 • Jun 04 '26
Debugging Ruby OpenSSL gem build
On Ubuntu 25.10, using system Ruby, I'm trying to build a Sinatra app that uses the OpenSSL with native extensions Gem 2.0.2. I can look at the .out file, but I don't know what I'm looking for. Presumably the native extensions don't match up with the .c and/or .h files.
2
Upvotes
1
u/AustinBlues13 Jun 04 '26
Downgrading OpenSSL package to previous release/update doesn't help. The app did build and work last week.
1
u/DanZuko420 Jun 04 '26
Do you have the ruby-dev package installed? Can you post any part of the error?
1
u/bogdanelcs Jun 05 '26 •
yeah this is a classic native extension mismatch. a few things to check:
first, make sure you have the OpenSSL dev headers installed, the gem needs those to compile:
sudo apt install libssl-dev
then check what version of OpenSSL your system is running:
openssl version
OpenSSL gem 2.0.2 is pretty old and may not be compatible with newer OpenSSL versions (3.x). Ubuntu 25.10 is likely shipping OpenSSL 3.x which changed a bunch of APIs that older gem versions depended on.
in your .out file look for lines like:
those tell you exactly which API calls the gem is making that no longer exist in your OpenSSL version.
the real fix is probably just bumping the gem version. in your Gemfile:
gem 'openssl', '~> 3.2'
OpenSSL gem 3.x was specifically rewritten to support OpenSSL 3.x on the system side. staying on 2.0.2 against a modern Ubuntu is going to keep fighting you.
what does the top of the .out file say?
2
u/armahillo Jun 05 '26
I recommend not using system ruby.
Ive had the best luck with the ruby versions provided by ‘asdf’, but regardless, youll want to use some kind of versioning manager