Reputation: 18561
I would like to compile and test my C++ code against an arbitrary glibc release, for example glibc 2.25. What is the best way to do so?
glibc >=2.17 is preferred but a more recent cutoff would be OK. x86 or x86-64 is sufficient, and I am comfortable using Docker too if that helps.
Thanks for any help!
Upvotes: 0
Views: 258
Reputation: 141483
How to test against an arbitrary version of glibc?
A simple way would be to pick your favorite distribution and run an old version of it, then using a historic snapshot of repositories update the distribution to its specific version. Run such distribution in your favorite virtualization method. Then inside that virtualization import your code and run your tests.
My favorite distribution is Archlinux and it has daily snapshots of repositories since 2013.
If kernel version compatibility is not an issue, you might use docker - docker hub comes with a lot of images of well known linux distributions. For example glibc 2.27 is available on ubuntu:18.04:
$ docker run -ti --rm ubuntu:18.04 ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1.4) 2.27
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
Upvotes: 1