fix: Stop running autogen.sh when building bundled libuv#430
Conversation
The bundled libuv ships pre-generated autotools files (configure, Makefile.in, aclocal.m4), so regenerating them via autogen.sh is unnecessary and fragile. On CRAN r-devel-macos-arm64, automake is present but the rest of the toolchain (glibtoolize, aclocal-1.16) is missing, causing installation failure. The timestamp-touch approach already prevents make from attempting regeneration, regardless of whether automake is installed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@copilot review |
|
@shikokuchuo I've opened a new pull request, #431, to work on those changes. Once the pull request is ready, I'll request review from you. |
shikokuchuo
left a comment
There was a problem hiding this comment.
Removing the conditional branch would seem to re-introduce #280, which would trigger when the system automake version is different to that used to generate the committed files?
Address review feedback re #280: the generated Makefile has rules that trigger automake if input files (Makefile.am, configure.ac, m4/*.m4) are newer than output files (configure, Makefile.in). Previously only the output files were touched, which could still trigger regeneration if inputs had newer timestamps from extraction ordering. Now touch all autotools-related files (inputs first, then outputs) so make never sees staleness and never fires the regeneration rules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for catching that @shikokuchuo! 071c300 should address the issues there. Also note the updated PR description with the reasoning behind It addressing #280. I also had Claude do a bit of research into other issues that have reported install problems. It generated a little summary that's also included in the PR description. |
|
Below solution suggested by Claude Code. I was sceptical about the diagnosis for "Class 1" problems that the "input files (Makefile.am, configure.ac, m4/*.m4) had newer timestamps than outputs after extraction". Given we just touched the output files, how could the input files have newer timestamps? => Removing the regeneration logic entirely seems to be surer. Thanks for the fix — removing the One suggestion for a more robust solution to the "class 1" failures (#124, #280) where This causes automake to wrap all regeneration rules in the generated This is the standard approach used by projects that ship pre-generated autotools output (curl, libffi, libexpat, libxml2 all use it). With This would need to be done at "Phase 1" time (developer runs |
This is the standard autotools mechanism for preventing make from trying to regenerate autotools files at build time. It wraps all regeneration rules in Makefile.in behind a @MAINTAINER_MODE_TRUE@ conditional, which is disabled by default. The touch logic in Makevars.in is kept as belt-and-suspenders. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shikokuchuo
left a comment
There was a problem hiding this comment.
Great! I would not still touch the files, but it shouldn't do any harm.
Problem
httpuv is failing to install on CRAN
r-devel-macos-arm64with:Root cause
When building the bundled libuv,
src/Makevars.inchecks whetherautomakeis on the system PATH:makedoesn't try to regenerate them, then runs./configure(safe path)autoupdate+autogen.shto regenerate everything from scratch, then runs./configureOn the CRAN
r-devel-macos-arm64machine,automakeis present (so theelsebranch fires), but the rest of the autotools toolchain (glibtoolize, matchingaclocal-1.16) is missing or version-mismatched.autogen.shcalls these tools and fails.This automake-detection logic was added in #319 (Dec 2021) to handle cases where a newer system automake caused timestamp-related regeneration issues (#280). However, the regeneration approach introduced its own fragility — it requires a complete, version-matched autotools toolchain.
Fix
Three layers of defense, each sufficient on its own:
1. Remove
autogen.shat build time (1ec74b9)Remove the
if/elseautomake detection andautoupdate/autogen.shcalls fromMakevars.in. The bundled libuv ships pre-generated autotools output — there is no reason to regenerate at build time. This eliminates all "Class 2" failures (#331, #338, #341, #429) whereautogen.shwas called with an incomplete toolchain.2. Touch inputs AND outputs (071c300)
The pre-#319 touch approach only touched output files (
aclocal.m4,configure,Makefile.in). The generatedMakefilecontains regeneration rules that compare input timestamps (Makefile.am,configure.ac,m4/*.m4) against outputs. If any input has a newer timestamp (e.g. due to extraction ordering),makefires these rules — this was the cause of #124 and #280.We now touch all autotools files, inputs first then outputs set to match, ensuring
mtime(inputs) <= mtime(outputs).3.
AM_MAINTAINER_MODE(913474c)Added
AM_MAINTAINER_MODEto libuv'sconfigure.acand regenerated the autotools files. This wraps all regeneration rules inMakefile.inbehind a@MAINTAINER_MODE_TRUE@conditional that is disabled by default. Without--enable-maintainer-modepassed to./configure, the rules are structurally absent from the generatedMakefile—makenever sees them regardless of timestamps or installed toolchain.This is the standard approach used by projects that ship pre-generated autotools output (curl, libffi, libexpat, libxml2).
Historical evidence
Every libuv build failure in this repo's history falls into one of two classes:
Class 1: Regeneration triggered despite intent to prevent it (#124, #280)
AM_MAINTAINER_MODE(#3)AM_MAINTAINER_MODE(#3)Class 2:
autogen.shcalled with incomplete toolchain (#331, #338, #341, #429)🤖 Generated with Claude Code