r/linuxdev • • Jan 18 '19

About libssl, dependencies and package management

Hi, I'm making my first program that is useful to some people. I'm using Rust so I distribute executables for end users.

Previously I always built from my Debian Jessie installation and that worked everywhere, but now I'm starting to depend on libssl and I don't know what to do.

I'm worried about runtime dependencies. I don't know much about development and distribution on Linux but I'm eager to learn. As far as I know the best way to know my dependencies is by running readelf -d myprogram. I get:

{some code} (NEEDED)             Shared library: [libgtk-3.so.0]
{some code} (NEEDED)             Shared library: [libgdk-3.so.0]
{some code} (NEEDED)             Shared library: [libpango-1.0.so.0]
{some code} (NEEDED)             Shared library: [libcairo-gobject.so.2]
{some code} (NEEDED)             Shared library: [libcairo.so.2]
{some code} (NEEDED)             Shared library: [libgio-2.0.so.0]
{some code} (NEEDED)             Shared library: [libgobject-2.0.so.0]
{some code} (NEEDED)             Shared library: [libglib-2.0.so.0]
{some code} (NEEDED)             Shared library: [libssl.so.1.0.0]
{some code} (NEEDED)             Shared library: [libcrypto.so.1.0.0]
{some code} (NEEDED)             Shared library: [libdl.so.2]
{some code} (NEEDED)             Shared library: [librt.so.1]
{some code} (NEEDED)             Shared library: [libpthread.so.0]
{some code} (NEEDED)             Shared library: [libgcc_s.so.1]
{some code} (NEEDED)             Shared library: [libc.so.6]
{some code} (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
{some code} (NEEDED)             Shared library: [libm.so.6]
{lots of hex codes}

So, by searching those shared libraries on https://packages.debian.org by package contents. I assume that my Debian users need to install:

  • libgtk-3-0
  • libpango-1.0-0 (already installed as dependency of libgtk-3-0)
  • libcairo-gobject2 (already installed as dependency of libgtk-3-0)
  • libcairo2 (already installed as dependency of libgtk-3-0)
  • libglib2.0-0 (already installed as dependency of libgtk-3-0)
  • libssl1.0.0
  • libc6
  • libgcc1

So now I have a problem. I have to compile my program on a old Debian (Jessie) installation because I want to support old libc and libgcc. But now I depend on libssl1.0.0 which is not available on newer installations.

What should I do if I want to support every Linux distribution? Should I start packaging (.deb, .rpm, etc.) my program for every version of every distribution?

Should I instead build my program three times, one for libssl1.0.0, other for libssl1.0.2 and another for libssl1.1?

I always found package management interesting, so maybe I could try packaging to the Debian repos but that looks like a big responsibility, what do you think?

Thank you very much!

2 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/aptitude_moo Jan 20 '19

Thank you! I ended up linking to libssl statically and leaving the rest as dynamic dependencies, I didn't know that static linking was a thing. So for now I can share my builds, later if things start to get harder I will investigate about flatpak, appimage, snaps and those things.

2

u/[deleted] Jan 20 '19

The benefit to Flatpak is it stops becoming your job to maintain an openssl build and it will continue to get security updates. And again it is a terrible idea to assume the rest of your dependencies are acceptable as host dependencies. Flatpak avoids the guessing game and you know the libraries are always there.