RedHat 7.3 /lib64/libc.so.6: version `GLIBC_2.18' not found using brew gcc@7

Hi all,
I was looking for some advice on any workarounds for the error "/lib64/libc.so.6: version `GLIBC_2.18’ " which I get when I’m trying to compile something with gcc@7 installed by brew on an academic computing cluster running RedHat 7.3. I’m trying to compile some code where I use several libraries installed by brew which is why I’m not just using the system’s compiler or compilers I could module load. I’m using the newest brew update and upgrade. Some additional information:

ldd -v  /gpfs_home/nhathawa/.linuxbrew/Cellar/gcc@7/7.5.0_2/lib/gcc/7/libstdc++.so.6

gives

/gpfs_home/nhathawa/.linuxbrew/Cellar/gcc@7/7.5.0_2/lib/gcc/7/libstdc++.so.6: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /gpfs_home/nhathawa/.linuxbrew/Cellar/gcc@7/7.5.0_2/lib/gcc/7/libstdc++.so.6)
	linux-vdso.so.1 =>  (0x00007ffdd7bf8000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fd7f0ad0000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fd7f070f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd7f119e000)
	libgcc_s.so.1 => /gpfs_home/nhathawa/.linuxbrew/lib/libgcc_s.so.1 (0x00007fd7f04f8000)

	Version information:
	/gpfs_home/nhathawa/.linuxbrew/Cellar/gcc@7/7.5.0_2/lib/gcc/7/libstdc++.so.6:
		libm.so.6 (GLIBC_2.2.5) => /lib64/libm.so.6
		ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
		libgcc_s.so.1 (GCC_4.2.0) => /gpfs_home/nhathawa/.linuxbrew/lib/libgcc_s.so.1
		libgcc_s.so.1 (GCC_3.3) => /gpfs_home/nhathawa/.linuxbrew/lib/libgcc_s.so.1
		libgcc_s.so.1 (GCC_3.0) => /gpfs_home/nhathawa/.linuxbrew/lib/libgcc_s.so.1
		libc.so.6 (GLIBC_2.14) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.18) => not found
		libc.so.6 (GLIBC_2.16) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.17) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.2) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
	/lib64/libm.so.6:
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
		libc.so.6 (GLIBC_2.14) => /lib64/libc.so.6
		libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
	/lib64/libc.so.6:
		ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
	/gpfs_home/nhathawa/.linuxbrew/lib/libgcc_s.so.1:
		libc.so.6 (GLIBC_2.14) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6

And some system info

lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	RedHatEnterpriseServer
Description:	Red Hat Enterprise Linux Server release 7.3 (Maipo)
Release:	7.3
Codename:	Maipo
uname -r 
3.10.0-957.5.1.el7.x86_64

I’m not a hundred percent sure what’s happening as I’m Linux knowledge is limited but it seems like both older and newer versions of GLIBC can be found, it’s just 2.18 that can’t be. I don’t know much about the server as the institution manages it and the IT team is not very responsive. Currently, I just use a singularity image to run code but it’s annoying if I need to make small changes. Any advice would be greatly appreciated.

Nick

Read through “semantic versioning” lenses, GLIBC_2.18 is the latest glibc version symbol in your ldd output, which makes sense. If there actually were newer symbols that were satisfied, something would be Very Wrong with your system.

This is similar to the situation in this StackOverflow question, and your next step is similar: Either upgrade your OS, or rebuild gcc@7 from source.

Hi, Nick. What’s the output of brew config? I believe RedHat 7 provides glibc 2.17. Homebrew should have installed the brewed version of glibc 2.23 on your system. If you’re not too invested in this installation of Homebrew, try uninstalling it with rm -r ~/.linuxbrew and reinstalling it. Then run brew install gcc and brew install gcc@7. You should see glibc is one of the first dependencies installed before gcc.