[TL;DR: The solution is installing libssl-dev. See my answer to myself, below, which also solves related problems).]
[Original question:] I am trying to update some Ruby gems in a WSL/Ubuntu 20.04 environment. Specifically, I'm trying to update the openssl gem. I think I understand the error message and almost understand how to solve it. I need to provide the directory to openssl as a configuration option. I just don't know how to do that. Here's the relevant part of the error message:
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
<snip>
--with-openssl-dir
<snip>
extconf.rb:98:in `<main>': OpenSSL library could not be found.
You might want to use --with-openssl-dir=<dir> option to specify
the prefix where OpenSSL is installed. (RuntimeError)
Okay, so I understand I should use --with-openssl-dir=<dir> to provide the path to OpenSSL (which is in /usr/lib/ssl).
But how do I do that? As I understand it, this is a compilation flag that should go in a makefile or be passed at compile time. But I don't understand what file I should edit to pass this flag. I read the extconf.rb file, and to the extent I understand it, I don't see where this flag should go. I also don't see a makefile to edit (and if it's generated dynamically at compile time, that wouldn't be the right approach anyway).
I realize this might be obvious to some, but it's not to me, and I spent a fair amount of time trying to figure it out.