Page MenuHomeFreeBSD Work around build system raciness

Authored by arichardson on Nov 5 2020, 10:10 AM.
Referenced Files
F88993317: D27102.diff
Mon, Jul 22, 2:16 AM
Unknown Object (File)
Wed, Jul 10, 4:54 AM
Unknown Object (File)
May 15 2024, 1:37 PM
Unknown Object (File)
May 13 2024, 12:50 AM
Unknown Object (File)
Mar 24 2024, 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



We are seeing regular build failures due to being installed again and
another parallel make job tries to read the partially written 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 (
Patch by: Jessica Clarke <>

Test Plan

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

Diff Detail

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

Event Timeline

This revision is now accepted and ready to land.Nov 5 2020, 1:34 PM
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.

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.