Building Systems
šŸ“’

Building Systems

Tags
Published
February 14, 2025
Build System
configureĀ Equivalent
makeĀ Equivalent
Used In
慤
GNU Autotools (Unix)
./configure
make
GLIBC, OpenSSL, Bash
āš ļø Limited (with MinGW/Cygwin)
CMake
cmake .
make
Qt, LLVM, KDE
Native Windows support
Meson/Ninja
meson setup
ninja
GNOME, Systemd
Cross-platform
Bazel
bazel build
bazel run
TensorFlow, Google projects
Cross-platform
MSBuild
.slnĀ orĀ .vcxprojĀ files
msbuild <project>.sln
.NET, Windows apps
Windows-only
SCons
慤
慤
Embedded systems
Cross-platform

šŸ” What DoĀ configure,Ā make, andĀ make installĀ Do?

When compiling software from source (like GLIBC), we typically run three key commands:
1ļøāƒ£Ā ./configure
2ļøāƒ£Ā make
3ļøāƒ£Ā make install
Each command has a specific purpose in theĀ compilation and installation process. Letā€™s break them down! šŸš€

šŸ“Œ 1ļøāƒ£Ā ./configureĀ - Prepares the Build

What It Does:

  • Checks your systemĀ to see if it has the necessary dependencies (likeĀ gcc,Ā make, etc.).
  • Sets up configuration filesĀ (e.g.,Ā Makefile) based on your system.
  • Defines where the program will be installedĀ (viaĀ -prefix=<install_path>).

Example:

bash CopyEdit ./configure --prefix=/opt/glibc-2.32
  • This tells the software:"When installed, put the files inĀ /opt/glibc-2.32Ā instead of the defaultĀ /usr/local."
  • If you donā€™t useĀ -prefix, the default install location isĀ /usr/local.

What It Produces:

  • Creates aĀ MakefileĀ that tellsĀ makeĀ how to build the program.

šŸ“Œ 2ļøāƒ£Ā makeĀ - Compiles the Source Code

What It Does:

  • Reads theĀ MakefileĀ (created byĀ configure).
  • Compiles the source codeĀ into object files (.oĀ files).
  • LinksĀ the compiled files to create an executable binary.

Example:

bash CopyEdit make -j$(nproc)
  • TheĀ j$(nproc)Ā flag tellsĀ makeĀ toĀ use all available CPU coresĀ for faster compilation.

What It Produces:

  • A compiled version of the program (in theĀ build/Ā folder, not installed yet).
Note:Ā At this stage, the program is compiled butĀ not installed. You can run it from the build directory but not from anywhere else.

šŸ“Œ 3ļøāƒ£Ā make installĀ - Installs the Compiled Program

What It Does:

  • Copies the compiled filesĀ from theĀ build/Ā folder to the directory specified byĀ -prefix.
  • Makes the program available system-wideĀ (or in the Conda environment, if installed there).

Example:

bash CopyEdit make install
  • If you usedĀ -prefix=/opt/glibc-2.32, then afterĀ make install, the files will be installed in:
    • bash CopyEdit /opt/glibc-2.32/bin/ /opt/glibc-2.32/lib/
make installĀ typically creates:
  • bin/Ā ā†’ Executables
  • lib/Ā ā†’ Libraries
  • include/Ā ā†’ Headers
  • share/Ā ā†’ Data files
  • etc/Ā ā†’ Config files
  • lib/pkgconfig/Ā ā†’ Metadata

What It Produces:

  • TheĀ final installed versionĀ of the program.
  • Now, you can run it from anywhere without specifying a full path.
Ā 

šŸš€ TL;DR: What Each Step Does

Command
What It Does
What It Produces
./configure
Prepares the build (checks dependencies, sets paths, createsĀ Makefile).
AĀ MakefileĀ (instructions for compiling).
make
Compiles the source code into binaries.
A workingĀ compiledĀ program (but not installed yet).
make install
Installs the program in the specified directory (--prefix).
TheĀ final installed versionĀ of the program.
Ā