News for hackers. Stuff that matters.
Re:Show HN: My C compiler compiled itself by CJefferson on Wednesday December 04, 2024 @01:58AM (#42315061)
I often use a Python program called 'fabricate', which basically checks every file a command opens, and re-runs the command if any touched file changes.

I love it, and I hoped this would become the future of how build-systems are built -- you could automatically parallelise, rebuild, make clean, everything, just by tracking which files are read, and written.

It does add a bit of overhead, but I'd be willing to pay that for simplicity. Unfortunately, it doesn't seem to have caught on.

Re:Show HN: My C compiler compiled itself by anyfoo on Wednesday December 04, 2024 @04:19AM (#42315817)
That is neat, but also super brittle, and full of abstraction leakiness, potentially leading to both false positives and negatives. Sounds like it would break down with ccache or distcc immediately, for example.
Re:Show HN: My C compiler compiled itself by CJefferson on Wednesday December 04, 2024 @05:19AM (#42316121)
I never had any false negatives, they are basically impossible in this framework, except it does assume if a program, and all it's inputs are unchanged, the output is unchanged, so this is no good for programs which randomly produce different outputs.

ccache can cause things to get built twice, because the first run it sees it tries to read a file, then later writes to it, so it knows something different might happen if you run again -- but then again that is just ccache doing it's thing, so it's quick. Yes, distcc wouldn't work, but then again I find distcc super-brittle (so hard to make sure everything has the same compiler versions, etc), I may have used it 20 years ago, but I don't think I ever would now!

Re:Show HN: My C compiler compiled itself by anyfoo on Wednesday December 04, 2024 @05:43AM (#42316264)
Fair!
Re:Show HN: My C compiler compiled itself by dezgeg on Wednesday December 04, 2024 @08:24AM (#42317194)
The 'tup' build system also works this way.