Saltar al contenido ForoHackers

Build systems: start here

Sistemas de compilación
#3351 · · Citar · Denunciar

A build system turns source files into something that runs: it decides what to compile, in which order, with which flags, and what it can skip because nothing changed. A good one is fast, correct and repeatable, so the same inputs give the same output on your machine, a colleague's and a server.

Key concepts

  • Dependency graph: targets depend on inputs and on each other; the tool walks the graph in order.
  • Incremental builds: rebuild only what changed, which needs every input to be declared.
  • Reproducibility: pinned tools and dependencies, and no hidden state from the environment.
  • Dependency management: fetching libraries at fixed versions, with checks of what was fetched.
  • Caching and parallelism: independent steps run at once, and results are reused.

Vocabulary

  • Target: something to build, such as a library or a binary.
  • Artifact: the file a build produces.
  • Make: the classic tool built around rules and timestamps.
  • Lock file: a record of the exact versions a build used.

What to study, in order

  1. Write a Makefile by hand for a small C project, with header dependencies.
  2. Read the compiler and linker commands your build runs and explain each flag.
  3. Use your language's standard build tool, and inspect how it resolves dependencies.
  4. Make a build reproducible: pin everything, build twice and compare the results byte for byte.
  5. Try a build tool with a strict dependency graph and see what breaks when an input is undeclared.

Related tags

#toolchains #ci-cd #compilers #developer-tools

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder