Cyberithub

Solved "configure: error: you must configure in a separate build directory"

Advertisements

In this article, we will see how to solve configure: error: you must configure in a separate build directory if you are also getting this error while trying to install glibc library using source code. This error is something which users are getting all the time when they missed to perform one important step before running configure script. But this is not always the case. Sometimes you might get this error due to some other reasons as well but here we will see the most common reason responsible for configure: error: you must configure in a separate build directory.

 

Solved "configure: error: you must configure in a separate build directory"

Solved "configure: error: you must configure in a separate build directory"

Also Read: How to enable root ssh authentication in Fedora Linux

This happened to me as well when I was trying to install glibc library on my Ubuntu 20.04 LTS system using source code. While running the configure script, I noticed configure: error: you must configure in a separate build directory on the output as shown below.

cyberithub@ubuntu:~/glibc-2.29$ ./configure
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 for g++... g++
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

While the above error could occur due to many reasons but most of the time it is because of the absence of a separate build directory to run the build. So let's say if you are currently in the root directory of glibc library package which is under /home/cyberithub location then it should below location when we try to check the present working location.

cyberithub@ubuntu:~/glibc-2.29$ pwd
/home/cyberithub/glibc-2.29

Now here, you need to create a separate build directory with a meaningful name. In my case, I am creating a build directory called glibc-build as shown below.

cyberithub@ubuntu:~/glibc-2.29$ mkdir glibc-build

Then switch to the build directory using cd glibc-build command as shown below.

cyberithub@ubuntu:~/glibc-2.29$ cd glibc-build/

Finally run the configure script using below given prefix pointing to the current build directory. You will notice that this time there is no error and it will run successfully.

cyberithub@ubuntu:~/glibc-2.29/glibc-build$ ../configure --prefix=/home/cyberithub/glibc-2.29/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 for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ can link programs... yes
checking for sysdeps preconfigure fragments... aarch64 alpha arm csky hppa i386 m68k microblaze mips nios2 powerpc riscv s390 sh sparc x86_64 checking whether gcc compiles in -mx32 mode by default... no

checking for use of fpu sysdeps directories... yes
checking for -fstack-protector... yes
checking for -fstack-protector-strong... yes
checking for -fstack-protector-all... yes
checking for assembler and linker STT_GNU_IFUNC support... yes
checking for gcc attribute ifunc support... yes
checking whether the linker supports textrels along with ifunc... yes
checking if compiler warns about alias for function with incompatible types... yes
............................................

Hopefully, above solution will help you as well in solving configure: error: you must configure in a separate build directory. Please let me know your feedback in the comment box !!

Leave a Comment