Linux Error Guide: 'make: *** Error 1' — Fix Build-From-Source Failures on Linux
Fix 'make: *** [Makefile:N] Error 1' and 'configure: error: not found' when building software from source on Linux: install missing -dev headers, toolchain, and pkg-config libraries.
- #linux
- #troubleshooting
- #errors
- #compiling
Stuck on this Linux Admins error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Overview
Building software from source fails in two classic places. The ./configure step stops when a required library or tool is missing:
checking for openssl >= 1.1.1... configure: error: OpenSSL development headers not found
And make aborts with a generic recipe failure that only tells you which rule failed, not why:
main.c:12:10: fatal error: openssl/ssl.h: No such file or directory
12 | #include <openssl/ssl.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:42: main.o] Error 1
Error 1 is simply the non-zero exit status of the command in the recipe on line 42 — the true cause is always the compiler or linker message printed just above it.
Symptoms
makestops withmake: *** [Makefile:N: target] Error 1(orError 2) and non-zero exit.- The real error above it is a
fatal error: xxx.h: No such file or directory(missing header) orundefined reference to 'func'(missing library at link time). ./configureexits early withconfigure: error: ... not foundorPackage xxx was not found in the pkg-config search path.make: cc: Command not foundorcommand 'gcc' not found— no toolchain installed at all.- Parallel builds (
make -j) fail intermittently or with confusing ordering.
Common Root Causes
- Missing development headers — the runtime library is installed but the
-dev/-develpackage with its.hfiles is not, causingfatal error: foo.h: No such file or directory. - Missing library at link time — headers present but the shared library is absent, giving
undefined reference/cannot find -lfoo. - No compiler toolchain —
gcc,make, and friends were never installed (build-essential/"Development Tools"group missing). - pkg-config cannot find a dependency — the
.pcfile is missing orPKG_CONFIG_PATHis wrong, soconfigurereports the package as not found. - Wrong dependency version — a header exists but is too old/new for the version the project requires.
- Out-of-order parallel build — a bad Makefile with missing dependencies races under
make -j. - Out of memory during compile — large C++ translation units can trigger the OOM killer, surfacing as an abrupt
Error 1.
Diagnostic Workflow
Read the message directly above the Error 1 line — that is the compiler/linker’s real complaint. Then confirm the toolchain even exists:
gcc --version; make --version; pkg-config --version
For a No such file or directory header error, find which package provides the header. On Debian/Ubuntu use apt-file; on RHEL use dnf provides:
apt-file search openssl/ssl.h # Debian/Ubuntu (sudo apt-get install apt-file first)
dnf provides '*/openssl/ssl.h' # Fedora/RHEL
For a configure: error about a pkg-config package, query it directly:
pkg-config --exists --print-errors openssl
pkg-config --cflags --libs openssl
echo "$PKG_CONFIG_PATH"
For undefined reference / cannot find -lfoo link errors, locate the shared library:
ldconfig -p | grep -i ssl
Rule out an OOM-killed compiler on small machines:
dmesg -T | grep -i 'killed process'
free -h
Example Root Cause Analysis
An engineer builds a small networking utility. make dies with make: *** [Makefile:42: main.o] Error 1. Taken alone, Error 1 is meaningless, so they read the line above it: fatal error: openssl/ssl.h: No such file or directory. OpenSSL is clearly installed (the server serves HTTPS), so the runtime library is present — but the development headers are not, and headers are what the compiler needs.
They locate the provider and install the -dev package:
apt-file search openssl/ssl.h # -> libssl-dev: /usr/include/openssl/ssl.h
sudo apt-get install libssl-dev
make clean && make
The build then completed. The lesson is twofold: Error 1 is never the real message — always read the compiler line above it — and a library being installed for running software does not mean its headers are installed for building against it. Distributions split the runtime (libssl3) from the development files (libssl-dev), and source builds need the latter.
Prevention Best Practices
- Install the toolchain up front:
build-essential(Debian/Ubuntu) ordnf groupinstall "Development Tools"(RHEL/Fedora), pluspkg-config. - Read every project’s README/INSTALL for its named build dependencies before running
configure. - When a header is missing, search for its provider (
apt-file search,dnf provides) rather than guessing the package name. - Remember the runtime vs
-dev/-develsplit — building always needs the development package. - Run
make clean(or delete the build dir) after installing a missing dependency so stale objects do not mask the fix. - On memory-limited hosts, lower
make -jparallelism or add swap to avoid OOM-killed compiles. - Prefer distribution or container-based reproducible builds over ad-hoc source installs where possible.
Quick Command Reference
gcc --version && make --version # is a toolchain installed?
sudo apt-get install build-essential # Debian/Ubuntu compiler stack
sudo dnf groupinstall "Development Tools" # RHEL/Fedora
apt-file search path/to/header.h # which package provides a header
dnf provides '*/header.h' # RHEL/Fedora equivalent
pkg-config --cflags --libs <name> # what configure is looking for
ldconfig -p | grep <lib> # find a shared library for linking
make clean && make # rebuild cleanly after a fix
Conclusion
make: *** [Makefile:N] Error 1 never tells you what actually went wrong — it only reports that the command on that recipe line exited non-zero. The real cause is the compiler or linker message printed immediately above: a missing header (No such file or directory), a missing library (undefined reference), or an absent toolchain. Likewise configure: error: ... not found is almost always a missing -dev/-devel package that pkg-config cannot locate. Install the development packages, remembering the runtime-vs-headers split, run make clean, and rebuild — and keep build-essential and pkg-config on any host where you compile from source.
Fixed it? Get 500 Linux Admins & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.