Programming and Build Errors on Linux
Most build failures aren’t bugs in your code — they’re missing dev packages, link order issues, or runtime loader misconfiguration. Recognizing the error pattern fast is the difference between a 5-minute fix and an hour of poking. The ten errors below cover gcc, ld, ldd, ABI mismatches, and the rest of the toolchain.
#111 – fatal error: foo.h: No such file or directory
Description: Compile fails because a header isn’t present in any include path.
Solution: Missing dev package. apt install lib<name>-dev on Debian; <name>-devel on RHEL. Find the right package: apt-file search foo.h or dnf provides */foo.h.
#112 – undefined reference to `function' (linker)
Description: Compile succeeds but link fails because a referenced symbol isn’t found.
Solution: Missing -l<libname> on link line; OR link order wrong (libraries must come AFTER source files referencing them). gcc src.o -lssl -lcrypto.
#113 – error while loading shared libraries: lib<X>.so
Description: Binary runs but can’t find a runtime shared library.
Solution: ldd ./binary | grep "not found"; install the runtime package; or set LD_LIBRARY_PATH for development; permanent: add path to /etc/ld.so.conf.d/ + ldconfig.
#114 – ABI version mismatch (GLIBC_2.34 not found)
Description: Binary built on newer system won’t run on older.
Solution: Rebuild on a target-matching toolchain. Use a container with the target distro for builds (e.g., quay.io/centos/centos:stream8).
#115 – Segmentation fault in test suite (only)
Description: Code passes locally but crashes when the test suite runs it.
Solution: ulimit -c unlimited in your test runner; analyze cores with gdb; valgrind for memory errors; sanitizers (-fsanitize=address).
#116 – make: command not found / cmake: command not found
Description: Build script fails because the build tools aren’t installed.
Solution: apt install build-essential (Debian) or dnf groupinstall "Development Tools" (RHEL).
#117 – Python: ModuleNotFoundError
Description: import fails because the package isn’t installed in the active Python interpreter.
Solution: Activate the right venv; which python + which pip should point to the same prefix; pip install -r requirements.txt.
#118 – npm ERR! ENOSPC (out of space)
Description: npm install aborts because the disk filled up.
Solution: node_modules is huge; npm cache clean --force; mount /tmp as tmpfs if it’s the bottleneck; consider pnpm for shared store.
#119 – Permission denied (running compiled binary)
Description: A newly built binary won’t execute despite the user owning it.
Solution: chmod +x ./binary; or noexec mount: mount | grep noexec, move binary to a non-noexec FS.
#120 – Out of memory during compile (gcc cc1plus killed)
Description: gcc / g++ is OOM-killed mid-compile on a small build host.
Solution: Templates and LTO are RAM-hungry. Reduce parallelism: make -j2; add swap; reduce optimization (-O1 instead of -O3); split large translation units.
Conclusion
- Header missing? Install the
-dev/-develpackage. - Symbol missing at link time? Library not on link line, or wrong order.
- Symbol missing at runtime?
lddfinds the missing .so. - Build in a container matching production for ABI compatibility.
- Out-of-memory builds: lower
-j, use distcc/cache, add swap.