0

My work configuration is that I have Ubuntu-20-based development workstation (exactly Linux Mint 20.1) where I develop application for Ubuntu 18. When I compile simple C or C++ program, upload it to the target machine and run, I receive the message:

./test: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./test)
./test: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./test)

Can I force the program to link to the older version? I use gcc 9 if it does matter.

1
  • Probably the easiest way is to set up a build environment for the older version of Ubuntu in a Docker container or a virtual machine. Containers are preferable because they are less wasteful of system memory. Commented Jan 15, 2021 at 12:08

1 Answer 1

2

The canonical solution is create a chroot environment for the target version with debootstrap, as:

debootstrap --variant=buildd --arch amd64 bionic ~/bionic_chroot

and activating that chroot with

chroot ~/bionic_chroot

and do the compilation within chroot. See for example here for further details.

Sign up to request clarification or add additional context in comments.

2 Comments

Do I have to install also another copy of compiler, cmake, and other development tools?
Some of the packages needed for development (like gcc, make,...) are installed due the usage of `--variant=buildd' option, but the development dependencies of your project need to be installed, just as you did on your original system. And you need to get your a copy of your sources into the chroot, either copying it before your activate the chroot, or install git within the chroot environment, and clone the source tree.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.