Check glibc Version Required by Binary File On Linux

Check glibc Version Required by Binary File On Linux

The GNU C Library, commonly known as glibc, is an open-source implementation of the standard C library. The glibc provides essential system functions that applications and binaries depend on. When running a binary, you may encounter compatibility issues if your system's glibc version is older than the one required by the binary. This tutorial explains how to check glibc version required by binary file on Linux.

The objdump command is a utility in Linux systems used for displaying information about object files, executables, libraries, and other binary files.

To determine the required glibc versions for a binary file, we can use a combination of objdump, grep, and sed commands. For example, to check the required glibc versions for the mkdir command located in /usr/bin directory, run:

objdump -T /usr/bin/mkdir | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu

Sample output:

2.2.5
2.3
2.3.2
2.3.4
2.4
2.7
2.14
2.16
2.26
2.33
2.34

This output means that the system needs at least the highest version listed (2.34 in this case) to run it without compatibility issues.

Explanation of the command:

  • objdump -T - lists dynamic symbols in the binary, including references to glibc functions.
  • grep GLIBC - filters lines containing "GLIBC", which denotes versioned symbols from glibc.
  • sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' - extracts only the version numbers.
  • sort -Vu - sorts the versions in ascending order, removing duplicates.

Leave a Comment

Cancel reply

Your email address will not be published.