0

I developed a app for Ubuntu. I compiles it on Ubuntu 0.04 64bit with current dev-esentials. I created a package with CPack and sent to a friend. He got:

libm.so.6: version "GLIBC_2.29" not found
libc.so.6: version "GLIBC_2.27" not found
libm.so.6: version "GLIBC_2.29" not found
libc.do.6: version "GLIBC_2.28" not found

He is on Ubuntu 16. I have installed glibc 2.31 on my development machine. So I assume that this lib is missing on his Ubuntu 16? Can I add this to the package so a Ubuntu 16 user do have the needed libs available? Or do I have to compile it with something like a compatibility flag?

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
IFDev
  • 55
  • 7

1 Answers1

0

I developed a app for Ubuntu. I compiles it on Ubuntu 20.04 64bit with current dev-esentials. I created a package with CPack and sent to a friend.

This will not work. In general, you need to develop your binary on the lowest version of the OS you plan to support.

Options for doing that are

  • build in a VM
  • build in a docker container
  • build in a chroot
  • build a Linux-to-older-Linux crosscompiler.

I have installed glibc 2.31 on my development machine. So I assume that this lib is missing on his Ubuntu 16?

Yes: Ubuntu 16.04 shipped with GLIBC-2.23, and it is impossible (well, it's possible but entirely nontrivial) to install newer version without upgrading the entire distribution.

Can I add this to the package so a Ubuntu 16 user do have the needed libs available?

No. The package you want to add will affect every (dynamically linked) program on the target system, and will (with very high probability) break that system (which is why distributions never upgrade GLIBC in the first place).

P.S. There are lots of "how to link against older GLIBC" answers on StackOverflow, but I couldn't find a single correct one.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362