David Mokon Bond
David Mokon Bond

Reputation: 1656

Shared Library Portability

So I feel like I should know this but I don't so here goes...

For shared libs (.so) on Linux. My understanding is as long as the CPU architecture stays the same those should be portable between distros right?

e.g. If I had a x86_64 Fedora and I copied a .so file from it to a x86_64 Ubuntu the .so should work just fine?

Now I believe this assumes that:

A) The .so doesn't have unfulfilled dependencies to other .sos on the new machine. B) The .so doesn't have a dependency to a different version .so than the new machine

But let's say I have my libisprime.so shared object that has a single function to compute a prime number. This .so doesn't rely on anything else. I compile it on one distro. Shouldn't I be able to take this and use this on any distro with the same architecture?

Upvotes: 0

Views: 294

Answers (1)

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137527

They're just ELF files. So provided the dependency assumptions you've made are correct, I don't see any reason they wouldn't work across systems.

The best way to tell though, would be to install a few VMs and try it!

Upvotes: 2

Related Questions