Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: Improve deterministic builds #5965

Merged
merged 7 commits into from
Jun 29, 2022
Merged

compiler: Improve deterministic builds #5965

merged 7 commits into from
Jun 29, 2022

Commits on May 6, 2022

  1. compiler: Make EPP respect +deterministic

    Makes the EPP module use basenames rather than absolute paths for all
    -file attributes / ?FILE macros when +deterministic is set. Previously,
    EPP did not respect +deterministic in all scenarios, so build output
    could still contain absolute paths.
    TD5 committed May 6, 2022
    Configuration menu
    Copy the full SHA
    af9b14c View commit details
    Browse the repository at this point in the history
  2. compiler: Make asn1ct_gen respect +deterministic

    Makes asn1ct_gen filter out potentially non-deterministic attributes
    from generated .erl files when +deterministic is set.
    TD5 committed May 6, 2022
    Configuration menu
    Copy the full SHA
    ebda708 View commit details
    Browse the repository at this point in the history
  3. compiler: Make leex respect +deterministic

    Makes generated leex scanners only use basenames in generated -file
    attributes, rather than absolute paths when +deterministic is set.
    TD5 committed May 6, 2022
    Configuration menu
    Copy the full SHA
    d8014fb View commit details
    Browse the repository at this point in the history
  4. compiler: Make yecc respect +deterministic

    Makes generated yecc parsers use only basenames in generated -file
    attributes rather than absolute paths when +deterministic is set.
    TD5 committed May 6, 2022
    Configuration menu
    Copy the full SHA
    883d86c View commit details
    Browse the repository at this point in the history
  5. compiler: Make compiler forward +determinsitic flag to epp

    Makes compile pass along the +deterministic flag for epp to utilise.
    TD5 committed May 6, 2022
    Configuration menu
    Copy the full SHA
    8d87cd6 View commit details
    Browse the repository at this point in the history
  6. compiler: Make test_lib robust to +deterministic

    Makes test_lib avoid a crash if +deterministic is enabled to tests.
    +deterministic strips the compilation options entirely, which test_lib
    wasn't able to handle. Now, an empty list is returned in that case.
    TD5 committed May 6, 2022
    Configuration menu
    Copy the full SHA
    a22b140 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2022

  1. make: Allow OTP to be built deterministically

    Add a --enable-deterministic-build to the configure script,
    which sets ERL_DETERMINISTIC=yes throughout the relevant
    Makefiles, which then invoke the relevant build stages with the
    +deterministic option.
    
    This addresses absolute paths being included in generated .erl files
    and compiled .beam files that resulted in builds from different source
    directories generating different artefacts (which is a component of the
    issue in #4482).
    
    I think it would make sense to make this the default at some stage, but
    I've put the change behind a flag for now to decouple
    making deterministic OTP builds possible from making them the default.
    
    Having +deterministic set results in compiler options being
    removed from the module info for modules where this options was used.
    This may have other implications for users of OTP.
    
    For tests themselves, +determinism is not set, since many test cases
    depend on accessing the test module's compilation options, or other
    features not available in deterministic mode, in order to configure
    themselves. For tests of the determinism feature specifically,
    +deterministic must be explicitly passed to the compiler within the
    relevant test cases.
    TD5 committed Jun 25, 2022
    Configuration menu
    Copy the full SHA
    da001d9 View commit details
    Browse the repository at this point in the history