Error during make: undefined reference to `memcpy@GLIBC_2.14'

I’m trying to build LLVM/Clang following the tutorial at https://clang.llvm.org/get_started.html and when I do the make command, I get the following error:

[  4%] Building CXX object utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CTagsEmitter.cpp.o
[  4%] Built target obj.llvm-tblgen
[  4%] Linking CXX executable ../../bin/llvm-tblgen
/gpfs/fs2/scratch/username/myenvs/PyEnv1/bin/../lib/gcc/x86_64-conda-linux-gnu/12.2.0/../../../../x86_64-conda-linux-gnu/bin/ld: /scratch/username/myenvs/PyEnv1/lib/libzstd.so: undefined reference to `memcpy@GLIBC_2.14'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/llvm-tblgen] Error 1
make[1]: *** [utils/TableGen/CMakeFiles/llvm-tblgen.dir/all] Error 2
make: *** [all] Error 2

My OS is Red Hat Enterprise Linux Server 7.9 and my gcc version is 12.2.0. My cmake command had a lot of not found/failed outputs, but seemed to finish since the configuring and generating finished.

I’m not sure where you acquired /scratch/username/myenvs/PyEnv1/lib/libzstd.so (and why the linker is referencing it), but it references a newer glibc version than what you have on your system. RedHat has the official devtoolset packages to backport newer toolchains, which might work better? @tstellar might have more ideas here.

@erkroch Instructions for installing the pre-built llvm packages are here.