Development tips: Difference between revisions

From miki
Jump to navigation Jump to search
Line 15: Line 15:


== Reproducible build ==
== Reproducible build ==
This section is dedicated to reproducible builds / build determinism / deterministic builds.

=== libraries / ar ===
=== libraries / ar ===
With libraries produced with <code>ar</code>, use option <code>D</code> to produce '''deterministic build'''.
With libraries produced with <code>ar</code>, use option <code>D</code> to produce '''deterministic build'''.
Line 30: Line 32:
ardee.py mylib.a
ardee.py mylib.a
</source>
</source>

=== clang ===
See https://blog.llvm.org/2019/11/deterministic-builds-with-clang-and-lld.html .


== Calendars ==
== Calendars ==

Revision as of 22:02, 2 March 2022

Summary of things I do frequently or that I learned the hard way

Console tips

  • Search for whole words occurence:
ag "\bWHOLEWORD\b" # or
ag -w WHOLEWORD

Advices

  • Always keep your tests in sync with your source code.
  • At the very least, this means in the same repository. Ideally code and tests are updated together in the same commit.
  • Make your startup / boot / init sequence independent of system configuration. Avoid early optimization.

Reproducible build

This section is dedicated to reproducible builds / build determinism / deterministic builds.

libraries / ar

With libraries produced with ar, use option D to produce deterministic build.

ar rcsD mylib.a foo.o bar.o

Alternatively one can run ranlib in deterministic mode:

ranlib -D mylib.a

I also made a custom python script ardee.py (that also works on libraries produce by ARM toolchain armar, which doesn't have the D flag)

ardee.py mylib.a

clang

See https://blog.llvm.org/2019/11/deterministic-builds-with-clang-and-lld.html .

Calendars

Use ICU libraries that deal with all subtleties!