1

I build my C++ program using gcc 10 in Ubuntu 20.04, and then run it in Ubuntu 18.04, but unfortunately get errors as follows:

/opt/aspen/my: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /opt/my/myRenderer.so)
/opt/my/my: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /opt/my/libpython3.8.so.1.0)
/opt/my/my: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /opt/my/libpython3.8.so.1.0)

Is it possible to fix this issue by installing some additional packages in Ubuntu 18.04?

Fedor
  • 17,146
  • 13
  • 40
  • 131
  • 1
    There are some ways **1**. install `gcc` on you current machine e.g. compile it from source. **2**. Upgrade the whole machine you have. **3** compile it on first machine into **static binary** file not dynamic one, then you can run it almost everywhere. – Shakiba Moshiri May 27 '21 at 12:14
  • I see. And is it possible just to install missing glibc binaries in Ubuntu 18 (without compilation from sources)? – Fedor May 27 '21 at 12:41
  • 1
    Yes - you can but it is not so easy and I did it once - you may end up having conflict between shared `libs` on the machine you have - safest one is **static build** on Ubuntu 20. – Shakiba Moshiri May 27 '21 at 13:55

1 Answers1

1

There are some ways
1. install gcc on your current machine e.g. compile it from source. It does not guarantee - since you may need to have a higher version of glibc
2. Upgrade the whole machine you have.
3 compile it on first machine (Ubuntu 20) into static binary file not dynamic one, then you can run it almost everywhere.

Note. You may think of just compiling glibc on your machine - it is possible to do but since many others libraries are depended on glibc so may face errors for running CMDs or other programs. The safest one is option 3 static build.

Shakiba Moshiri
  • 21,040
  • 2
  • 34
  • 44
  • 1
    @employed-russian I have used and using many statically build binary files on Ubuntu, Debian and Arch more then 5 years and I do not think so *Contrary to popular belief, static linking produces less, not more, portable executables on Linux.* – Shakiba Moshiri May 31 '21 at 05:10