I am trying to build glibc 2.27 on Clear Linux, obtained here: https://www.gnu.org/software/libc/sources.html
According to the help, I should build into a directory outside of the source folder using the prefix command. As far as I can tell, I am doing what is described in the installation help:
Configuring and compiling the GNU C Library
The GNU C Library cannot be compiled in the source directory. You must build it in a separate build directory. For example, if you have unpacked the GNU C Library sources in '/src/gnu/glibc-VERSION', create a directory '/src/gnu/glibc-build' to put the object files in. This allows removing the whole build directory in case an error occurs, which is the safest way to get a fresh start and should always be done.
From your object directory, run the shell script 'configure' located at the top level of the source tree. In the scenario above, you'd type
$ ../glibc-VERSION/configure ARGS...
Please note that even though you're building in a separate build directory, the compilation may need to create or modify files and directories in the source directory.
'configure' takes many options, but the only one that is usually mandatory is '--prefix'. This option tells 'configure' where you want the GNU C Library installed. This defaults to '/usr/local', but the normal setting to install as the standard system library is '--prefix=/usr' for GNU/Linux systems and '--prefix=' (an empty prefix) for GNU/Hurd systems.
so, I thought I was doing this correctly, but it still gave me an error about building in a different directory:
james@clr ~/Downloads/glibc $ ./configure --prefix=/home/james/Downloads/glibc-build/
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for readelf... readelf
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ can link programs... yes
configure: error: you must configure in a separate build directory