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
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)
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)
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
Solution: apt install build-essential (Debian) or dnf groupinstall "Development Tools" (RHEL).
#117 Python: ModuleNotFoundError
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)
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)
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)
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.
Related Linux Admin articles
- Linux Package Management Errors — for installing the right -dev packages
- Linux CI/CD & Automation Errors — build failures in pipelines
- Linux File Permissions — for chmod / noexec issues