Re: Missing dependency on native `makedoc` in `info` Makefile
Manuel Jacob <[email protected]> Mon, 23 Mar 2026 01:39:48 +0100
| Newsgroups | gmane.comp.tex.texinfo.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 22/03/2026 19.09, Gavin Smith wrote: > On Tue, Mar 17, 2026 at 11:20:17AM +0100, Manuel Jacob wrote: >> Hi, >> >> When cross-compiling texinfo in an environment where ncurses is available >> for the host machine (e.g. in a sysroot), but not for the build machine, >> running `make` fails with the following error: >> >> ... >> >> The same error has been reported here: >> https://lists.gnu.org/archive/html/bug-texinfo/2013-11/msg00017.html >> >> In the case of cross-compiling, parts of texinfo are built for running on >> the build machine (in the `tools` directory). For each of the build machine >> and the host machine, it is decided whether the `info` subdirectory is built >> or not, based on `HAVE_TERMLIBS`. If `HAVE_TERMLIBS` is false for the build >> machine and true for the host machine, `tools/info` will not be built, but >> `info` will be built, trying to execute `../tools/info/makedoc`, which is >> not there. >> >> A possible workaround is to execute `make -C tools/info makedoc` before >> executing `make`. > > Thanks for testing and investigating this. I'm surprised that > cross-compilation works at all - the support in the build system for it is > very old and is from before the Perl implementation of makeinfo, as far as > I am aware. > > I've attempted a fix based on your description. I'm not really sure how > I would test this, but if you can confirm this works, we could make this > change. I can confirm that these two ways to build texinfo produce exactly the same end result: 1) without your patch and with `make -C tools/info makedoc` workaround 2) with your patch and without `make -C tools/info makedoc` workaround > diff --git a/ChangeLog b/ChangeLog > index ba1f5e1d7d..8bbc9d546e 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,15 @@ > +2026-03-22 Gavin Smith <[email protected]> > + > + Always build info/makedoc when cross-compiling > + > + * Makefile.am (SUBDIRS) [TOOLS_ONLY]: > + Always include "info" subdirectory to allow "makedoc" program > + to be built on "build" system when cross-compiling, even if terminal > + library is not found on "build". > + * info/Makefile.am (bin_PROGRAMS): Use HAVE_TERMLIBS conditional to > + only include "ginfo" if terminal library is found. > + (LDADD, ginfo_LDADD): Only use $(TERMLIBS) in ginfo_LDADD. > + > 2026-03-22 Patrice Dumas <[email protected]> > > Put lineraw line commands leading and trailing directly in tree > diff --git a/Makefile.am b/Makefile.am > index 5002ff9371..88e673b41b 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -51,15 +51,7 @@ install-tex: > SUBDIRS = > if TOOLS_ONLY > # Build native tools only. > - SUBDIRS += gnulib/lib install-info tta util > -if HAVE_TERMLIBS > - SUBDIRS += info > -else > -# DOS/Windows don't need TERMLIBS to build Info > -if HOST_IS_WINDOWS > - SUBDIRS += info > -endif > -endif > + SUBDIRS += gnulib/lib info install-info tta util We could avoid building the `info` directory for build if it’s not needed for host. But, unless you can think of an easy way to that, it’s probably not worth any extra effort. > else > # All subdirectories. > # Do libs first since the C programs depend on it. > @@ -74,9 +66,8 @@ if HOST_IS_WINDOWS > SUBDIRS += info > endif > endif > - SUBDIRS += install-info po po_document tta Pod-Simple-Texinfo \ > - texindex util doc man > - SUBDIRS += js > + SUBDIRS += install-info js po po_document texindex tta Pod-Simple-Texinfo \ > + util doc man > endif > > distclean-local: > diff --git a/info/Makefile.am b/info/Makefile.am > index 265f538371..f66db95245 100644 > --- a/info/Makefile.am > +++ b/info/Makefile.am > @@ -18,10 +18,18 @@ > # distributed even without no-dist-built-sources > AUTOMAKE_OPTIONS = 1.16 > > +if HAVE_TERMLIBS > +bin_PROGRAMS = ginfo > +else > +# DOS/Windows don't need TERMLIBS to build Info > +if HOST_IS_WINDOWS > +bin_PROGRAMS = ginfo > +endif > +endif You could wrap the whole block in `if ! TOOLS_ONLY` because it doesn’t seem like the info tool is needed for the build machine. > + > # Use `ginfo' for building to avoid confusion with the standard `info' > # target. Removes the `g' in the install rule before applying any > # user-specified name transformations. Maybe this comment should be moved up to before the previous block? > -bin_PROGRAMS = ginfo > transform = s/ginfo/info/; $(program_transform_name) > > AM_CPPFLAGS = \ > @@ -34,7 +42,7 @@ AM_CPPFLAGS = \ > -DSYSCONFDIR=\"$(sysconfdir)\" \ > -DPKGDATADIR=\"$(pkgdatadir)\" > > -LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) > +LDADD = $(top_builddir)/gnulib/lib/libgnu.a > > # for various gnulib modules > LDADD += $(LIBINTL) $(LIBICONV) $(LIBC32CONV) $(LIBUNISTRING) $(LIBTHREAD) > @@ -45,6 +53,8 @@ LDADD += $(HARD_LOCALE_LIB) $(SETLOCALE_NULL_LIB) > # for mbrtowc gnulib module which is brought in indirectly > LDADD += $(MBRTOWC_LIB) > > +ginfo_LDADD = $(LDADD) $(TERMLIBS) > + > # Needed if make has not run in the "gnulib" directory yet > ../gnulib/lib/libgnu.a: > cd ../gnulib/lib && $(MAKE) $(AM_MAKEFLAGS) > [unrelated to the diff:] info/Makefile.am contains the following: funs.h: makedoc$(EXEEXT) $(cmd_sources) rm -f $(generated_sources) $(top_builddir)/$(native_tools)/info/makedoc $(cmd_sources) I think that the dependency on makedoc$(EXEEXT) is not necessary in the cross-compilation case. Skipping compilation of it won’t make a big difference in compilation time, but it probably clarifies things for the reader (even though it’s more verbose). (This made me think whether there is a way to actually add a dependency on `$(top_builddir)/$(native_tools)/info/makedoc`. I’m not at all familiar with recursive automake, but there doesn’t seem a straightforward way).