Skip to content

gen_git_version.mk not setup in GNU 4.4 #11520

Description

@itssundeep

Describe the bug

When Erlang/OTP is built from a git checkout with GNU Make 4.4 or later, the
emulator version banner reports [source] instead of [source-<sha>]:

# built with GNU Make 4.4.1
Erlang/OTP 29 [erts-17.0.4] [source] [64-bit] [smp:96:96] ...

# same tree, built with GNU Make 4.3
Erlang/OTP 29 [erts-17.0.4] [source-b8b61f0d2a] [64-bit] [smp:96:96] ...

erlang:system_info(system_version) is affected identically, so build
provenance is silently lost for anyone shipping VMs built from source.

The build does not fail and emits no warning. -include is silent by design,
and because the generator script never executes, git is never invoked — so
there is no git error in any build log either.

Root cause

erts/emulator/Makefile.in derives the revision by declaring an -include'd
makefile .PHONY, so that make's makefile-remaking pass regenerates it on every
build (line numbers from master @ 54f3d55ee9):

:26    -include $(TARGET)/gen_git_version.mk
:285   CFLAGS  = ... $(GIT_VSN)
:1470  .PHONY: $(TARGET)/gen_git_version.mk
:1471  $(TARGET)/gen_git_version.mk:
:1474      $(V_at)if utils/gen_git_version $@; then touch beam/erl_bif_info.c; fi

GNU Make 4.4 no longer remakes makefiles that are declared .PHONY. The recipe
never runs, $(TARGET)/gen_git_version.mk is never written, GIT_VSN stays
empty, ERLANG_GIT_VERSION is never defined, and
erts/emulator/beam/erl_bif_info.c:96-100 falls through to the #else branch.

To Reproduce
No OTP checkout required. Four lines:

all: ; @echo DEFAULT-GOAL-RAN
-include foo.mk
.PHONY: foo.mk
foo.mk: ; @echo REMAKE-PASS-RAN
  • GNU Make 4.3 prints both lines.
  • GNU Make 4.4.1 prints only DEFAULT-GOAL-RAN.

Expected behavior
populate sha when build from git repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue is reported as a bughelp wantedIssue not worked on by OTP; help wanted from the communityteam:VMAssigned to OTP team VM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions