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

Fix parallel build of gnu-efi #643

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

jepio
Copy link

@jepio jepio commented Feb 29, 2024

When building with make 4.4.1, gnu-efi may be built twice and in parallel:

$ make -n -j ARCH=x86_64 2>&1 | tee build.log
$ grep -e 'make -C gnu-efi' build.log
make -C gnu-efi \
make -C gnu-efi \

This has been seen to cause linking failures when building libgnuefi.a because some object files may end up truncated.

The reason for this is that make interprets multiple targets in the same rule as independent and can run the rule multiple times. The solution is to define a grouped target with &:, which causes make to behave the way one expects: runs the rule once and expects it to create all targets.

Grouped target support was added in make 4.3 released 4 years ago.

When building with make 4.4.1, gnu-efi may be built twice and in parallel:

  $ make -n -j ARCH=x86_64 2>&1 | tee build.log
  $ grep -e 'make -C gnu-efi' build.log
  make -C gnu-efi \
  make -C gnu-efi \

This has been seen to cause linking failures when building libgnuefi.a because
some object files may end up truncated.

The reason for this is that make interprets multiple targets in the same rule
as independent and can run the rule multiple times. The solution is to define a
grouped target with &:, which causes make to behave the way one expects: runs
the rule once and expects it to create all targets.

Grouped target support was added in make 4.3 released 4 years ago.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
jepio added a commit to flatcar/scripts that referenced this pull request Feb 29, 2024
The bundled gnu-efi build is implemented in a buggy way that can break when
built in parallel. We've hit this in the nightly sdk build. Add a patch for it.

The patch has been posted upstream at rhboot/shim#643.
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
jepio added a commit to flatcar/scripts that referenced this pull request Feb 29, 2024
The bundled gnu-efi build is implemented in a buggy way that can break when
built in parallel. We've hit this in the nightly sdk build. Add a patch for it.

The patch has been posted upstream at rhboot/shim#643.
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
jepio added a commit to flatcar/scripts that referenced this pull request Feb 29, 2024
The bundled gnu-efi build is implemented in a buggy way that can break when
built in parallel. We've hit this in the nightly sdk build. Add a patch for it.

The patch has been posted upstream at rhboot/shim#643.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
@vathpela
Copy link
Contributor

vathpela commented May 8, 2024

"4 years ago" does indeed seem like it's a long time, but quite a few of our consumers are stuck (for now) on make 3.82. Is there another way we can avoid this behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants