Page MenuHomeFreeBSD

bsd.lib.mk: Work around build system raciness
ClosedPublic

Authored by arichardson on Nov 5 2020, 10:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 24, 11:47 PM
Unknown Object (File)
Jan 16 2024, 7:04 PM
Unknown Object (File)
Dec 20 2023, 6:02 AM
Unknown Object (File)
Aug 1 2023, 3:25 PM
Unknown Object (File)
Jul 11 2023, 7:33 PM
Unknown Object (File)
Jul 7 2023, 11:23 PM
Unknown Object (File)
Jun 7 2023, 9:56 AM
Unknown Object (File)
May 13 2023, 3:00 AM
Subscribers

Details

Summary

We are seeing regular build failures due to libc.so being installed again and
another parallel make job tries to read the partially written libc.so at the
same time. When building with -j32 or higher this almost always happens on
the first clean build (subsequent incremental builds always work fine).
Using -S should "fix" the "section header table goes past the end of the
file: e_shoff = 0x..." errors that have started to plague our builds.

I originally thought this only affected CheriBSD, but I just got the same
error while building the latest upstream FreeBSD.

The real fix should be to not install libraries twice, but until then this
workaround is needed.

Obtained from: CheriBSD (https://github.com/CTSRD-CHERI/cheribsd/commit/49837edd3efd5d02a1b120c47f00cfc2d59a9a8e)
Patch by: Jessica Clarke <jrtc27@jrtc27.com>

Test Plan

Fixed the build failures on CheriBSD and seems to work here.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Nov 5 2020, 1:34 PM
share/mk/bsd.lib.mk
416 ↗(On Diff #79207)

Note: we could still skip the -S flag when doing installworld with -DNO_ROOT, it's just a problem during buildworld when installing to the sysroot.

share/mk/bsd.lib.mk
416 ↗(On Diff #79207)

Right. This could probably be more clear in the comment, e.g., by writing "... ends up getting installed to WORLDTMP a second time..."

This was just an optimization in rS322565 so there's no harm in losing it until we find a way to make it work. I found it was related to MK_PROFILE flipping back then.

Redundant building/installing for WORLDTMP is something I imagine addressing with META_MODE+filemon but I've been shy about pushing that upstream. At work it's been working well but has some subtle traps with files moving from objdir -> srcdir (or simply orphaned files in objdir). We have the same problem with buildworld without META_MODE now requiring Makefile.inc1's _cleanobj_fast_depend_hack.

This revision was automatically updated to reflect the committed changes.