I'm trying to build a .so library to run on another machine. The other machine doesn't allow me to install other libraries, nor can I run a compiler there, I just need to give it a ready executable package. The relevant code needs to be in a .so, I can't have it in a statically linked executable: the main program is in Java, and we're using JNA to load the .so.
I had an earlier version of this issue where the Java was calling an executable. Then I was able to statically link that executable and package it up to send along. The .so case seems more difficult. I tried for a solid day to statically link all the other libraries I needed (libgfortran, libgmp, libpthread...) in, but they ultimately required libc. I know that statically linking libc is a bad idea and, when I tried to, I had many issues and mostly just found a bunch of people saying not to bother trying.
I know that one possibility may be using a different libc implementation, like musl libc, but I don't exactly understand what that means.
If I don't statically link libc, then it looks for a particular version of libc (2.29) that I'm building with, that's not available on the final machine. I don't know what version actually is available, and don't have a convenient way of finding out. How can I make this program portable?
Thanks.